wmedvede commented on code in PR #309:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/309#discussion_r1402689331
##########
controllers/discovery/kubernetes_catalog.go:
##########
@@ -58,21 +72,97 @@ func (c k8sServiceCatalog) resolveServiceQuery(ctx
context.Context, uri Resource
}
func (c k8sServiceCatalog) resolvePodQuery(ctx context.Context, uri
ResourceUri, outputFormat string) (string, error) {
- if pod, service, err := findPodAndReferenceServiceByPodLabels(ctx,
c.Client, uri.Namespace, uri.Name); err != nil {
+ if pod, serviceList, err := findPodAndReferenceServices(ctx, c.Client,
uri.Namespace, uri.Name); err != nil {
return "", err
} else {
- if service != nil {
- if serviceUri, err := resolveServiceUri(service,
uri.GetPort(), outputFormat); err != nil {
+ if serviceList != nil && len(serviceList.Items) > 0 {
+ referenceService :=
selectBestSuitedServiceByCustomLabels(serviceList, uri.CustomLabels)
+ return resolveServiceUri(referenceService,
uri.GetPort(), outputFormat)
+ } else {
+ return resolvePodUri(pod, "", uri.GetPort(),
outputFormat)
+ }
+ }
+}
+
+func (c k8sServiceCatalog) resolveDeploymentQuery(ctx context.Context, uri
ResourceUri, outputFormat string) (string, error) {
Review Comment:
After re-reading... myself :) , yeah, we should go with Proposal2, at least
for the Deployment. Since the ReplicaSet associated with the deployment don't
warrant that only one pod instance will be created even in the case where you
set the replicas == 1, and we might face situations where 2 pods can be around
(at least for a period of time).
wdyt?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]