1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

rename add_safe_to_evict

This commit is contained in:
Jim Bugwadia 2019-11-08 19:02:49 -08:00
parent 687c0c6470
commit 6baa678e27
5 changed files with 20 additions and 15 deletions

View file

@ -123,12 +123,12 @@ func Test_validate_disallow_helm_tiller(t *testing.T) {
testScenario(t, "test/scenarios/samples/best_practices/scenario_validate_disallow_helm_tiller.yaml")
}
func Test_add_safe_to_evict_annotation(t *testing.T) {
testScenario(t, "test/scenarios/samples/best_practices/scenario_mutate_safe-to-evict.yaml")
func Test_add_safe_to_evict(t *testing.T) {
testScenario(t, "test/scenarios/samples/best_practices/add_safe_to_evict.yaml")
}
func Test_add_safe_to_evict_annotation2(t *testing.T) {
testScenario(t, "test/scenarios/samples/best_practices/scenario_mutate_safe-to-evict2.yaml")
testScenario(t, "test/scenarios/samples/best_practices/add_safe_to_evict2.yaml")
}
func Test_known_ingress(t *testing.T) {

View file

@ -16,10 +16,15 @@ This policy matches and mutates pods with `emptyDir` and `hostPath` volumes, to
apiVersion: "kyverno.io/v1alpha1"
kind: "ClusterPolicy"
metadata:
name: "annotate-emptydir-hostpath"
name: "add-safe-to-evict"
annotations:
policies.kyverno.io/category: AutoScaling
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: "empty-dir-add-safe-to-evict"
- name: "annotate-empty-dir"
match:
resources:
kinds:
@ -32,7 +37,7 @@ spec:
spec:
volumes:
- (emptyDir): {}
- name: "host-path-add-safe-to-evict"
- name: "annotate-host-path"
match:
resources:
kinds:

View file

@ -1,7 +1,7 @@
apiVersion: "kyverno.io/v1alpha1"
kind: "ClusterPolicy"
metadata:
name: "annotate-emptydir-hostpath"
name: "add-safe-to-evict"
annotations:
policies.kyverno.io/category: AutoScaling
policies.kyverno.io/description: The Kubernetes cluster autoscaler does not evict pods that
@ -9,7 +9,7 @@ metadata:
cluster-autoscaler.kubernetes.io/safe-to-evict=true must be added to the pods.
spec:
rules:
- name: "empty-dir-add-safe-to-evict"
- name: "annotate-empty-dir"
match:
resources:
kinds:
@ -22,7 +22,7 @@ spec:
spec:
volumes:
- (emptyDir): {}
- name: "host-path-add-safe-to-evict"
- name: "annotate-host-path"
match:
resources:
kinds:

View file

@ -1,19 +1,19 @@
# file path is relative to project root
input:
policy: samples/best_practices/add_safe-to-evict_annotation.yaml
policy: samples/best_practices/add_safe_to_evict.yaml
resource: test/resources/pod-with-emptydir.yaml
expected:
mutation:
patchedresource: test/output/pod-with-emptydir.yaml
policyresponse:
policy: annotate-emptydir-hostpath
policy: add-safe-to-evict
resource:
kind: Pod
apiVersion: v1
namespace: ''
name: pod-with-emptydir
rules:
- name: empty-dir-add-safe-to-evict
- name: annotate-empty-dir
type: Mutation
success: true
message: "successfully processed overlay"

View file

@ -1,19 +1,19 @@
# file path is relative to project root
input:
policy: samples/best_practices/add_safe-to-evict_annotation.yaml
policy: samples/best_practices/add_safe_to_evict.yaml
resource: test/resources/pod-with-hostpath.yaml
expected:
mutation:
patchedresource: test/output/pod-with-hostpath.yaml
policyresponse:
policy: annotate-emptydir-hostpath
policy: add-safe-to-evict
resource:
kind: Pod
apiVersion: v1
namespace: ''
name: pod-with-hostpath
rules:
- name: host-path-add-safe-to-evict
- name: annotate-host-path
type: Mutation
success: true
message: "successfully processed overlay"