Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/workflows/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: workflows
description: Data Analysis workflow orchestration
type: application
version: 0.13.63
version: 0.13.64
dependencies:
- name: argo-workflows
repository: https://argoproj.github.io/argo-helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
value: "medium"
# Do not apply to Running Workflows as they may have created pods whose priority-class should not change
# Argo Workflows should have applied all metadata before a Job enters Running phase
- key: "{{ `{{ request.object.status.phase || '' }}` }}"
- key: "{{ `{{ request.oldObject.status.phase || '' }}` }}"
operator: NotEquals
value: Running
mutate:
Expand All @@ -52,7 +52,7 @@ spec:
- key: "{{ `{{ request.object.spec.podMetadata.labels.\"kueue.x-k8s.io/priority-class\" || '' }}` }}"
operator: NotEquals
value: "high"
- key: "{{ `{{ request.object.status.phase || '' }}` }}"
- key: "{{ `{{ request.oldObject.status.phase || '' }}` }}"
operator: NotEquals
value: Running
mutate:
Expand All @@ -78,7 +78,7 @@ spec:
- key: "{{ `{{ request.object.spec.podMetadata.labels.\"kueue.x-k8s.io/priority-class\" || '' }}` }}"
operator: NotEquals
value: "low"
- key: "{{ `{{ request.object.status.phase || '' }}` }}"
- key: "{{ `{{ request.oldObject.status.phase || '' }}` }}"
operator: NotEquals
value: Running
mutate:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
Expand Down Expand Up @@ -98,8 +99,14 @@ spec:
podMetadata:
labels:
kueue.x-k8s.io/priority-class: medium

# Test policy applies on Workflow UPDATE
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: workloadpriorityclass-applies-on-update
spec:
steps:
- try:
- apply:
resource:
apiVersion: argoproj.io/v1alpha1
Expand Down Expand Up @@ -138,7 +145,14 @@ spec:
podMetadata:
labels:
kueue.x-k8s.io/priority-class: high

---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: workloadpriorityclass-does-not-modify-running-workflows
spec:
steps:
- try:
# Test policy does not modify running Workflows
- apply:
resource:
Expand Down Expand Up @@ -168,7 +182,6 @@ spec:
status:
phase: Running
spec: {}

- assert:
resource:
apiVersion: argoproj.io/v1alpha1
Expand All @@ -177,7 +190,6 @@ spec:
name: update-while-running
status:
phase: Running

- error:
resource:
apiVersion: argoproj.io/v1alpha1
Expand All @@ -190,7 +202,6 @@ spec:
podMetadata:
labels:
kueue.x-k8s.io/priority-class: high

# Verify that the rejected update has not changed the Workflow.
- assert:
resource:
Expand All @@ -206,3 +217,55 @@ spec:
kueue.x-k8s.io/priority-class: high
status:
phase: Running
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: workloadpriorityclass-handles-simultaneous-update-of-metadata-and-phase
spec:
steps:
- try:
- apply:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: simultaneous-metadata-and-phase-update
spec: {}
- assert:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: simultaneous-metadata-and-phase-update
spec:
podMetadata:
labels:
kueue.x-k8s.io/priority-class: medium
# Simulate Argo applying workflowMetadata in the same update that
# transitions the Workflow into the Running phase
- apply:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: simultaneous-metadata-and-phase-update
annotations:
workflows.diamond.ac.uk/type: "live"
spec: {}
status:
phase: Running
- assert:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: simultaneous-metadata-and-phase-update
annotations:
workflows.diamond.ac.uk/type: "live"
spec:
podMetadata:
labels:
kueue.x-k8s.io/priority-class: high
status:
phase: Running
Loading