astefanutti commented on a change in pull request #825: Misleading "service.enabled=false" when used in combination with the prometheus trait i URL: https://github.com/apache/camel-k/pull/825#discussion_r304383181
########## File path: pkg/trait/prometheus.go ########## @@ -66,43 +66,55 @@ func (t *prometheusTrait) Apply(e *Environment) (err error) { // Configure the Prometheus Java agent envvar.SetVal(&e.EnvVars, "AB_PROMETHEUS_PORT", strconv.Itoa(t.Port)) - // Expose the Prometheus endpoint - // Either update the existing service added by previously executed traits - // (e.g. the service trait) or add a new service resource - svc := e.Resources.GetService(func(svc *corev1.Service) bool { - return svc.Name == e.Integration.Name - }) - if svc == nil { - svc = getServiceFor(e) - e.Resources.Add(svc) + // Register a post processor to add ports to the integration deployment and service + service := e.Resources.GetServiceForIntegration(e.Integration) + if service == nil { + e.Integration.Status.SetCondition( + v1alpha1.IntegrationConditionPrometheusAvailable, + corev1.ConditionFalse, + v1alpha1.IntegrationConditionServiceNotAvailableReason, + "", + ) + + return nil + } + + container := e.Resources.GetContainerForIntegration(e.Integration) + if container == nil { Review comment: Out of curiosity, can that actually happen? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services