1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 01:16:55 +00:00
kyverno/samples/best_practices/add_safe_to_evict.yaml

39 lines
1 KiB
YAML
Raw Normal View History

2019-11-04 17:55:13 -08:00
apiVersion: "kyverno.io/v1alpha1"
kind: "ClusterPolicy"
metadata:
2019-11-08 19:02:49 -08:00
name: "add-safe-to-evict"
2019-11-04 17:55:13 -08:00
annotations:
policies.kyverno.io/category: AutoScaling
2019-11-05 12:28:44 -08:00
policies.kyverno.io/description: The Kubernetes cluster autoscaler does not evict pods that
2019-11-05 16:45:37 -08:00
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.
2019-11-04 17:55:13 -08:00
spec:
rules:
2019-11-08 19:02:49 -08:00
- name: "annotate-empty-dir"
2019-11-04 17:55:13 -08:00
match:
resources:
kinds:
- "Pod"
mutate:
overlay:
metadata:
annotations:
+(cluster-autoscaler.kubernetes.io/safe-to-evict): true
spec:
volumes:
2019-11-05 12:28:44 -08:00
- (emptyDir): {}
2019-11-08 19:02:49 -08:00
- name: "annotate-host-path"
2019-11-05 12:28:44 -08:00
match:
resources:
kinds:
- "Pod"
mutate:
overlay:
metadata:
annotations:
+(cluster-autoscaler.kubernetes.io/safe-to-evict): true
spec:
volumes:
- (hostPath):
2019-11-05 12:59:22 -08:00
path: "*"