mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
test yamls
This commit is contained in:
parent
c8179a182d
commit
188c3c9ef2
2 changed files with 47 additions and 2 deletions
|
@ -3,7 +3,7 @@ kind: PolicyViolation
|
|||
metadata:
|
||||
name: pv1
|
||||
spec:
|
||||
policyName: check-cpu-memory
|
||||
policy: check-cpu-memory
|
||||
resource:
|
||||
kind: Pod
|
||||
namespace: ""
|
||||
|
@ -12,4 +12,21 @@ spec:
|
|||
- name: r1
|
||||
type: Mutation
|
||||
status: Failed
|
||||
message: test mesaage for rule failure
|
||||
message: test mesaage for rule failure
|
||||
---
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
kind: PolicyViolation
|
||||
metadata:
|
||||
name: pv2
|
||||
spec:
|
||||
policy: check-cpu-memory
|
||||
resource:
|
||||
kind: Pod
|
||||
namespace: ""
|
||||
name: pod1
|
||||
rules:
|
||||
- name: r1
|
||||
type: Mutation
|
||||
status: Failed
|
||||
message: test mesaage for rule failure
|
||||
---
|
28
examples/test/p1.yaml
Normal file
28
examples/test/p1.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
apiVersion: kyverno.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-resources
|
||||
spec:
|
||||
validationFailureAction: "audit"
|
||||
rules:
|
||||
- name: check-pod-resources
|
||||
match:
|
||||
resources:
|
||||
kinds:
|
||||
- Pod
|
||||
validate:
|
||||
message: "CPU and memory resource requests and limits are required"
|
||||
pattern:
|
||||
spec:
|
||||
containers:
|
||||
# 'name: *' selects all containers in the pod
|
||||
- name: "*"
|
||||
resources:
|
||||
requests:
|
||||
# '?' requires 1 alphanumeric character and '*' means that there can be 0 or more characters.
|
||||
# Using them together e.g. '?*' requires at least one character.
|
||||
memory: "?*"
|
||||
cpu: "?*"
|
||||
limits:
|
||||
memory: "?*"
|
||||
cpu: "?*"
|
Loading…
Add table
Reference in a new issue