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_r304382913
 
 

 ##########
 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 {
 
 Review comment:
   If there is no service, it'd should not prevent the prometheus port to be 
added, so the service logic and that of the container port should not be 
entangled. 

----------------------------------------------------------------
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

Reply via email to