mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
temp update for debugging
This commit is contained in:
parent
bdb677abf6
commit
5ded29f74e
3 changed files with 29 additions and 5 deletions
|
@ -3,6 +3,7 @@ package testrunner
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
ospath "path"
|
ospath "path"
|
||||||
|
@ -442,6 +443,9 @@ func loadPolicy(t *testing.T, path string) *kyverno.ClusterPolicy {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testScenario(t *testing.T, path string) {
|
func testScenario(t *testing.T, path string) {
|
||||||
|
flag.Set("logtostderr", "true")
|
||||||
|
flag.Set("v", "8")
|
||||||
|
|
||||||
scenario, err := loadScenario(t, path)
|
scenario, err := loadScenario(t, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
|
|
@ -4,10 +4,12 @@ metadata:
|
||||||
name: "annotate-emptyDir"
|
name: "annotate-emptyDir"
|
||||||
annotations:
|
annotations:
|
||||||
policies.kyverno.io/category: AutoScaling
|
policies.kyverno.io/category: AutoScaling
|
||||||
policies.kyverno.io/description:
|
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.
|
||||||
spec:
|
spec:
|
||||||
rules:
|
rules:
|
||||||
- name: "add-safe-to-evict-annotation"
|
- name: "empty-dir-add-safe-to-evict"
|
||||||
match:
|
match:
|
||||||
resources:
|
resources:
|
||||||
kinds:
|
kinds:
|
||||||
|
@ -19,4 +21,18 @@ spec:
|
||||||
+(cluster-autoscaler.kubernetes.io/safe-to-evict): true
|
+(cluster-autoscaler.kubernetes.io/safe-to-evict): true
|
||||||
spec:
|
spec:
|
||||||
volumes:
|
volumes:
|
||||||
- (emptyDir): {}
|
- (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: "*"
|
||||||
|
|
|
@ -13,7 +13,11 @@ expected:
|
||||||
namespace: ''
|
namespace: ''
|
||||||
name: pod-with-emptydir
|
name: pod-with-emptydir
|
||||||
rules:
|
rules:
|
||||||
- name: add-safe-to-evict-annotation
|
- name: empty-dir-add-safe-to-evict
|
||||||
type: Mutation
|
type: Mutation
|
||||||
success: true
|
success: true
|
||||||
message: "successfully processed overlay"
|
message: "successfully processed overlay"
|
||||||
|
- name: host-path-add-safe-to-evict
|
||||||
|
type: Mutation
|
||||||
|
success: false
|
||||||
|
message: "successfully processed overlay"
|
Loading…
Add table
Reference in a new issue