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_r304383253
##########
File path: pkg/trait/jolokia.go
##########
@@ -115,25 +115,33 @@ func (t *jolokiaTrait) Apply(e *Environment) (err error)
{
}
envvar.SetVal(&e.EnvVars, "AB_JOLOKIA_OPTS", strings.Join(optionValues,
","))
- // Register a post processor to add a container port to the integration
deployment
- e.PostProcessors = append(e.PostProcessors, func(environment
*Environment) error {
- var container *corev1.Container
- environment.Resources.VisitContainer(func(c *corev1.Container) {
- if c.Name == environment.Integration.Name {
- container = c
- }
- })
- if container != nil {
- container.Ports = append(container.Ports,
corev1.ContainerPort{
- Name: "jolokia",
- ContainerPort: int32(t.Port),
- Protocol: corev1.ProtocolTCP,
- })
- } else {
- return errors.New("cannot add Jolokia container port:
no integration container")
- }
+ 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:
[email protected]
With regards,
Apache Git Services