Skip to content

Commit

Permalink
feat: Add PodPriorityClassName to SubmitOpts. Fixes #7059 (#7274)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Mandery <nico@nmandery.net>
  • Loading branch information
nmandery authored Nov 30, 2021
1 parent 88cbea3 commit 77f5209
Show file tree
Hide file tree
Showing 17 changed files with 647 additions and 567 deletions.
6 changes: 5 additions & 1 deletion api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6146,7 +6146,7 @@
"description": "Backoff is a backoff strategy"
},
"expression": {
"description": "Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored/",
"description": "Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored",
"type": "string"
},
"limit": {
Expand Down Expand Up @@ -6550,6 +6550,10 @@
},
"type": "array"
},
"podPriorityClassName": {
"description": "Set the podPriorityClassName of the workflow",
"type": "string"
},
"serverDryRun": {
"description": "ServerDryRun validates the workflow on the server-side without creating it",
"type": "boolean"
Expand Down
6 changes: 5 additions & 1 deletion api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -10409,7 +10409,7 @@
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Backoff"
},
"expression": {
"description": "Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored/",
"description": "Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored",
"type": "string"
},
"limit": {
Expand Down Expand Up @@ -10813,6 +10813,10 @@
"type": "string"
}
},
"podPriorityClassName": {
"description": "Set the podPriorityClassName of the workflow",
"type": "string"
},
"serverDryRun": {
"description": "ServerDryRun validates the workflow on the server-side without creating it",
"type": "boolean"
Expand Down
2 changes: 1 addition & 1 deletion docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ RetryStrategy provides controls on how to retry a workflow step
|:----------:|:----------:|---------------|
|`affinity`|[`RetryAffinity`](#retryaffinity)|Affinity prevents running workflow's step on the same host|
|`backoff`|[`Backoff`](#backoff)|Backoff is a backoff strategy|
|`expression`|`string`|Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored/|
|`expression`|`string`|Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored|
|`limit`|[`IntOrString`](#intorstring)|Limit is the maximum number of attempts when retrying a container|
|`retryPolicy`|`string`|RetryPolicy is a policy of NodePhase statuses that will be retried|

Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/workflow/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ type SubmitOpts struct {
OwnerReference *metav1.OwnerReference `json:"ownerReference,omitempty" protobuf:"bytes,11,opt,name=ownerReference"`
// Annotations adds to metadata.labels
Annotations string `json:"annotations,omitempty" protobuf:"bytes,12,opt,name=annotations"`
// Set the podPriorityClassName of the workflow
PodPriorityClassName string `json:"podPriorityClassName,omitempty" protobuf:"bytes,13,opt,name=podPriorityClassName"`
}
1,156 changes: 598 additions & 558 deletions pkg/apis/workflow/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion pkg/apis/workflow/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion pkg/apis/workflow/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/workflow/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**affinity** | [**IoArgoprojWorkflowV1alpha1RetryAffinity**](IoArgoprojWorkflowV1alpha1RetryAffinity.md) | | [optional]
**backoff** | [**IoArgoprojWorkflowV1alpha1Backoff**](IoArgoprojWorkflowV1alpha1Backoff.md) | | [optional]
**expression** | **String** | Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored/ | [optional]
**expression** | **String** | Expression is a condition expression for when a node will be retried. If it evaluates to false, the node will not be retried and the retry strategy will be ignored | [optional]
**limit** | **String** | | [optional]
**retryPolicy** | **String** | RetryPolicy is a policy of NodePhase statuses that will be retried | [optional]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Name | Type | Description | Notes
**ownerReference** | [**OwnerReference**](OwnerReference.md) | | [optional]
**parameterFile** | **String** | ParameterFile holds a reference to a parameter file. This option is not supported in API | [optional]
**parameters** | **List&lt;String&gt;** | Parameters passes input parameters to workflow | [optional]
**podPriorityClassName** | **String** | Set the podPriorityClassName of the workflow | [optional]
**serverDryRun** | **Boolean** | ServerDryRun validates the workflow on the server-side without creating it | [optional]
**serviceAccount** | **String** | ServiceAccount runs all pods in the workflow using specified ServiceAccount. | [optional]

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdks/python/client/docs/WorkflowServiceApi.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions workflow/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ func ApplySubmitOpts(wf *wfv1.Workflow, opts *wfv1.SubmitOpts) error {
if opts.ServiceAccount != "" {
wf.Spec.ServiceAccountName = opts.ServiceAccount
}
if opts.PodPriorityClassName != "" {
wf.Spec.PodPriorityClassName = opts.PodPriorityClassName
}

wfLabels := wf.GetLabels()
if wfLabels == nil {
wfLabels = make(map[string]string)
Expand Down
6 changes: 6 additions & 0 deletions workflow/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ func TestApplySubmitOpts(t *testing.T) {
assert.Equal(t, "81861780812", parameters[0].Value.String())
}
})
t.Run("PodPriorityClassName", func(t *testing.T) {
wf := &wfv1.Workflow{}
err := ApplySubmitOpts(wf, &wfv1.SubmitOpts{PodPriorityClassName: "abc"})
assert.NoError(t, err)
assert.Equal(t, "abc", wf.Spec.PodPriorityClassName)
})
}

func TestFormulateResubmitWorkflow(t *testing.T) {
Expand Down

0 comments on commit 77f5209

Please sign in to comment.