1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 15:37:19 +00:00
kyverno/test/best_practices/add_safe_to_evict.yaml

46 lines
1.1 KiB
YAML
Raw Normal View History

---
2019-12-10 09:51:15 -08:00
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
2019-11-04 17:55:13 -08:00
annotations:
2019-11-11 18:21:16 -08:00
policies.kyverno.io/category: Workload Management
policies.kyverno.io/description: The Kubernetes cluster autoscaler does not evict
pods that use hostPath or emptyDir volumes. To allow eviction of these pods,
the annotation cluster-autoscaler.kubernetes.io/safe-to-evict=true must be added
to the pods.
name: add-safe-to-evict
spec:
admission: true
background: true
rules:
- match:
any:
- resources:
kinds:
- Pod
mutate:
patchStrategicMerge:
2019-11-04 17:55:13 -08:00
metadata:
annotations:
+(cluster-autoscaler.kubernetes.io/safe-to-evict): "true"
spec:
volumes:
- <(emptyDir): {}
name: annotate-empty-dir
- match:
any:
- resources:
kinds:
- Pod
mutate:
patchStrategicMerge:
2019-11-05 12:28:44 -08:00
metadata:
annotations:
+(cluster-autoscaler.kubernetes.io/safe-to-evict): "true"
spec:
volumes:
- hostPath:
<(path): '*'
name: annotate-host-path
validationFailureAction: Audit