Skip to content

Commit f7d3815

Browse files
committed
fix(charts): fix kyverno empty namespace error when syncronizing copy-host-secret-artifact-s3 policy
1 parent 518e8db commit f7d3815

File tree

2 files changed

+66
-4
lines changed

2 files changed

+66
-4
lines changed

charts/workflows/templates/sessionspace-clusterpolicy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ spec:
127127
apiVersions: ["v1"]
128128
operations: ["CREATE"]
129129
resources: ["namespaces"]
130-
namespaceSelector:
130+
objectSelector:
131131
matchLabels:
132132
app.kubernetes.io/managed-by: sessionspaces
133133
variables:

charts/workflows/test-policy/artifact-s3-clone/chainsaw-test.yaml

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
apiVersion: chainsaw.kyverno.io/v1alpha1
22
kind: Test
33
metadata:
4-
name: artifact-s3-clone
4+
name: artifact-s3-clone-on-namespace-creation
55
spec:
6+
concurrent: false
67
steps:
78
- try:
89
- apply:
@@ -29,12 +30,73 @@ spec:
2930
name: session
3031
labels:
3132
app.kubernetes.io/managed-by: sessionspaces
32-
- sleep:
33-
duration: 10s
3433
- assert:
3534
resource:
3635
apiVersion: v1
3736
kind: Secret
3837
metadata:
3938
name: artifact-s3
4039
namespace: session
40+
---
41+
apiVersion: chainsaw.kyverno.io/v1alpha1
42+
kind: Test
43+
metadata:
44+
name: artifact-s3-clone-on-secret-update
45+
spec:
46+
concurrent: false
47+
steps:
48+
- try:
49+
- apply:
50+
resource:
51+
apiVersion: v1
52+
kind: Namespace
53+
metadata:
54+
name: workflows
55+
- apply:
56+
resource:
57+
apiVersion: v1
58+
kind: Secret
59+
metadata:
60+
name: artifact-s3
61+
namespace: workflows
62+
data:
63+
access-key: aWQ=
64+
secret-key: c2VjcmV0
65+
- apply:
66+
resource:
67+
apiVersion: v1
68+
kind: Namespace
69+
metadata:
70+
name: session
71+
labels:
72+
app.kubernetes.io/managed-by: sessionspaces
73+
- assert:
74+
resource:
75+
apiVersion: v1
76+
kind: Secret
77+
metadata:
78+
name: artifact-s3
79+
namespace: session
80+
data:
81+
access-key: aWQ=
82+
secret-key: c2VjcmV0
83+
- apply:
84+
resource:
85+
apiVersion: v1
86+
kind: Secret
87+
metadata:
88+
name: artifact-s3
89+
namespace: workflows
90+
data:
91+
access-key: aWQ=
92+
secret-key: dXBkYXRlZC1zZWNyZXQK
93+
- assert:
94+
resource:
95+
apiVersion: v1
96+
kind: Secret
97+
metadata:
98+
name: artifact-s3
99+
namespace: session
100+
data:
101+
access-key: aWQ=
102+
secret-key: dXBkYXRlZC1zZWNyZXQK

0 commit comments

Comments
 (0)