1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 00:17:13 +00:00
kyverno/samples/best_practices/add_safe-to-evict_annotation.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:
name: "annotate-emptyDir"
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
use hostPath or emptyDir volumes. To allow eviction the annotation
cluster-autoscaler.kubernetes.io/safe-to-evict=true is added to the pod.
2019-11-04 17:55:13 -08:00
spec:
rules:
2019-11-05 12:28:44 -08:00
- name: "empty-dir-add-safe-to-evict"
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): {}
- name: "host-path-add-safe-to-evict"
match:
resources:
kinds:
- "Pod"
mutate:
overlay:
metadata:
annotations:
+(cluster-autoscaler.kubernetes.io/safe-to-evict): true
spec:
volumes:
- (hostPath):
path: "*"