Skip to content

Instantly share code, notes, and snippets.

@karlkfi
Created August 15, 2024 22:55
Show Gist options
  • Save karlkfi/5ae3103cdb08721fde74c987645df65e to your computer and use it in GitHub Desktop.
Save karlkfi/5ae3103cdb08721fde74c987645df65e to your computer and use it in GitHub Desktop.
Use Gatekeeper mutating webhooks to auto-assign Pods from a namespace to a specific node pool
apiVersion: mutations.gatekeeper.sh/v1
kind: Assign
metadata:
name: kube-system-node-selector
spec:
applyTo:
- groups: [""]
kinds: ["Pod"]
versions: ["v1"]
match:
scope: "Namespaced"
namespaces: ["a-team"]
location: 'spec.nodeSelector.team'
parameters:
assign:
value: "a-team"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment