Skip to content
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

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config/components/webhook/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ resources:

configurations:
- kustomizeconfig.yaml

patches:
- path: patches/mutating-patch.yaml
target:
group: admissionregistration.k8s.io
version: v1
kind: MutatingWebhookConfiguration
name: mutating-webhook-configuration
- path: patches/validating-patch.yaml
target:
group: admissionregistration.k8s.io
version: v1
kind: ValidatingWebhookConfiguration
name: validating-webhook-configuration
26 changes: 26 additions & 0 deletions config/components/webhook/patches/mutating-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- op: replace
path: /webhooks/1
value:
admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate--v1-pod
failurePolicy: Fail
name: mpod.kb.io
objectSelector:
matchExpressions:
- key: jobset.sigs.k8s.io/jobset-name
operator: Exists
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
sideEffects: None
26 changes: 26 additions & 0 deletions config/components/webhook/patches/validating-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- op: replace
path: /webhooks/1
value:
admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate--v1-pod
failurePolicy: Fail
name: vpod.kb.io
objectSelector:
matchExpressions:
- key: jobset.sigs.k8s.io/jobset-name
operator: Exists
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
sideEffects: None