mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
a0ff8bbd0b
* implement global anchor for patch strategic merge
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* fixed unit tests for mutation global anchor
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* added global anchor in validation
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* fix some global anchor issues found during testing
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* run go tidy
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* fixed tests
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* fixed some tests
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* finish implementing global anchor
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* WIP: lower global anchor strictness
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* Revert "WIP: lower global anchor strictness"
This reverts commit 08e176a042
.
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* global anchor for mutation
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: add-safe-to-evict
|
|
annotations:
|
|
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.
|
|
spec:
|
|
rules:
|
|
- name: annotate-empty-dir
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
mutate:
|
|
patchStrategicMerge:
|
|
metadata:
|
|
annotations:
|
|
+(cluster-autoscaler.kubernetes.io/safe-to-evict): "true"
|
|
spec:
|
|
volumes:
|
|
- <(emptyDir): {}
|
|
- name: annotate-host-path
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
mutate:
|
|
patchStrategicMerge:
|
|
metadata:
|
|
annotations:
|
|
+(cluster-autoscaler.kubernetes.io/safe-to-evict): "true"
|
|
spec:
|
|
volumes:
|
|
- hostPath:
|
|
<(path): "*"
|