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: Add metric port to pods and service #1199

Merged

Conversation

arsenetar
Copy link
Contributor

@arsenetar arsenetar commented Feb 1, 2024

Changes

This allows the usage of Prometheus PodMonitors and/or ServiceMonitors to configure scraping of metrics. This is often preferred over the annotations on the pods. This is also more inline with the rest of Knative.

  • Add metric port definition to both gateway pods and controller pods.
  • Add metric port to controller service

NOTE: Did not add metric port to gateway services as those often are exposed and exposing the metrics via those services is probably not desired in most cases.

/kind enhancement

Release Note

Metrics ports for net-kourier-controller and 3scale-kourier-gateway are now exposed and can be used with Service Monitors

Docs

NONE

Additionally ServiceMonitors and PodMonitors should probably be provided somewhere, maybe over in https://github.com/knative-extensions/monitoring with the rest for base Knative?

This allows the usage of Prometheus PodMonitors and/or ServiceMonitors
to configure scraping of metrics.  This is often preferred over the
annotations on the pods.  This is also more inline with the rest of
Knative.

- Add metric port definition to both gateway pods and controller pods.
- Add metric port to controller service

NOTE: Did not add metric port to gateway services as those often are
exposed and exposing the metrics via those services is probably not
desired in most cases.
Copy link

knative-prow bot commented Feb 1, 2024

Welcome @arsenetar! It looks like this is your first PR to knative-extensions/net-kourier 🎉

@knative-prow knative-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 1, 2024
Copy link

knative-prow bot commented Feb 1, 2024

Hi @arsenetar. Thanks for your PR.

I'm waiting for a knative-extensions member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow knative-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 1, 2024
@arsenetar
Copy link
Contributor Author

@ReToCode @skonto Is there any feedback on this?

Copy link
Member

@ReToCode ReToCode left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

/hold for @skonto

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 11, 2024
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2024
Copy link

knative-prow bot commented Mar 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: arsenetar, ReToCode

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2024
@ReToCode
Copy link
Member

Thanks, I think this makes sense.

Additionally ServiceMonitors and PodMonitors should probably be provided somewhere, maybe over in https://github.com/knative-extensions/monitoring with the rest for base Knative?

I think that's a good idea. Any input @skonto?

@ReToCode
Copy link
Member

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 11, 2024
@skonto
Copy link
Contributor

skonto commented Apr 10, 2024

Hi all sorry for the late reply, out of curiosity I would like to take a look at what is exposed. One long standing concern with all metric ports is what info they leak see for example: knative/serving#8959. Downstream we fix that with kube-rbac-proxy at the moment.

@arsenetar
Copy link
Contributor Author

@skonto I don't disagree with the potential for exposed data. If we don't add the port to the controller service then this has no impact vs existing. For the pods they already have to old annotations for Prometheus, the change to those only allows the pods to be used with the PodMonitors as well which is the more common approach. It doesn't change the potential exposure at the pod level.

@skonto
Copy link
Contributor

skonto commented May 15, 2024

/unhold

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 15, 2024
@knative-prow knative-prow bot merged commit 9cf9736 into knative-extensions:main May 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/enhancement lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants