Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Incorrect Kubernetes Port Annotation for Management Interface #40409

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BrunoSena97
Copy link

resolves #37904

Changes include:

  • Updated the createAnnotations method in the KindProcessor class to check if the management interface is enabled and if the annotation key is "prometheus.io/port".
  • If both conditions are true, the method now produces a new KubernetesAnnotationBuildItem with the key k, the value managementPort, and the target KIND.
  • Otherwise, it produces a new KubernetesAnnotationBuildItem with the key k, the value v, and the target KIND.

This commit addresses the issue where the `prometheus.io/port` annotation was incorrectly set to the main application server port instead of the management port when the management interface was enabled in a Quarkus application deployed to Kubernetes.

Changes include:
- Updated the `createAnnotations` method in the `KindProcessor` class to check if the management interface is enabled and if the annotation key is `"prometheus.io/port"`.
- If both conditions are true, the method now produces a new `KubernetesAnnotationBuildItem` with the key `k`, the value `managementPort`, and the target `KIND`.
- Otherwise, it produces a new `KubernetesAnnotationBuildItem` with the key `k`, the value `v`, and the target `KIND`.

These changes ensure that the `prometheus.io/port` annotation is correctly set to the management port when the management interface is enabled.
@gastaldi gastaldi requested a review from iocanel May 2, 2024 16:53
@gsmet
Copy link
Member

gsmet commented May 10, 2024

@iocanel could you have a look at this one?

Copy link
Contributor

@iocanel iocanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for taking a stub at it.

Is there a reason why this is specific to kind. My understanding is that this is something that should be applied to all targets and not just kind. So, I think that a better place for this might be somewhere around here:

.

More specifically, I would just ensure that this line:

config.getPrometheusConfig().port.orElse(prefix + "/port"), "" + port.get().getContainerPort(),
uses the right port.

Finally, we definitely need an integration test for this. Do let me know if you need a pointer for that.

@gsmet
Copy link
Member

gsmet commented Jun 6, 2024

@BrunoSena97 are you willing to pursue this? Thanks!

@cescoffier
Copy link
Member

@BrunoSena97 Are you having a look to @iocanel 's review?

@cescoffier
Copy link
Member

@iocanel What should be do here? Do we want this feature?

@iocanel iocanel added the good first issue Good for newcomers label Dec 5, 2024
@iocanel
Copy link
Contributor

iocanel commented Dec 5, 2024

@cescoffier: I think that we do. I would keep this open, just in case someone will pick this up.

@cescoffier cescoffier added the triage/on-ice Frozen until external concerns are resolved label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes good first issue Good for newcomers triage/on-ice Frozen until external concerns are resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kubernetes extension uses wrong metrics port when management interface is in use
4 participants