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

[kube-state-metrics] Support CustomResourceState #3470

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

mrueg
Copy link
Member

@mrueg mrueg commented Jun 7, 2023

What this PR does / why we need it

This adds support to supply a CustomResourceState configuration to kube-state-metrics.

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

Special notes for your reviewer

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

@mrueg mrueg marked this pull request as draft June 7, 2023 16:21
@mrueg mrueg force-pushed the enable-customresourcestate branch 7 times, most recently from 0d9af4f to ef3d4d4 Compare June 7, 2023 19:19
@mrueg mrueg marked this pull request as ready for review June 7, 2023 19:21
@mrueg mrueg marked this pull request as draft June 7, 2023 22:06
- customresourcedefinitions
verbs: ["list", "watch"]
{{- if $.Values.customResourceState.generateRBAC }}
{{- range $.Values.customResourceState.config.spec.resources }}
Copy link
Member Author

Choose a reason for hiding this comment

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

This unfortunately does not work as expected as the clusterrole expects a resource and not a kind.

Copy link
Member

Choose a reason for hiding this comment

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

@mrueg Do you have a config example and the expected output here?

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/mrueg/customresourcestate-configs you can check with one of them.

We'll also look upstream into changing the interface to make this easier.
kubernetes/kube-state-metrics#2093

Copy link
Member

Choose a reason for hiding this comment

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

I think generating a configmap with all the resources and mounting it like in @QuentinBisson example will work, even with a flat include of all the resources under config:.
This solution doesn't require a breaking change in kube-state-metrics, but you can still decide to it if you think the format needs to move forward.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think for right now, I would drop it and point to .Values.rbac.extraRules

@QuentinBisson
Copy link
Member

This is what we use internally, maybe this can be of help https://github.com/giantswarm/cluster-api-monitoring-app/tree/main/helm/cluster-api-monitoring/templates

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
@mrueg mrueg force-pushed the enable-customresourcestate branch from ef3d4d4 to 716b8b9 Compare June 13, 2023 10:42
@mrueg mrueg marked this pull request as ready for review June 13, 2023 10:53
@dotdc dotdc merged commit fd01c56 into prometheus-community:main Jun 13, 2023
4 checks passed
Matiasmct pushed a commit to giffgaff/prometheus-charts that referenced this pull request Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[kube-state-metrics] Add configmap template
3 participants