-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: add webhook labels flag to add labels in VPA admission controller webhook #7402
Conversation
Welcome @umagnus! |
Hi @umagnus. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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 |
Could you also update the documentation? |
0679643
to
ce80e4b
Compare
vertical-pod-autoscaler/pkg/admission-controller/config_test.go
Outdated
Show resolved
Hide resolved
I'm not sure how useful it is, but what about a test for |
The "Does this PR introduce a user-facing change?" section of the description should be filled in |
Previous I use |
I don't think "action required" is true, since this change is backwards compatible. If a user upgrades they can ignore the flag and it shouldn't change their experience. |
Sure, remove it |
4eef11b
to
8d2ae78
Compare
/lgtm |
Hey @umagnus, thanks for the PR! Just to clarify: you actually need VPA to modify Pods in I'm asking, because we recently introduced a feature to ignore namespaces (other manages k8s distributions like GKE were also not happy with the VPA applying to Pods in |
Yes, I want to use VPA to modify Pods in |
Hi, @adrianmoisey Could you please approve it? Thanks! |
I can't approve, I can only /lgtm. |
Hi, @voelzmo Could you please approve it? Thank you! |
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 for the PR, just small clarification regarding logging and error behavior.
@@ -141,9 +141,15 @@ func selfRegistration(clientset kubernetes.Interface, caCert []byte, webHookDela | |||
}, | |||
} | |||
} | |||
webhookLabelsMap, err := convertLabelsToMap(webHookLabels) | |||
if err != nil { | |||
klog.Warningf("Unable to parse webhook labels. Creating webhook without labels: %v\n", err) |
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.
We're switching to structured logging currently (see #7226 for the admission-controller PR), therefore I'd like this to follow the same pattern. As warnings don't exist in structured logging, this probably should be logged with klog.ErrorS
?
I'm also wondering if we should continue with the selfRegistration here or not? Currently this error just goes into the logs and everything still get registered – is this intentional?
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 change it to klog.ErrorS
. I think use labels is an option but not necessary, so when cx use invalid labels format, selfRegistration will continue and just print a error log.
webhookConfigInterface := testClientSet.AdmissionregistrationV1().MutatingWebhookConfigurations() | ||
webhookConfig, err := webhookConfigInterface.Get(context.TODO(), webhookConfigName, metav1.GetOptions{}) | ||
|
||
assert.NoError(t, err, "expected invalid labels error fetching webhook configuration") |
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'm not sure what this assertion is supposed to do. Currently, it asserts that no error is returned, but the message sounds like it should assert that there will be an error returned. What should be the expected behavior? See also my comment above about this.
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 webhook labels format error is an option but not necessary, so it don't need to let webhook register failed. It just need to print an error message in log and use empty labels in registering.
8d2ae78
to
e71f1c4
Compare
Thanks for the PR! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: umagnus, voelzmo 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 type of PR is this?
/kind feature
What this PR does / why we need it:
feat: add webhook labels flag to add labels in VPA admission controller webhook
In AKS, VPA can't admit pods in kube-system namespace. Reference to Can admission controller webhooks impact kube-system and internal AKS namespaces?, VPA can add Label: "admissions.enforcer/disabled": "true" in admission controller webhook to impact kube-system namespace. Add a flag to add webhook labels.
Which issue(s) this PR fixes:
Fixes ##7392
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: