-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
support "True" and "False" as string in custom-resource-state #1963
support "True" and "False" as string in custom-resource-state #1963
Conversation
|
Welcome @jabdoa2! |
c537125
to
eb67ca8
Compare
…rator status conditions
eb67ca8
to
2b5460f
Compare
Since this really depends on the implementor of the CR, having some defaults make sense. Anything else really should be defined via a user supplied valuemap (e.g.if the implementation returns "Ok" etc.). |
Co-authored-by: Manuel Rüger <manuel@rueg.eu>
8c4be01
to
e26d682
Compare
/approve |
It would be good to add a sentence or two to https://github.com/kubernetes/kube-state-metrics/blob/main/docs/customresourcestate-metrics.md about this conversion. |
/approve |
/assign |
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgrisonnet, jabdoa2, mrueg, rexagod 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 |
What this PR does / why we need it:
Kubernetes Operators usually store status conditions in the following format:
Note that
status
is actually a string. This previously broke KSM custom-resource-state gauges because it could not convert strings to float. This PR maps "True", "true", "Yes" and "yes" to1.0
and "False", "false", "No", "no" to0.0
. This allows us to use custom-resource-state for all CRD objects of standard kubernetes operators.For a single condition you can use (as in unit test
status_conditions
):To expose one metric per status
type
(as in unit teststatus_conditions_all
):Guess this could be something for the documentation as it will be a very common usecase for controller CRDs.
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
It does not change cardinality. It allows KSM to support
.status.conditions
used by standard kubernetes operators.Which issue(s) this PR fixes
Fixes #1962