mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
update the project name in api version and test
This commit is contained in:
parent
02d17f7d84
commit
857aa81f3e
21 changed files with 22 additions and 22 deletions
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-cpu-memory
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-host-path
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: image-pull-policy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-host-path
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-probe-exists
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-probe-intervals
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-whitelist-registries
|
||||
|
|
|
@ -358,7 +358,7 @@ func TestValidateMapElement_OneElementInArrayNotPass(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestValidate_ServiceTest(t *testing.T) {
|
||||
rawPolicy := []byte(`{ "apiVersion": "kubepolicy.nirmata.io/v1alpha1", "kind": "Policy", "metadata": { "name": "policy-service" }, "spec": { "rules": [ { "name": "ps1", "resource": { "kind": "Service", "name": "game-service*" }, "mutate": { "patches": [ { "path": "/metadata/labels/isMutated", "op": "add", "value": "true" }, { "path": "/metadata/labels/secretLabel", "op": "replace", "value": "weKnow" }, { "path": "/metadata/labels/originalLabel", "op": "remove" }, { "path": "/spec/selector/app", "op": "replace", "value": "mutedApp" } ] }, "validate": { "message": "This resource is broken", "pattern": { "spec": { "ports": [ { "name": "hs", "protocol": 32 } ] } } } } ] } }`)
|
||||
rawPolicy := []byte(`{ "apiVersion": "kyverno.nirmata.io/v1alpha1", "kind": "Policy", "metadata": { "name": "policy-service" }, "spec": { "rules": [ { "name": "ps1", "resource": { "kind": "Service", "name": "game-service*" }, "mutate": { "patches": [ { "path": "/metadata/labels/isMutated", "op": "add", "value": "true" }, { "path": "/metadata/labels/secretLabel", "op": "replace", "value": "weKnow" }, { "path": "/metadata/labels/originalLabel", "op": "remove" }, { "path": "/spec/selector/app", "op": "replace", "value": "mutedApp" } ] }, "validate": { "message": "This resource is broken", "pattern": { "spec": { "ports": [ { "name": "hs", "protocol": 32 } ] } } } } ] } }`)
|
||||
rawResource := []byte(`{ "kind": "Service", "apiVersion": "v1", "metadata": { "name": "game-service", "labels": { "originalLabel": "isHere", "secretLabel": "thisIsMySecret" } }, "spec": { "selector": { "app": "MyApp" }, "ports": [ { "name": "http", "protocol": "TCP", "port": 80, "targetPort": 9376 } ] } }`)
|
||||
|
||||
var policy kubepolicy.Policy
|
||||
|
@ -372,7 +372,7 @@ func TestValidate_ServiceTest(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestValidate_MapHasFloats(t *testing.T) {
|
||||
rawPolicy := []byte(`{ "apiVersion": "kubepolicy.nirmata.io/v1alpha1", "kind": "Policy", "metadata": { "name": "policy-deployment-changed" }, "spec": { "rules": [ { "name": "First policy v2", "resource": { "kind": "Deployment", "name": "nginx-*" }, "mutate": { "patches": [ { "path": "/metadata/labels/isMutated", "op": "add", "value": "true" }, { "path": "/metadata/labels/app", "op": "replace", "value": "nginx_is_mutated" } ] }, "validate": { "message": "replicas number is wrong", "pattern": { "metadata": { "labels": { "app": "*" } }, "spec": { "replicas": 3 } } } } ] } }`)
|
||||
rawPolicy := []byte(`{ "apiVersion": "kyverno.nirmata.io/v1alpha1", "kind": "Policy", "metadata": { "name": "policy-deployment-changed" }, "spec": { "rules": [ { "name": "First policy v2", "resource": { "kind": "Deployment", "name": "nginx-*" }, "mutate": { "patches": [ { "path": "/metadata/labels/isMutated", "op": "add", "value": "true" }, { "path": "/metadata/labels/app", "op": "replace", "value": "nginx_is_mutated" } ] }, "validate": { "message": "replicas number is wrong", "pattern": { "metadata": { "labels": { "app": "*" } }, "spec": { "replicas": 3 } } } } ] } }`)
|
||||
rawResource := []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "nginx-deployment", "labels": { "app": "nginx" } }, "spec": { "replicas": 3, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "labels": { "app": "nginx" } }, "spec": { "containers": [ { "name": "nginx", "image": "nginx:1.7.9", "ports": [ { "containerPort": 80 } ] } ] } } } }`)
|
||||
|
||||
var policy kubepolicy.Policy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata :
|
||||
name : policy-ingress
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-job-perl-bigint
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind : Policy
|
||||
metadata :
|
||||
name : policy-limitrange
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata :
|
||||
name : policy-namespace
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-network-policy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-pvc
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-pdb
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: test-podtemplate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind : Policy
|
||||
metadata :
|
||||
name : policy-quota-low-test-validation
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind : Policy
|
||||
metadata :
|
||||
name : policy-quota-low-test
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-secrets
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion : kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion : kyverno.nirmata.io/v1alpha1
|
||||
kind : Policy
|
||||
metadata :
|
||||
name : policy-service
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: kubepolicy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.nirmata.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-statefulset
|
||||
|
|
Loading…
Add table
Reference in a new issue