-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Fix CR cache for GVK all specified case #2567
fix: Fix CR cache for GVK all specified case #2567
Conversation
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The 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-sigs/prow repository. |
7f469c5
to
d8fb76d
Compare
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.
Good catch, thank you! Just one nit.
desc: "fixed version and kind, no matching cache entry", | ||
gvkmaps: &CRDiscoverer{ | ||
Map: map[string]map[string][]kindPlural{ | ||
"testgroup": { | ||
"v1": { | ||
kindPlural{ | ||
Kind: "TestObject2", | ||
Plural: "testobjects2", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
gvk: schema.GroupVersionKind{Group: "testgroup", Version: "v1", Kind: "TestObject1"}, | ||
want: nil, | ||
}, |
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.
I believe this is the only test case needed to verify the change above (the fact that the first case ends up taking whatever the group
is). The other three seem to pass before this patch too.
d8fb76d
to
5631601
Compare
/lgtm Thank you! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chelseychen, 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:
Currently in CR discoverer, for the case where the GVK are all specified for a CR in CRS config (see below example) but CRD not registered, it will still have that CR enabled in CR factories.
The expected behaviour is that that resource shouldn't be enabled since the cache map doesn't contain that CRD.
This PR fixes this issue.
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
No change for 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 #2566