-
Notifications
You must be signed in to change notification settings - Fork 41.9k
resourcequota: fix namespace GroupKind using wrong API group #135398
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
base: master
Are you sure you want to change the base?
Conversation
|
This issue is currently awaiting triage. If a SIG or subproject determines 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. |
|
/ok-to-test |
|
Let's changelog this; it's something cluster administrators would be keen to track (in terms of "when was this fixed?") |
|
Thanks @lmktfy. The changelog has been added. I think this PR needs to be cherry-picked to a previous version. |
|
It was caused by #95012 |
|
/cc @pohly PTAL. |
liggitt
left a comment
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 think the fix can be smaller to simply switch to the correct package SchemeGroupVersion
I don't think we need a release note, a namespace create would only have been subjected to quota if the namespace already existed and a ResourceQuota object in the namespace was trying to limit namespaces, but if it already existed, the create would fail already
| { | ||
| "namespace creation", | ||
| admission.NewAttributesRecord(nil, nil, v1.SchemeGroupVersion.WithKind("Namespace"), "namespace", "namespace", schema.GroupVersionResource{}, "", admission.Create, nil, false, nil), | ||
| admission.NewAttributesRecord(nil, nil, schema.GroupVersionKind{Group: corev1.GroupName, Version: "v1", Kind: "Namespace"}, "namespace", "namespace", schema.GroupVersionResource{}, "", admission.Create, nil, false, 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.
use corev1.SchemeGroupVersion
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.
Done.
|
|
||
| var ( | ||
| namespaceGVK = v1.SchemeGroupVersion.WithKind("Namespace").GroupKind() | ||
| namespaceGVK = schema.GroupKind{Group: corev1.GroupName, Kind: "Namespace"} |
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.
corev1.SchemeGroupVersion.WithKind("Namespace").GroupKind()
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.
Done.
Signed-off-by: xigang <wangxigang2014@gmail.com>
75edc17 to
01a69b6
Compare
|
/lgtm |
|
LGTM label has been added. Git tree hash: a1d7eb94532407297f311fd8551174a7516d27a3
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, xigang 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 |
|
Thanks @liggitt |
What type of PR is this?
/kind bug
What this PR does / why we need it:
The namespace GroupKind was incorrectly constructed using the Resourcequota v1 API group. Fix it to use the core API group (corev1.GroupName) instead.
This ensures namespace creation is properly excluded from quota admission evaluation, as namespace resources themselves should not be subject to ResourceQuota constraints.
Which issue(s) this PR is related to:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: