You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tchughesiv (via GitHub)" <gi...@apache.org> on 2023/11/10 18:56:48 UTC

Re: [PR] Fix #304 - Operator driven service discovery API [incubator-kie-kogito-serverless-operator]

tchughesiv commented on code in PR #283:
URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/283#discussion_r1389784338


##########
utils/kubernetes/deployment.go:
##########
@@ -111,6 +111,21 @@ func GetContainerByName(name string, podSpec *v1.PodSpec) (*v1.Container, int) {
 	return nil, -1
 }
 
+// GetContainerPortByName returns a pointer to the ContainerPort within the given Container.
+// If none found, returns nil.
+// It also returns the position where the container port was found, -1 if none.
+func GetContainerPortByName(name string, container *v1.Container) (*v1.ContainerPort, int) {
+	if container == nil {

Review Comment:
   should this instead be `if container != nil {` and just `return nil, -1` once at the end of the function?



##########
utils/kubernetes/service.go:
##########
@@ -42,3 +42,18 @@ func RetrieveServiceURL(service *v1.Service) (*apis.URL, error) {
 		Path:   service.Name}
 	return apis.ParseURL(url.String())
 }
+
+// GetServicePortByName returns a pointer to the ServicePort within the given Service.
+// If none found, returns nil.
+// It also returns the position where the service port por was found, -1 if none.
+func GetServicePortByName(name string, service *v1.Service) (*v1.ServicePort, int) {
+	if service == nil {

Review Comment:
   should this instead be `if service != nil {` and just `return nil, -1` once at the end of the function?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org