Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add omitempty to annotation of OnJobFailureReasons. #596

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 api/jobset/v1alpha2/jobset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ type FailurePolicyRule struct {
// rule is executed.
// An empty list applies the rule to any job failure reason.
// +kubebuilder:validation:UniqueItems:true
OnJobFailureReasons []string `json:"onJobFailureReasons"`
OnJobFailureReasons []string `json:"onJobFailureReasons,omitempty"`
// TargetReplicatedJobs are the names of the replicated jobs the operator applies to.
// An empty list will apply to all replicatedJobs.
// +optional
Expand Down
2 changes: 1 addition & 1 deletion api/jobset/v1alpha2/openapi_generated.go

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

1 change: 0 additions & 1 deletion config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ spec:
required:
- action
- name
- onJobFailureReasons
type: object
type: array
type: object
Expand Down
3 changes: 1 addition & 2 deletions hack/python-sdk/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"type": "object",
"required": [
"name",
"action",
"onJobFailureReasons"
"action"
],
"properties": {
"action": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/docs/JobsetV1alpha2FailurePolicyRule.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**action** | **str** | The action to take if the rule is matched. | [default to '']
**name** | **str** | The name of the failure policy rule. The name is defaulted to 'failurePolicyRuleN' where N is the index of the failure policy rule. The name must match the regular expression \"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$\". | [default to '']
**on_job_failure_reasons** | **list[str]** | The requirement on the job failure reasons. The requirement is satisfied if at least one reason matches the list. The rules are evaluated in order, and the first matching rule is executed. An empty list applies the rule to any job failure reason. |
**on_job_failure_reasons** | **list[str]** | The requirement on the job failure reasons. The requirement is satisfied if at least one reason matches the list. The rules are evaluated in order, and the first matching rule is executed. An empty list applies the rule to any job failure reason. | [optional]
**target_replicated_jobs** | **list[str]** | TargetReplicatedJobs are the names of the replicated jobs the operator applies to. An empty list will apply to all replicatedJobs. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def __init__(self, action='', name='', on_job_failure_reasons=None, target_repli

self.action = action
self.name = name
self.on_job_failure_reasons = on_job_failure_reasons
if on_job_failure_reasons is not None:
self.on_job_failure_reasons = on_job_failure_reasons
if target_replicated_jobs is not None:
self.target_replicated_jobs = target_replicated_jobs

Expand Down Expand Up @@ -134,8 +135,6 @@ def on_job_failure_reasons(self, on_job_failure_reasons):
:param on_job_failure_reasons: The on_job_failure_reasons of this JobsetV1alpha2FailurePolicyRule. # noqa: E501
:type: list[str]
"""
if self.local_vars_configuration.client_side_validation and on_job_failure_reasons is None: # noqa: E501
raise ValueError("Invalid value for `on_job_failure_reasons`, must not be `None`") # noqa: E501

self._on_job_failure_reasons = on_job_failure_reasons

Expand Down
3 changes: 0 additions & 3 deletions sdk/python/test/test_jobset_v1alpha2_failure_policy_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ def make_instance(self, include_optional):
return JobsetV1alpha2FailurePolicyRule(
action = '0',
name = '0',
on_job_failure_reasons = [
'0'
],
)

def testJobsetV1alpha2FailurePolicyRule(self):
Expand Down