mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 10:28:36 +00:00
add kuttl test pol-clone-sync-modify-source (#6407)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
parent
b6baa655cb
commit
ccfcce83da
7 changed files with 88 additions and 0 deletions
|
@ -0,0 +1,10 @@
|
|||
apiVersion: kyverno.io/v2beta1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: pol-sync-clone
|
||||
namespace: poltest
|
||||
status:
|
||||
conditions:
|
||||
- reason: Succeeded
|
||||
status: "True"
|
||||
type: Ready
|
|
@ -0,0 +1,36 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: poltest
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: YmFy
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: regcred
|
||||
namespace: poltest
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: kyverno.io/v2beta1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: pol-sync-clone
|
||||
namespace: poltest
|
||||
spec:
|
||||
rules:
|
||||
- name: gen-zk
|
||||
match:
|
||||
any:
|
||||
- resources:
|
||||
kinds:
|
||||
- ConfigMap
|
||||
generate:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
name: myclonedsecret
|
||||
namespace: poltest
|
||||
synchronize: true
|
||||
clone:
|
||||
namespace: poltest
|
||||
name: regcred
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
data:
|
||||
sj: js
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: cm-2
|
||||
namespace: poltest
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: v1
|
||||
data:
|
||||
foo: YmFy
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: myclonedsecret
|
||||
namespace: poltest
|
||||
type: Opaque
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: v1
|
||||
data:
|
||||
foo: aGVyZWlzY2hhbmdlZGRhdGE=
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: regcred
|
||||
namespace: poltest
|
||||
type: Opaque
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: v1
|
||||
data:
|
||||
foo: aGVyZWlzY2hhbmdlZGRhdGE=
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: myclonedsecret
|
||||
namespace: poltest
|
||||
type: Opaque
|
|
@ -0,0 +1,11 @@
|
|||
## Description
|
||||
|
||||
This test ensures that modification of the source (upstream) resource used by a Policy `generate` rule with sync enabled using a clone declaration causes those changes to be synced/propagated downstream.
|
||||
|
||||
## Expected Behavior
|
||||
|
||||
After the source is modified, the downstream resources should be synced to reflect those modifications. If the downstream resource reflects the changes made to the source, the test passes. If the downstream resource remains unsynced, the test fails.
|
||||
|
||||
## Reference Issue(s)
|
||||
|
||||
https://github.com/kyverno/kyverno/issues/5277
|
Loading…
Add table
Reference in a new issue