mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 02:18:15 +00:00
chore: run range operators test with chainsaw (#8956)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
31c089bcc6
commit
4dbd71459a
7 changed files with 76 additions and 3 deletions
6
.github/workflows/conformance.yaml
vendored
6
.github/workflows/conformance.yaml
vendored
|
@ -178,6 +178,7 @@ jobs:
|
|||
version: v1.28.0
|
||||
tests:
|
||||
# - autogen
|
||||
- background-only
|
||||
# - cleanup
|
||||
# - deferred
|
||||
# - events
|
||||
|
@ -188,14 +189,13 @@ jobs:
|
|||
# - generate/validation
|
||||
# - mutate
|
||||
# - policy-validation
|
||||
# - rangeoperators
|
||||
- rangeoperators
|
||||
- rbac
|
||||
# - reports
|
||||
# - validate
|
||||
# - verify-manifests
|
||||
# - verifyImages
|
||||
- webhooks
|
||||
- background-only
|
||||
- rbac
|
||||
needs: prepare-images
|
||||
name: chainsaw - ${{ matrix.k8s-version.name }} - ${{ matrix.config.name }} - ${{ matrix.tests }}
|
||||
steps:
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: chainsaw.kyverno.io/v1alpha1
|
||||
kind: TestStep
|
||||
metadata:
|
||||
name: policy
|
||||
spec:
|
||||
try:
|
||||
- apply:
|
||||
file: policy.yaml
|
||||
- assert:
|
||||
file: policy-assert.yaml
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: chainsaw.kyverno.io/v1alpha1
|
||||
kind: TestStep
|
||||
metadata:
|
||||
name: resource
|
||||
spec:
|
||||
try:
|
||||
- apply:
|
||||
file: resource.yaml
|
||||
check:
|
||||
(error == null): false
|
11
test/conformance/chainsaw/rangeoperators/standard/README.md
Normal file
11
test/conformance/chainsaw/rangeoperators/standard/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
## Description
|
||||
|
||||
This test creates a policy with range operators and a configmap. It uses ranges with negative and (un)signed positive integer endpoints.
|
||||
|
||||
## Expected Behavior
|
||||
|
||||
It ensures that a configmap with values not in a range are not created.
|
||||
|
||||
## Reference Issue(s)
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: check-value
|
||||
status:
|
||||
conditions:
|
||||
- reason: Succeeded
|
||||
status: "True"
|
||||
type: Ready
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: check-value
|
||||
spec:
|
||||
validationFailureAction: Enforce
|
||||
rules:
|
||||
- name: check-value
|
||||
match:
|
||||
any:
|
||||
- resources:
|
||||
kinds:
|
||||
- ConfigMap
|
||||
validate:
|
||||
message: "All data values must be in the specified range."
|
||||
pattern:
|
||||
data:
|
||||
first_value: "+2-+4"
|
||||
second_value: "-2-5"
|
||||
third_value: "100Mi!-1024Mi"
|
||||
fourth_value: "2.5-3.5"
|
||||
fifth_value: "-10--8"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: test-config
|
||||
data:
|
||||
first_value: "3"
|
||||
second_value: "4"
|
||||
third_value: "98Mi"
|
||||
fourth_value: "2.7"
|
||||
fifth_value: "-15"
|
Loading…
Add table
Reference in a new issue