Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Created September 14, 2025 20:19
Show Gist options
  • Save larkintuckerllc/fb7e4578a508d64bb4c5c45d70f83ff6 to your computer and use it in GitHub Desktop.
Save larkintuckerllc/fb7e4578a508d64bb4c5c45d70f83ff6 to your computer and use it in GitHub Desktop.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: nodepool-selector
annotations:
pod-policies.kyverno.io/autogen-controllers: none
spec:
rules:
- name: nodepool-selector
match:
any:
- resources:
annotations:
example.com/nodepool: "*"
kinds:
- Pod
namespaceSelector:
matchLabels:
example.com/match: "true"
exclude:
any:
- resources:
annotations:
example.com/nodepool-selector: "true"
mutate:
patchStrategicMerge:
metadata:
annotations:
+(example.com/nodepool-selector): "true"
spec:
tolerations:
- key: example.com/nodepool
operator: Equal
value: '{{ request.object.metadata.annotations."example.com/nodepool" }}'
effect: NoSchedule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment