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] add Controller Selection #5142

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wustus
Copy link

@wustus wustus commented Jan 14, 2025

What this PR does / why we need it

This PR aims to implement the possibility of deploying the image as a DaemonSet. Currently only Deployment and StatefulSet are supported.
When scraping metrics exported by kube-state-metrics, they will be labeled to originate from the node the pod is running on. In our case some grafana-agent collects metrics exposed by pods and adds an x_host label according to the node this pod is running on. By adding the possibility of running kube-state-metrics as a DaemonSet, metrics are correctly labeled with their node-origin.

Which issue this PR fixes

Implements #4770

Special notes for your reviewer

  • I tried to stay backward compatible by adding {{- if eq (.Values.controller | default "deployment") "deployment" }} in a few places.
  • daemonset.yaml is a copy of deployment.yaml with removal of .Values.autosharding.enabled and additional setting of the node name env variable according to this.
  • When testing, I limited the resources to --resource=pods as is described in the example in the kube-state-metrics repository

Checklist

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

* `.Values.controller` is set, possible values are `deployment` and `daemonset`
* if `.Values.controller` is missing, `deployment` is assumed for backwards compatibility
* `.Values.autosharding: true` changes `Deployment` to `StatefulSet`

Signed-off-by: Justus Stahlhut <[email protected]>
Copy link

stale bot commented Feb 25, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@wustus
Copy link
Author

wustus commented Feb 25, 2025

This PR addresses a missing feature explicitly described in the kube-state-metrics README. Unless an alternative implementation exists, this should not be considered stale.

@stale stale bot removed the lifecycle/stale label Feb 25, 2025
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.

1 participant