-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Prevent definition of same gvk in custom resource configuration #1810
Prevent definition of same gvk in custom resource configuration #1810
Conversation
3593279
to
affbb8c
Compare
affbb8c
to
fe097b6
Compare
I have a feeling that this will lead to some unexpected behavior. It is always safer to override the data completely to avoid having data leaking from past configurations. Generally speaking, I am not a fan of complexifying how configuration is consumed. Reading a configuration file should be really straightforward for a software. I'd rather have the configuration file generated from a data templating language than adding additional complexity to the code. |
Seems to be a fair point. Where I was coming from was: using kustomize to provision kube-state-metrics by using the official helm-chart of kube-state-metrics. When using kustomize I would then have to use some other pre-processing to create the single CRD configuration (e.g. maybe via helm?). My first thought was about having a single config file for each CR I want to produce metrics for and use a single configmap which has multiple files for providing them to the pod. However: I'm ok to drop that cli parts 👍 At least the check in https://github.com/kubernetes/kube-state-metrics/pull/1810/files#diff-bf91d16f16c99a97ad09eb6587f27d8fc075a68825d396e035c8100f864a7582R174-R176 should still get added to the |
Would having CustomResourceStateMetrics CRDs and a way for kube-state-metrics to discover them, solve this problem as well? This might make things way more complex but would allow other deployments to ship their own CRSM config.
👍 |
Yes, that even seems to be the best method to provide the configuration 👍 |
fe097b6
to
ad6a739
Compare
Updated to only prevent the configuration issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, just a small nit
ad6a739
to
44831f7
Compare
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrischdi, fpetkovski, mrueg 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 |
@mrueg @chrischdi Would it make sense to track this in a new issue? If I saw correctly, it's currently not tracked in an issue. |
I hope it is okay that I directly created a PR for this. I can also create an issue for that first if this is preferred 👍
What this PR does / why we need it:
This PR adjusts the options for custom resource configuration to allow defining them multiple times.
This allows to split potentially large configurations to multiple files.
It also adds validation to detect if the configuration includes multiple definitions for the same resource name.
This prevents the following unexpected behaviour:
Configuration:
Expected result:
Actual result metrics:
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
No changes to cardinality
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #