Skip to content

Commit a5a50cd

Browse files
fix(workflows): add clusterpolicy to validate workflow type
1 parent 397e521 commit a5a50cd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

charts/workflows/templates/workloadpriority-clusterpolicy.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,23 @@ spec:
7474
labels:
7575
kueue.x-k8s.io/queue-name: default-queue
7676
kueue.x-k8s.io/priority-class: low
77+
78+
- name: validate-workflow-type
79+
match:
80+
any:
81+
- resources:
82+
kinds:
83+
- argoproj.io/*/Workflow
84+
operations:
85+
- CREATE
86+
validate:
87+
message: "The annotation workflows.diamond.ac.uk/type must be 'standard', 'live', or 'test'."
88+
deny:
89+
conditions:
90+
all:
91+
- key: "{{ `{{ request.object.metadata.annotations.\"workflows.diamond.ac.uk/type\" || 'standard' }}` }}"
92+
operator: AnyNotIn
93+
value:
94+
- standard
95+
- live
96+
- test

charts/workflows/test-policy/workloadpriorityclass/chainsaw-test.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,12 @@ spec:
8383
labels:
8484
kueue.x-k8s.io/queue-name: default-queue
8585
kueue.x-k8s.io/priority-class: low
86+
- error:
87+
resource:
88+
apiVersion: argoproj.io/v1alpha1
89+
kind: Workflow
90+
metadata:
91+
name: invalid
92+
annotations:
93+
workflows.diamond.ac.uk/type: "processing"
94+
spec: {}

0 commit comments

Comments
 (0)