diff --git a/Makefile b/Makefile index 5cdc0f41..ce660225 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,10 @@ code-generator: openapi-gen: @GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install k8s.io/code-generator/cmd/openapi-gen@latest $(PROJECT_DIR)/bin/openapi-gen --go-header-file hack/boilerplate.go.txt -i sigs.k8s.io/jobset/api/jobset/v1alpha2 -p sigs.k8s.io/jobset/api/jobset/v1alpha2 --alsologtostderr - + if [ $(GOPATH)/src/sigs.k8s.io/jobset/api/jobset/v1alpha2/openapi_generated.go != $(PROJECT_DIR)/api/jobset/v1alpha2/openapi_generated.go ]; then \ + mv $(GOPATH)/src/sigs.k8s.io/jobset/api/jobset/v1alpha2/openapi_generated.go $(PROJECT_DIR)/api/jobset/v1alpha2/openapi_generated.go; \ + fi + .PHONY: envtest envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. $(ENVTEST): $(LOCALBIN) diff --git a/api/jobset/v1alpha2/jobset_types.go b/api/jobset/v1alpha2/jobset_types.go index ce2f4077..1ee25a5b 100644 --- a/api/jobset/v1alpha2/jobset_types.go +++ b/api/jobset/v1alpha2/jobset_types.go @@ -85,7 +85,7 @@ type JobSetStatus struct { // +optional // +listType=map // +listMapKey=name - ReplicatedJobsStatus []ReplicatedJobStatus `json:"ReplicatedJobsStatus,omitempty"` + ReplicatedJobsStatus []ReplicatedJobStatus `json:"replicatedJobsStatus,omitempty"` } // ReplicatedJobStatus defines the observed ReplicatedJobs Readiness. @@ -172,6 +172,8 @@ type SuccessPolicy struct { // TargetReplicatedJobs are the names of the replicated jobs the operator will apply to. // A null or empty list will apply to all replicatedJobs. + // +optional + // +listType=atomic TargetReplicatedJobs []string `json:"targetReplicatedJobs,omitempty"` } diff --git a/api/jobset/v1alpha2/openapi_generated.go b/api/jobset/v1alpha2/openapi_generated.go index 09fa9091..34edcfc4 100644 --- a/api/jobset/v1alpha2/openapi_generated.go +++ b/api/jobset/v1alpha2/openapi_generated.go @@ -250,7 +250,7 @@ func schema_jobset_api_jobset_v1alpha2_JobSetStatus(ref common.ReferenceCallback Format: "int32", }, }, - "ReplicatedJobsStatus": { + "replicatedJobsStatus": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ "x-kubernetes-list-map-keys": []interface{}{ @@ -407,6 +407,11 @@ func schema_jobset_api_jobset_v1alpha2_SuccessPolicy(ref common.ReferenceCallbac }, }, "targetReplicatedJobs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "TargetReplicatedJobs are the names of the replicated jobs the operator will apply to. A null or empty list will apply to all replicatedJobs.", Type: []string{"array"}, diff --git a/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go b/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go index 5948441b..3b18fb01 100644 --- a/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go +++ b/client-go/applyconfiguration/jobset/v1alpha2/jobsetstatus.go @@ -23,7 +23,7 @@ import ( type JobSetStatusApplyConfiguration struct { Conditions []v1.Condition `json:"conditions,omitempty"` Restarts *int32 `json:"restarts,omitempty"` - ReplicatedJobsStatus []ReplicatedJobStatusApplyConfiguration `json:"ReplicatedJobsStatus,omitempty"` + ReplicatedJobsStatus []ReplicatedJobStatusApplyConfiguration `json:"replicatedJobsStatus,omitempty"` } // JobSetStatusApplyConfiguration constructs an declarative configuration of the JobSetStatus type for use with diff --git a/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml b/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml index e84fba2b..182359fe 100644 --- a/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml +++ b/config/components/crd/bases/jobset.x-k8s.io_jobsets.yaml @@ -9617,6 +9617,7 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - operator type: object @@ -9630,38 +9631,6 @@ spec: status: description: JobSetStatus defines the observed state of JobSet properties: - ReplicatedJobsStatus: - description: ReplicatedJobsStatus track the number of JobsReady for - each replicatedJob. - items: - description: ReplicatedJobStatus defines the observed ReplicatedJobs - Readiness. - properties: - active: - format: int32 - type: integer - failed: - format: int32 - type: integer - name: - type: string - ready: - format: int32 - type: integer - succeeded: - format: int32 - type: integer - required: - - active - - failed - - name - - ready - - succeeded - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map conditions: items: description: "Condition contains details for one aspect of the current @@ -9733,6 +9702,38 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + replicatedJobsStatus: + description: ReplicatedJobsStatus track the number of JobsReady for + each replicatedJob. + items: + description: ReplicatedJobStatus defines the observed ReplicatedJobs + Readiness. + properties: + active: + format: int32 + type: integer + failed: + format: int32 + type: integer + name: + type: string + ready: + format: int32 + type: integer + succeeded: + format: int32 + type: integer + required: + - active + - failed + - name + - ready + - succeeded + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map restarts: description: Restarts tracks the number of times the JobSet has restarted (i.e. recreated in case of RecreateAll policy). diff --git a/hack/python-sdk/swagger.json b/hack/python-sdk/swagger.json index 571632c5..475fdc95 100644 --- a/hack/python-sdk/swagger.json +++ b/hack/python-sdk/swagger.json @@ -109,26 +109,26 @@ "description": "JobSetStatus defines the observed state of JobSet", "type": "object", "properties": { - "ReplicatedJobsStatus": { - "description": "ReplicatedJobsStatus track the number of JobsReady for each replicatedJob.", + "conditions": { "type": "array", "items": { "default": {}, - "$ref": "#/definitions/jobset.v1alpha2.ReplicatedJobStatus" + "$ref": "#/definitions/v1.Condition" }, "x-kubernetes-list-map-keys": [ - "name" + "type" ], "x-kubernetes-list-type": "map" }, - "conditions": { + "replicatedJobsStatus": { + "description": "ReplicatedJobsStatus track the number of JobsReady for each replicatedJob.", "type": "array", "items": { "default": {}, - "$ref": "#/definitions/v1.Condition" + "$ref": "#/definitions/jobset.v1alpha2.ReplicatedJobStatus" }, "x-kubernetes-list-map-keys": [ - "type" + "name" ], "x-kubernetes-list-type": "map" }, @@ -230,7 +230,8 @@ "items": { "type": "string", "default": "" - } + }, + "x-kubernetes-list-type": "atomic" } } } diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 123431d5..56cb0a6f 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -36,9 +36,11 @@ bash "${CODEGEN_PKG}/generate-groups.sh" \ CLIENT_GO=$(find $GOPATH -regextype sed -regex ".*jobset.*client-go") if [ -z "$CLIENT_GO" ]; then echo "WARNING: generated client-go files were not found." -elif [ "$CLIENT_GO" -ne "$REPO_ROOT/client-go" ]; then +elif [ "$CLIENT_GO" != "$REPO_ROOT/client-go" ]; then echo "moving generated files from $CLIENT_GO to $REPO_ROOT/client-go" + rm -rf $REPO_ROOT/client-go mv -f $CLIENT_GO $REPO_ROOT + fi diff --git a/sdk/python/docs/JobsetV1alpha2JobSetStatus.md b/sdk/python/docs/JobsetV1alpha2JobSetStatus.md index a570595e..b5262dab 100644 --- a/sdk/python/docs/JobsetV1alpha2JobSetStatus.md +++ b/sdk/python/docs/JobsetV1alpha2JobSetStatus.md @@ -4,8 +4,8 @@ JobSetStatus defines the observed state of JobSet ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**replicated_jobs_status** | [**list[JobsetV1alpha2ReplicatedJobStatus]**](JobsetV1alpha2ReplicatedJobStatus.md) | ReplicatedJobsStatus track the number of JobsReady for each replicatedJob. | [optional] **conditions** | [**list[V1Condition]**](V1Condition.md) | | [optional] +**replicated_jobs_status** | [**list[JobsetV1alpha2ReplicatedJobStatus]**](JobsetV1alpha2ReplicatedJobStatus.md) | ReplicatedJobsStatus track the number of JobsReady for each replicatedJob. | [optional] **restarts** | **int** | Restarts tracks the number of times the JobSet has restarted (i.e. recreated in case of RecreateAll policy). | [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) diff --git a/sdk/python/jobset/models/jobset_v1alpha2_job_set_status.py b/sdk/python/jobset/models/jobset_v1alpha2_job_set_status.py index 6bf3cf88..1b50496e 100644 --- a/sdk/python/jobset/models/jobset_v1alpha2_job_set_status.py +++ b/sdk/python/jobset/models/jobset_v1alpha2_job_set_status.py @@ -33,35 +33,56 @@ class JobsetV1alpha2JobSetStatus(object): and the value is json key in definition. """ openapi_types = { - 'replicated_jobs_status': 'list[JobsetV1alpha2ReplicatedJobStatus]', 'conditions': 'list[V1Condition]', + 'replicated_jobs_status': 'list[JobsetV1alpha2ReplicatedJobStatus]', 'restarts': 'int' } attribute_map = { - 'replicated_jobs_status': 'ReplicatedJobsStatus', 'conditions': 'conditions', + 'replicated_jobs_status': 'replicatedJobsStatus', 'restarts': 'restarts' } - def __init__(self, replicated_jobs_status=None, conditions=None, restarts=None, local_vars_configuration=None): # noqa: E501 + def __init__(self, conditions=None, replicated_jobs_status=None, restarts=None, local_vars_configuration=None): # noqa: E501 """JobsetV1alpha2JobSetStatus - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration - self._replicated_jobs_status = None self._conditions = None + self._replicated_jobs_status = None self._restarts = None self.discriminator = None - if replicated_jobs_status is not None: - self.replicated_jobs_status = replicated_jobs_status if conditions is not None: self.conditions = conditions + if replicated_jobs_status is not None: + self.replicated_jobs_status = replicated_jobs_status if restarts is not None: self.restarts = restarts + @property + def conditions(self): + """Gets the conditions of this JobsetV1alpha2JobSetStatus. # noqa: E501 + + + :return: The conditions of this JobsetV1alpha2JobSetStatus. # noqa: E501 + :rtype: list[V1Condition] + """ + return self._conditions + + @conditions.setter + def conditions(self, conditions): + """Sets the conditions of this JobsetV1alpha2JobSetStatus. + + + :param conditions: The conditions of this JobsetV1alpha2JobSetStatus. # noqa: E501 + :type: list[V1Condition] + """ + + self._conditions = conditions + @property def replicated_jobs_status(self): """Gets the replicated_jobs_status of this JobsetV1alpha2JobSetStatus. # noqa: E501 @@ -85,27 +106,6 @@ def replicated_jobs_status(self, replicated_jobs_status): self._replicated_jobs_status = replicated_jobs_status - @property - def conditions(self): - """Gets the conditions of this JobsetV1alpha2JobSetStatus. # noqa: E501 - - - :return: The conditions of this JobsetV1alpha2JobSetStatus. # noqa: E501 - :rtype: list[V1Condition] - """ - return self._conditions - - @conditions.setter - def conditions(self, conditions): - """Sets the conditions of this JobsetV1alpha2JobSetStatus. - - - :param conditions: The conditions of this JobsetV1alpha2JobSetStatus. # noqa: E501 - :type: list[V1Condition] - """ - - self._conditions = conditions - @property def restarts(self): """Gets the restarts of this JobsetV1alpha2JobSetStatus. # noqa: E501 diff --git a/sdk/python/requirements.txt b/sdk/python/requirements.txt index d9fb64f0..eb358efd 100644 --- a/sdk/python/requirements.txt +++ b/sdk/python/requirements.txt @@ -4,4 +4,3 @@ six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 -kubernetes diff --git a/sdk/python/test/test_jobset_v1alpha2_job_set.py b/sdk/python/test/test_jobset_v1alpha2_job_set.py index c62e14f5..3fb9ced8 100644 --- a/sdk/python/test/test_jobset_v1alpha2_job_set.py +++ b/sdk/python/test/test_jobset_v1alpha2_job_set.py @@ -60,6 +60,9 @@ def make_instance(self, include_optional): ], ), suspend = True, ), status = jobset.models.jobset_v1alpha2_job_set_status.JobsetV1alpha2JobSetStatus( + conditions = [ + None + ], replicated_jobs_status = [ jobset.models.jobset_v1alpha2_replicated_job_status.JobsetV1alpha2ReplicatedJobStatus( active = 56, @@ -68,9 +71,6 @@ def make_instance(self, include_optional): ready = 56, succeeded = 56, ) ], - conditions = [ - None - ], restarts = 56, ) ) else : diff --git a/sdk/python/test/test_jobset_v1alpha2_job_set_list.py b/sdk/python/test/test_jobset_v1alpha2_job_set_list.py index 776700e7..c5028183 100644 --- a/sdk/python/test/test_jobset_v1alpha2_job_set_list.py +++ b/sdk/python/test/test_jobset_v1alpha2_job_set_list.py @@ -63,6 +63,9 @@ def make_instance(self, include_optional): ], ), suspend = True, ), status = jobset.models.jobset_v1alpha2_job_set_status.JobsetV1alpha2JobSetStatus( + conditions = [ + None + ], replicated_jobs_status = [ jobset.models.jobset_v1alpha2_replicated_job_status.JobsetV1alpha2ReplicatedJobStatus( active = 56, @@ -71,9 +74,6 @@ def make_instance(self, include_optional): ready = 56, succeeded = 56, ) ], - conditions = [ - None - ], restarts = 56, ), ) ], kind = '0', @@ -105,6 +105,9 @@ def make_instance(self, include_optional): ], ), suspend = True, ), status = jobset.models.jobset_v1alpha2_job_set_status.JobsetV1alpha2JobSetStatus( + conditions = [ + None + ], replicated_jobs_status = [ jobset.models.jobset_v1alpha2_replicated_job_status.JobsetV1alpha2ReplicatedJobStatus( active = 56, @@ -113,9 +116,6 @@ def make_instance(self, include_optional): ready = 56, succeeded = 56, ) ], - conditions = [ - None - ], restarts = 56, ), ) ], ) diff --git a/sdk/python/test/test_jobset_v1alpha2_job_set_status.py b/sdk/python/test/test_jobset_v1alpha2_job_set_status.py index 8be1c9d8..b2336b83 100644 --- a/sdk/python/test/test_jobset_v1alpha2_job_set_status.py +++ b/sdk/python/test/test_jobset_v1alpha2_job_set_status.py @@ -38,6 +38,9 @@ def make_instance(self, include_optional): # model = jobset.models.jobset_v1alpha2_job_set_status.JobsetV1alpha2JobSetStatus() # noqa: E501 if include_optional : return JobsetV1alpha2JobSetStatus( + conditions = [ + None + ], replicated_jobs_status = [ jobset.models.jobset_v1alpha2_replicated_job_status.JobsetV1alpha2ReplicatedJobStatus( active = 56, @@ -46,9 +49,6 @@ def make_instance(self, include_optional): ready = 56, succeeded = 56, ) ], - conditions = [ - None - ], restarts = 56 ) else :