Last active
June 21, 2023 15:53
-
-
Save hustshawn/525745c5ce99d55111d7b64b6197a581 to your computer and use it in GitHub Desktop.
A Kyverno policy to mutate any daemonset to avoid trying to deploy to Fargate instances.
This file contains 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: add-daemonset-fargate-anti-affinity | |
spec: | |
validationFailureAction: Enforce | |
background: false | |
rules: | |
- name: add-node-anti-affinity | |
match: | |
resources: | |
kinds: | |
- DaemonSet | |
mutate: | |
patchStrategicMerge: | |
spec: | |
template: | |
spec: | |
affinity: | |
nodeAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
nodeSelectorTerms: | |
- matchExpressions: | |
- key: eks.amazonaws.com/compute-type | |
operator: NotIn | |
values: | |
- fargate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment