-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add patches for Kustomize to add objectSelectors to pod webhook configurations #362
Add patches for Kustomize to add objectSelectors to pod webhook configurations #362
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danielvegamyhre 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 |
@@ -0,0 +1,26 @@ | |||
- op: replace |
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.
does this override the the configuration for the jobset webhooks? the one named "mutate-jobset-x-k8s-io-v1alpha2-jobset"?
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.
Nope, just the mutating webhook configuration at index 1 in the mutating-webhook-configuration webhooks
array, which is the pod mutating webhook:
jobset/config/components/webhook/manifests.yaml
Lines 27 to 44 in dbabc65
- admissionReviewVersions: | |
- v1 | |
clientConfig: | |
service: | |
name: webhook-service | |
namespace: system | |
path: /mutate--v1-pod | |
failurePolicy: Fail | |
name: mpod.kb.io | |
rules: | |
- apiGroups: | |
- "" | |
apiVersions: | |
- v1 | |
operations: | |
- CREATE | |
resources: | |
- pods |
Same goes for the validating-webhook-configuration patch.
Thanks @danielvegamyhre; we should create a minor release with this important fix. /lgtm |
/lgtm lift the hold once you feel comfortable merging |
Ok I manually tested these changes by installing JobSet on a live cluster which has nodes with insufficient CPU resources to run the controller manager deployment pod, meaning the webhook configuration objects are installed on the cluster, but the deployment pod is unschedulable / in a pending state. This effectively reproduces the scenario in #361 and the expected behavior is that other pods in the cluster are NOT blocked from being created, since Jobset's pod webhook should not be selecting those pods. To test this, I deployed a random Job and the job pods were created successfully. |
/hold cancel |
…-#362-upstream-release-0.3 Automated cherry pick of #362: add webhook patches
Fixes #361
Note I originally tried using the
add
JSON Patch op type to simply add objectSelector field into the existing webhook manifests, but it seems to add the objectSelector as a new element in thewebhooks
array, rather than adding the field to the element at index 1 in the array.instead of:
The only way I could get it to work was by completely replacing it. This isn't ideal since manifest changes done via kubebuilder markers in the Go code will just get replaced, so we'd need to update the patch every time we update the markers. However, I don't anticipate us needing to update that marker frequently (or ever, really).
References: