@@ -6,7 +6,8 @@ metadata:
66spec :
77 description : |
88 Tests that a LocalQueue is created in a namespace labeled with
9- `konflux-ci.dev/type=tenant`.
9+ `konflux-ci.dev/type=tenant` and no `kueue.konflux-ci.dev/stop-policy`
10+ annotation.
1011 concurrent : false
1112 namespace : kueue-queue-new
1213 bindings :
@@ -51,6 +52,241 @@ spec:
5152# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
5253apiVersion : chainsaw.kyverno.io/v1alpha1
5354kind : Test
55+ metadata :
56+ name : kueue-bootstrap-queue-new-tenant-labeled-namespace-unpaused
57+ spec :
58+ description : |
59+ Tests that a LocalQueue is created in a namespace labeled with
60+ `konflux-ci.dev/type=tenant` and the `kueue.konflux-ci.dev/stop-policy`
61+ annotation set to a value different from `hold`.
62+ concurrent : false
63+ namespace : kueue-queue-new
64+ bindings :
65+ - name : suffix
66+ value : labeled
67+ steps :
68+ - name : given-localqueue-crd-exists
69+ description : |
70+ Install the Kueue LocalQueue CRD so the API server accepts LocalQueue objects in the test cluster.
71+ try :
72+ - apply :
73+ file : ./resources/localqueue-crd.yaml
74+ - name : given-kyverno-has-permission-on-resources
75+ description : |
76+ Apply Kyverno RBAC so the policy engine can generate and reconcile LocalQueue resources.
77+ try :
78+ - apply :
79+ file : ../kyverno-rbac.yaml
80+ - name : given-cluster-policy-is-ready
81+ description : |
82+ Apply the queue bootstrap ClusterPolicy and assert Kyverno reports the policy as ready before exercising generation.
83+ try :
84+ - apply :
85+ file : ../cluster-policy.yaml
86+ - assert :
87+ file : chainsaw-assert-clusterpolicy.yaml
88+ - name : when-tenant-labeled-namespace-is-created
89+ description : |
90+ Create a namespace labeled konflux-ci.dev/type=tenant so the policy should generate a LocalQueue.
91+ try :
92+ - apply :
93+ file : resources/namespace-tenant-unpaused.yaml
94+ template : true
95+ - name : then-localqueue-is-created
96+ description : |
97+ Assert the expected pipelines-queue LocalQueue exists and matches the fixture (name and spec).
98+ try :
99+ - assert :
100+ file : resources/expected-localqueue.yaml
101+ template : true
102+ ---
103+ # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
104+ apiVersion : chainsaw.kyverno.io/v1alpha1
105+ kind : Test
106+ metadata :
107+ name : kueue-bootstrap-queue-new-tenant-labeled-paused-namespace-resumed
108+ spec :
109+ description : |
110+ Tests that a LocalQueue with `stopPolicy` set to `Hold` is created
111+ in a namespace labeled with `konflux-ci.dev/type=tenant` with the
112+ `kueue.konflux-ci.dev/stop-policy` annotation set to `hold`. The
113+ `stopPolicy` is then set to `None` when the annotation is removed
114+ from the namespace.
115+ concurrent : false
116+ namespace : kueue-queue-new
117+ bindings :
118+ - name : suffix
119+ value : labeled
120+ steps :
121+ - name : given-localqueue-crd-exists
122+ description : |
123+ Install the Kueue LocalQueue CRD so the API server accepts LocalQueue objects in the test cluster.
124+ try :
125+ - apply :
126+ file : ./resources/localqueue-crd.yaml
127+ - name : given-kyverno-has-permission-on-resources
128+ description : |
129+ Apply Kyverno RBAC so the policy engine can generate and reconcile LocalQueue resources.
130+ try :
131+ - apply :
132+ file : ../kyverno-rbac.yaml
133+ - name : given-cluster-policy-is-ready
134+ description : |
135+ Apply the queue bootstrap ClusterPolicy and assert Kyverno reports the policy as ready before exercising generation.
136+ try :
137+ - apply :
138+ file : ../cluster-policy.yaml
139+ - assert :
140+ file : chainsaw-assert-clusterpolicy.yaml
141+ - name : when-tenant-labeled-namespace-is-created-paused
142+ description : |
143+ update a namespace labeled konflux-ci.dev/type=tenant so the policy should generate a LocalQueue.
144+ try :
145+ - apply :
146+ file : resources/namespace-tenant-paused.yaml
147+ template : true
148+ - name : then-localqueue-is-created-paused
149+ description : |
150+ Assert the expected pipelines-queue LocalQueue exists and matches the fixture (name and spec).
151+ try :
152+ - assert :
153+ file : resources/expected-localqueue-paused.yaml
154+ template : true
155+ - name : when-tenant-labeled-namespace-is-updated-to-unpause
156+ description : |
157+ Create a namespace labeled konflux-ci.dev/type=tenant so the policy should generate a LocalQueue.
158+ try :
159+ - apply :
160+ file : resources/namespace-tenant.yaml
161+ template : true
162+ - name : then-localqueue-is-unpaused
163+ description : |
164+ Assert the expected pipelines-queue LocalQueue exists and matches the fixture (name and spec).
165+ try :
166+ - assert :
167+ file : resources/expected-localqueue.yaml
168+ template : true
169+ ---
170+ # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
171+ apiVersion : chainsaw.kyverno.io/v1alpha1
172+ kind : Test
173+ metadata :
174+ name : kueue-bootstrap-queue-new-tenant-labeled-namespace-update-paused
175+ spec :
176+ description : |
177+ Tests that a LocalQueue with `stopPolicy` set to `None` is created
178+ in a namespace labeled with `konflux-ci.dev/type=tenant` with no
179+ `kueue.konflux-ci.dev/stop-policy` annotation set. The `stopPolicy`
180+ is then set to `Hold` when the annotation is added to the namespace.
181+ concurrent : false
182+ namespace : kueue-queue-new
183+ bindings :
184+ - name : suffix
185+ value : labeled
186+ steps :
187+ - name : given-localqueue-crd-exists
188+ description : |
189+ Install the Kueue LocalQueue CRD so the API server accepts LocalQueue objects in the test cluster.
190+ try :
191+ - apply :
192+ file : ./resources/localqueue-crd.yaml
193+ - name : given-kyverno-has-permission-on-resources
194+ description : |
195+ Apply Kyverno RBAC so the policy engine can generate and reconcile LocalQueue resources.
196+ try :
197+ - apply :
198+ file : ../kyverno-rbac.yaml
199+ - name : given-cluster-policy-is-ready
200+ description : |
201+ Apply the queue bootstrap ClusterPolicy and assert Kyverno reports the policy as ready before exercising generation.
202+ try :
203+ - apply :
204+ file : ../cluster-policy.yaml
205+ - assert :
206+ file : chainsaw-assert-clusterpolicy.yaml
207+ - name : when-tenant-labeled-namespace-is-created
208+ description : |
209+ Create a namespace labeled konflux-ci.dev/type=tenant so the policy should generate a LocalQueue.
210+ try :
211+ - apply :
212+ file : resources/namespace-tenant.yaml
213+ template : true
214+ - name : then-localqueue-is-created
215+ description : |
216+ Assert the expected pipelines-queue LocalQueue exists and matches the fixture (name and spec).
217+ try :
218+ - assert :
219+ file : resources/expected-localqueue.yaml
220+ template : true
221+ - name : when-tenant-labeled-namespace-is-updated
222+ description : |
223+ update a namespace labeled konflux-ci.dev/type=tenant so the policy should generate a LocalQueue.
224+ try :
225+ - apply :
226+ file : resources/namespace-tenant-paused.yaml
227+ template : true
228+ - name : then-localqueue-is-updated
229+ description : |
230+ Assert the expected pipelines-queue LocalQueue exists and matches the fixture (name and spec).
231+ try :
232+ - assert :
233+ file : resources/expected-localqueue-paused.yaml
234+ template : true
235+ ---
236+ # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
237+ apiVersion : chainsaw.kyverno.io/v1alpha1
238+ kind : Test
239+ metadata :
240+ name : kueue-bootstrap-queue-new-tenant-labeled-namespace-paused
241+ spec :
242+ description : |
243+ Tests that a LocalQueue is created in a namespace labeled with
244+ `konflux-ci.dev/type=tenant` and with annotation to pause the
245+ LocalQueue.
246+ concurrent : false
247+ namespace : kueue-queue-new
248+ bindings :
249+ - name : suffix
250+ value : labeled
251+ steps :
252+ - name : given-localqueue-crd-exists
253+ description : |
254+ Install the Kueue LocalQueue CRD so the API server accepts LocalQueue objects in the test cluster.
255+ try :
256+ - apply :
257+ file : ./resources/localqueue-crd.yaml
258+ - name : given-kyverno-has-permission-on-resources
259+ description : |
260+ Apply Kyverno RBAC so the policy engine can generate and reconcile LocalQueue resources.
261+ try :
262+ - apply :
263+ file : ../kyverno-rbac.yaml
264+ - name : given-cluster-policy-is-ready
265+ description : |
266+ Apply the queue bootstrap ClusterPolicy and assert Kyverno reports the policy as ready before exercising generation.
267+ try :
268+ - apply :
269+ file : ../cluster-policy.yaml
270+ - assert :
271+ file : chainsaw-assert-clusterpolicy.yaml
272+ - name : when-tenant-labeled-namespace-is-created
273+ description : |
274+ Create a namespace labeled konflux-ci.dev/type=tenant so the policy should generate a LocalQueue.
275+ try :
276+ - apply :
277+ file : resources/namespace-tenant-paused.yaml
278+ template : true
279+ - name : then-localqueue-is-created
280+ description : |
281+ Assert the expected pipelines-queue LocalQueue exists and matches the fixture (name and spec).
282+ try :
283+ - assert :
284+ file : resources/expected-localqueue-paused.yaml
285+ template : true
286+ ---
287+ # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
288+ apiVersion : chainsaw.kyverno.io/v1alpha1
289+ kind : Test
54290metadata :
55291 name : kueue-bootstrap-queue-unlabeled-namespace-negative
56292spec :
0 commit comments