Created
September 16, 2025 01:07
-
-
Save larkintuckerllc/2dc1702d65dcdc06085c69ff741cd0ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: kyverno.io/v1 | |
| kind: ClusterPolicy | |
| metadata: | |
| name: nodepool-selector-tolerations | |
| annotations: | |
| pod-policies.kyverno.io/autogen-controllers: none | |
| spec: | |
| rules: | |
| - name: nodepool-selector-tolerations | |
| match: | |
| any: | |
| - resources: | |
| annotations: | |
| example.com/nodepool: "*" | |
| kinds: | |
| - Pod | |
| namespaceSelector: | |
| matchLabels: | |
| example.com/match: "true" | |
| operations: | |
| - CREATE | |
| exclude: | |
| any: | |
| - resources: | |
| annotations: | |
| example.com/nodepool-selector-tolerations: "true" | |
| preconditions: | |
| any: | |
| - key: example.com/nodepool | |
| operator: AnyNotIn | |
| value: "{{ request.object.spec.tolerations[].key || [] }}" | |
| mutate: | |
| patchesJson6902: |- | |
| - op: add | |
| path: "/metadata/annotations/example.com~1nodepool-selector-tolerations" | |
| value: "true" | |
| - op: add | |
| path: "/spec/tolerations/-" | |
| value: | |
| 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