From 94b841411f6f761cbf5dfe384cad34d4674faca6 Mon Sep 17 00:00:00 2001 From: Varsha Date: Fri, 22 Nov 2024 00:12:26 -0800 Subject: [PATCH] [fix] Resolve v2alpha API exceptions (#2317) Resolve v2alpha API exceptions by adding necessary listType validations. Signed-off-by: Varsha Prasad Narsing Signed-off-by: sailesh duddupudi --- api.v2/openapi-spec/swagger.json | 95 +++++++++---- hack/violation_exception_v2alpha1.list | 20 --- .../kubeflow.org_clustertrainingruntimes.yaml | 7 +- .../crds/kubeflow.org_trainingruntimes.yaml | 7 +- .../v2/base/crds/kubeflow.org_trainjobs.yaml | 47 +++++++ .../v2alpha1/openapi_generated.go | 127 +++++++++++++++++- .../v2alpha1/trainingruntime_types.go | 3 +- .../kubeflow.org/v2alpha1/trainjob_types.go | 28 ++++ .../KubeflowOrgV2alpha1MPIMLPolicySource.md | 2 +- ...beflow_org_v2alpha1_mpiml_policy_source.py | 62 ++++----- 10 files changed, 315 insertions(+), 83 deletions(-) diff --git a/api.v2/openapi-spec/swagger.json b/api.v2/openapi-spec/swagger.json index 121ae3619f..2da8f52896 100644 --- a/api.v2/openapi-spec/swagger.json +++ b/api.v2/openapi-spec/swagger.json @@ -72,7 +72,8 @@ "items": { "type": "string", "default": "" - } + }, + "x-kubernetes-list-type": "atomic" }, "command": { "description": "Entrypoint commands for the training container.", @@ -80,7 +81,8 @@ "items": { "type": "string", "default": "" - } + }, + "x-kubernetes-list-type": "atomic" }, "env": { "description": "List of environment variables to set in the container. These values will be merged with the TrainingRuntime's environments.", @@ -88,7 +90,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.EnvVar" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "envFrom": { "description": "List of sources to populate environment variables in the container. These values will be merged with the TrainingRuntime's environments.", @@ -96,7 +102,8 @@ "items": { "default": {}, "$ref": "#/definitions/v1.EnvFromSource" - } + }, + "x-kubernetes-list-type": "atomic" }, "name": { "description": "Name for the container. TrainingRuntime must have this container.", @@ -109,7 +116,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.VolumeMount" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" } } }, @@ -134,7 +145,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.EnvVar" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "secretRef": { "description": "Reference to the secret with credentials to download dataset. Secret must be created in the TrainJob's namespace.", @@ -156,7 +171,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.EnvVar" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "secretRef": { "description": "Reference to the secret with credentials to download model. Secret must be created in the TrainJob's namespace.", @@ -269,10 +288,6 @@ "description": "MPIMLPolicySource represents a MPI runtime configuration.", "type": "object", "properties": { - "SSHAuthMountPath": { - "description": "Directory where SSH keys are mounted.", - "type": "string" - }, "mpiImplementation": { "description": "Implementation name for the MPI to create the appropriate hostfile. Defaults to OpenMPI.", "type": "string" @@ -285,6 +300,10 @@ "runLauncherAsNode": { "description": "Whether to run training process on the launcher Job. Defaults to false.", "type": "boolean" + }, + "sshAuthMountPath": { + "description": "Directory where SSH keys are mounted.", + "type": "string" } } }, @@ -312,7 +331,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.EnvVar" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "secretRef": { "description": "Reference to the secret with credentials to export model. Secret must be created in the TrainJob's namespace.", @@ -357,7 +380,11 @@ "items": { "default": {}, "$ref": "#/definitions/kubeflow.org.v2alpha1.ContainerOverride" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "initContainers": { "description": "Overrides for the init container in the desired job templates.", @@ -365,7 +392,11 @@ "items": { "default": {}, "$ref": "#/definitions/kubeflow.org.v2alpha1.ContainerOverride" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "nodeSelector": { "description": "Override for the node selector to place Pod on the specific mode.", @@ -385,7 +416,8 @@ "items": { "default": {}, "$ref": "#/definitions/kubeflow.org.v2alpha1.PodSpecOverrideTargetJob" - } + }, + "x-kubernetes-list-type": "atomic" }, "tolerations": { "description": "Override for the Pod's tolerations.", @@ -393,7 +425,8 @@ "items": { "default": {}, "$ref": "#/definitions/v1.Toleration" - } + }, + "x-kubernetes-list-type": "atomic" }, "volumes": { "description": "Overrides for the Pod volume configuration.", @@ -401,7 +434,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.Volume" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" } } }, @@ -460,7 +497,8 @@ "items": { "default": {}, "$ref": "#/definitions/k8s.io.api.autoscaling.v2.MetricSpec" - } + }, + "x-kubernetes-list-type": "atomic" }, "minNodes": { "description": "Lower limit for the number of nodes to which training job can scale down.", @@ -583,7 +621,8 @@ "items": { "default": {}, "$ref": "#/definitions/kubeflow.org.v2alpha1.PodSpecOverride" - } + }, + "x-kubernetes-list-type": "atomic" }, "runtimeRef": { "description": "Reference to the training runtime. The field is immutable.", @@ -624,7 +663,11 @@ "items": { "default": {}, "$ref": "#/definitions/kubeflow.org.v2alpha1.JobStatus" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" } } }, @@ -638,7 +681,8 @@ "items": { "type": "string", "default": "" - } + }, + "x-kubernetes-list-type": "atomic" }, "command": { "description": "Entrypoint commands for the training container.", @@ -646,7 +690,8 @@ "items": { "type": "string", "default": "" - } + }, + "x-kubernetes-list-type": "atomic" }, "env": { "description": "List of environment variables to set in the training container. These values will be merged with the TrainingRuntime's trainer environments.", @@ -654,7 +699,11 @@ "items": { "default": {}, "$ref": "#/definitions/v1.EnvVar" - } + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" }, "image": { "description": "Docker image for the training container.", diff --git a/hack/violation_exception_v2alpha1.list b/hack/violation_exception_v2alpha1.list index c18c46f8b9..e69de29bb2 100644 --- a/hack/violation_exception_v2alpha1.list +++ b/hack/violation_exception_v2alpha1.list @@ -1,20 +0,0 @@ -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Args -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Command -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Env -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,EnvFrom -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,VolumeMounts -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,DatasetConfig,Env -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,InputModel,Env -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,OutputModel,Env -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Containers -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,InitContainers -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,TargetJobs -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Tolerations -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Volumes -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TorchElasticPolicy,Metrics -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobSpec,PodSpecOverrides -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobStatus,JobsStatus -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Args -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Command -API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Env -API rule violation: names_match,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,MPIMLPolicySource,SSHAuthMountPath diff --git a/manifests/v2/base/crds/kubeflow.org_clustertrainingruntimes.yaml b/manifests/v2/base/crds/kubeflow.org_clustertrainingruntimes.yaml index f28b08b6c5..6a35be8ffe 100644 --- a/manifests/v2/base/crds/kubeflow.org_clustertrainingruntimes.yaml +++ b/manifests/v2/base/crds/kubeflow.org_clustertrainingruntimes.yaml @@ -49,9 +49,6 @@ spec: mpi: description: Configuration for the MPI Runtime. properties: - SSHAuthMountPath: - description: Directory where SSH keys are mounted. - type: string mpiImplementation: description: |- Implementation name for the MPI to create the appropriate hostfile. @@ -68,6 +65,9 @@ spec: Whether to run training process on the launcher Job. Defaults to false. type: boolean + sshAuthMountPath: + description: Directory where SSH keys are mounted. + type: string type: object numNodes: description: |- @@ -569,6 +569,7 @@ spec: - type type: object type: array + x-kubernetes-list-type: atomic minNodes: description: Lower limit for the number of nodes to which training job can scale down. diff --git a/manifests/v2/base/crds/kubeflow.org_trainingruntimes.yaml b/manifests/v2/base/crds/kubeflow.org_trainingruntimes.yaml index d5769ed073..9d3e5aa84d 100644 --- a/manifests/v2/base/crds/kubeflow.org_trainingruntimes.yaml +++ b/manifests/v2/base/crds/kubeflow.org_trainingruntimes.yaml @@ -49,9 +49,6 @@ spec: mpi: description: Configuration for the MPI Runtime. properties: - SSHAuthMountPath: - description: Directory where SSH keys are mounted. - type: string mpiImplementation: description: |- Implementation name for the MPI to create the appropriate hostfile. @@ -68,6 +65,9 @@ spec: Whether to run training process on the launcher Job. Defaults to false. type: boolean + sshAuthMountPath: + description: Directory where SSH keys are mounted. + type: string type: object numNodes: description: |- @@ -569,6 +569,7 @@ spec: - type type: object type: array + x-kubernetes-list-type: atomic minNodes: description: Lower limit for the number of nodes to which training job can scale down. diff --git a/manifests/v2/base/crds/kubeflow.org_trainjobs.yaml b/manifests/v2/base/crds/kubeflow.org_trainjobs.yaml index a0ae3ef0ff..0bde8bfc06 100644 --- a/manifests/v2/base/crds/kubeflow.org_trainjobs.yaml +++ b/manifests/v2/base/crds/kubeflow.org_trainjobs.yaml @@ -172,6 +172,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map secretRef: description: |- Reference to the secret with credentials to download dataset. @@ -338,6 +341,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map secretRef: description: |- Reference to the secret with credentials to download model. @@ -477,6 +483,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map secretRef: description: |- Reference to the secret with credentials to export model. @@ -515,11 +524,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic command: description: Entrypoint commands for the training container. items: type: string type: array + x-kubernetes-list-type: atomic env: description: |- List of environment variables to set in the container. @@ -637,6 +648,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map envFrom: description: |- List of sources to populate environment variables in the container. @@ -681,6 +695,7 @@ spec: x-kubernetes-map-type: atomic type: object type: array + x-kubernetes-list-type: atomic name: description: Name for the container. TrainingRuntime must have this container. @@ -729,10 +744,16 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map required: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map initContainers: description: Overrides for the init container in the desired job templates. @@ -747,11 +768,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic command: description: Entrypoint commands for the training container. items: type: string type: array + x-kubernetes-list-type: atomic env: description: |- List of environment variables to set in the container. @@ -869,6 +892,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map envFrom: description: |- List of sources to populate environment variables in the container. @@ -913,6 +939,7 @@ spec: x-kubernetes-map-type: atomic type: object type: array + x-kubernetes-list-type: atomic name: description: Name for the container. TrainingRuntime must have this container. @@ -961,10 +988,16 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map required: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map nodeSelector: additionalProperties: type: string @@ -987,6 +1020,7 @@ spec: - name type: object type: array + x-kubernetes-list-type: atomic tolerations: description: Override for the Pod's tolerations. items: @@ -1026,6 +1060,7 @@ spec: type: string type: object type: array + x-kubernetes-list-type: atomic volumes: description: Overrides for the Pod volume configuration. items: @@ -2740,10 +2775,14 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map required: - targetJobs type: object type: array + x-kubernetes-list-type: atomic runtimeRef: description: |- Reference to the training runtime. @@ -2787,11 +2826,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic command: description: Entrypoint commands for the training container. items: type: string type: array + x-kubernetes-list-type: atomic env: description: |- List of environment variables to set in the training container. @@ -2908,6 +2949,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map image: description: Docker image for the training container. type: string @@ -3100,6 +3144,9 @@ spec: - suspended type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object type: object served: true diff --git a/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go b/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go index d4079da74f..a5c15d8708 100644 --- a/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go +++ b/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go @@ -169,6 +169,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref common.Reference }, }, "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Entrypoint commands for the training container.", Type: []string{"array"}, @@ -184,6 +189,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref common.Reference }, }, "args": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Arguments to the entrypoint for the training container.", Type: []string{"array"}, @@ -199,6 +209,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref common.Reference }, }, "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of environment variables to set in the container. These values will be merged with the TrainingRuntime's environments.", Type: []string{"array"}, @@ -213,6 +231,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref common.Reference }, }, "envFrom": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of sources to populate environment variables in the container. These values will be merged with the TrainingRuntime's environments.", Type: []string{"array"}, @@ -227,6 +250,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref common.Reference }, }, "volumeMounts": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Pod volumes to mount into the container's filesystem.", Type: []string{"array"}, @@ -284,6 +315,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_DatasetConfig(ref common.ReferenceCall }, }, "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of environment variables to set in the dataset initializer container. These values will be merged with the TrainingRuntime's dataset initializer environments.", Type: []string{"array"}, @@ -326,6 +365,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_InputModel(ref common.ReferenceCallbac }, }, "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of environment variables to set in the model initializer container. These values will be merged with the TrainingRuntime's model initializer environments.", Type: []string{"array"}, @@ -525,7 +572,7 @@ func schema_pkg_apis_kubefloworg_v2alpha1_MPIMLPolicySource(ref common.Reference Format: "", }, }, - "SSHAuthMountPath": { + "sshAuthMountPath": { SchemaProps: spec.SchemaProps{ Description: "Directory where SSH keys are mounted.", Type: []string{"string"}, @@ -587,6 +634,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_OutputModel(ref common.ReferenceCallba }, }, "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of environment variables to set in the model exporter container. These values will be merged with the TrainingRuntime's model exporter environments.", Type: []string{"array"}, @@ -664,6 +719,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref common.ReferenceCa Type: []string{"object"}, Properties: map[string]spec.Schema{ "targetJobs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "TrainJobs is the training job replicas in the training runtime template to apply the overrides.", Type: []string{"array"}, @@ -678,6 +738,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref common.ReferenceCa }, }, "containers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Overrides for the containers in the desired job templates.", Type: []string{"array"}, @@ -692,6 +760,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref common.ReferenceCa }, }, "initContainers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Overrides for the init container in the desired job templates.", Type: []string{"array"}, @@ -706,6 +782,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref common.ReferenceCa }, }, "volumes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Overrides for the Pod volume configuration.", Type: []string{"array"}, @@ -743,6 +827,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref common.ReferenceCa }, }, "tolerations": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Override for the Pod's tolerations.", Type: []string{"array"}, @@ -851,6 +940,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_TorchElasticPolicy(ref common.Referenc }, }, "metrics": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Specification which are used to calculate the desired number of nodes. See the individual metric source types for more information about how each type of metric must respond. The HPA will be created to perform auto-scaling.", Type: []string{"array"}, @@ -1066,6 +1160,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_TrainJobSpec(ref common.ReferenceCallb }, }, "podSpecOverrides": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Custom overrides for the training runtime.", Type: []string{"array"}, @@ -1134,6 +1233,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_TrainJobStatus(ref common.ReferenceCal }, }, "jobsStatus": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "JobsStatus tracks the child Jobs in TrainJob.", Type: []string{"array"}, @@ -1170,6 +1277,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_Trainer(ref common.ReferenceCallback) }, }, "command": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Entrypoint commands for the training container.", Type: []string{"array"}, @@ -1185,6 +1297,11 @@ func schema_pkg_apis_kubefloworg_v2alpha1_Trainer(ref common.ReferenceCallback) }, }, "args": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Arguments to the entrypoint for the training container.", Type: []string{"array"}, @@ -1200,6 +1317,14 @@ func schema_pkg_apis_kubefloworg_v2alpha1_Trainer(ref common.ReferenceCallback) }, }, "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "List of environment variables to set in the training container. These values will be merged with the TrainingRuntime's trainer environments.", Type: []string{"array"}, diff --git a/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go b/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go index fd68ddbb40..d2ddceb140 100644 --- a/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go +++ b/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go @@ -198,6 +198,7 @@ type TorchElasticPolicy struct { // Specification which are used to calculate the desired number of nodes. See the individual // metric source types for more information about how each type of metric must respond. // The HPA will be created to perform auto-scaling. + // +listType=atomic Metrics []autoscalingv2.MetricSpec `json:"metrics,omitempty"` } @@ -212,7 +213,7 @@ type MPIMLPolicySource struct { MPIImplementation *MPIImplementation `json:"mpiImplementation,omitempty"` // Directory where SSH keys are mounted. - SSHAuthMountPath *string `json:"SSHAuthMountPath,omitempty"` + SSHAuthMountPath *string `json:"sshAuthMountPath,omitempty"` // Whether to run training process on the launcher Job. // Defaults to false. diff --git a/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go b/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go index 96226f74f6..30684ef1e7 100644 --- a/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go +++ b/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go @@ -126,6 +126,7 @@ type TrainJobSpec struct { Annotations map[string]string `json:"annotations,omitempty"` // Custom overrides for the training runtime. + // +listType=atomic PodSpecOverrides []PodSpecOverride `json:"podSpecOverrides,omitempty"` // Whether the controller should suspend the running TrainJob. @@ -171,13 +172,17 @@ type Trainer struct { Image *string `json:"image,omitempty"` // Entrypoint commands for the training container. + // +listType=atomic Command []string `json:"command,omitempty"` // Arguments to the entrypoint for the training container. + // +listType=atomic Args []string `json:"args,omitempty"` // List of environment variables to set in the training container. // These values will be merged with the TrainingRuntime's trainer environments. + // +listType=map + // +listMapKey=name Env []corev1.EnvVar `json:"env,omitempty"` // Number of training nodes. @@ -202,6 +207,8 @@ type DatasetConfig struct { // List of environment variables to set in the dataset initializer container. // These values will be merged with the TrainingRuntime's dataset initializer environments. + // +listType=map + // +listMapKey=name Env []corev1.EnvVar `json:"env,omitempty"` // Reference to the secret with credentials to download dataset. @@ -229,6 +236,8 @@ type InputModel struct { // List of environment variables to set in the model initializer container. // These values will be merged with the TrainingRuntime's model initializer environments. + // +listType=map + // +listMapKey=name Env []corev1.EnvVar `json:"env,omitempty"` // Reference to the secret with credentials to download model. @@ -243,6 +252,8 @@ type OutputModel struct { // List of environment variables to set in the model exporter container. // These values will be merged with the TrainingRuntime's model exporter environments. + // +listType=map + // +listMapKey=name Env []corev1.EnvVar `json:"env,omitempty"` // Reference to the secret with credentials to export model. @@ -253,15 +264,22 @@ type OutputModel struct { // PodSpecOverride represents the custom overrides that will be applied for the TrainJob's resources. type PodSpecOverride struct { // TrainJobs is the training job replicas in the training runtime template to apply the overrides. + // +listType=atomic TargetJobs []PodSpecOverrideTargetJob `json:"targetJobs"` // Overrides for the containers in the desired job templates. + // +listType=map + // +listMapKey=name Containers []ContainerOverride `json:"containers,omitempty"` // Overrides for the init container in the desired job templates. + // +listType=map + // +listMapKey=name InitContainers []ContainerOverride `json:"initContainers,omitempty"` // Overrides for the Pod volume configuration. + // +listType=map + // +listMapKey=name Volumes []corev1.Volume `json:"volumes,omitempty"` // Override for the service account. @@ -271,6 +289,7 @@ type PodSpecOverride struct { NodeSelector map[string]string `json:"nodeSelector,omitempty"` // Override for the Pod's tolerations. + // +listType=atomic Tolerations []corev1.Toleration `json:"tolerations,omitempty"` } @@ -286,20 +305,27 @@ type ContainerOverride struct { Name string `json:"name"` // Entrypoint commands for the training container. + // +listType=atomic Command []string `json:"command,omitempty"` // Arguments to the entrypoint for the training container. + // +listType=atomic Args []string `json:"args,omitempty"` // List of environment variables to set in the container. // These values will be merged with the TrainingRuntime's environments. + // +listType=map + // +listMapKey=name Env []corev1.EnvVar `json:"env,omitempty"` // List of sources to populate environment variables in the container. // These values will be merged with the TrainingRuntime's environments. + // +listType=atomic EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"` // Pod volumes to mount into the container's filesystem. + // +listType=map + // +listMapKey=name VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` } @@ -315,6 +341,8 @@ type TrainJobStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` // JobsStatus tracks the child Jobs in TrainJob. + // +listType=map + // +listMapKey=name JobsStatus []JobStatus `json:"jobsStatus,omitempty"` } diff --git a/sdk_v2/docs/KubeflowOrgV2alpha1MPIMLPolicySource.md b/sdk_v2/docs/KubeflowOrgV2alpha1MPIMLPolicySource.md index 0f71b352df..4e95e49c19 100644 --- a/sdk_v2/docs/KubeflowOrgV2alpha1MPIMLPolicySource.md +++ b/sdk_v2/docs/KubeflowOrgV2alpha1MPIMLPolicySource.md @@ -4,10 +4,10 @@ MPIMLPolicySource represents a MPI runtime configuration. ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ssh_auth_mount_path** | **str** | Directory where SSH keys are mounted. | [optional] **mpi_implementation** | **str** | Implementation name for the MPI to create the appropriate hostfile. Defaults to OpenMPI. | [optional] **num_proc_per_node** | **int** | Number of processes per node. This value is equal to the number of slots for each node in the hostfile. | [optional] **run_launcher_as_node** | **bool** | Whether to run training process on the launcher Job. Defaults to false. | [optional] +**ssh_auth_mount_path** | **str** | Directory where SSH keys are mounted. | [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_v2/kubeflow/training/models/kubeflow_org_v2alpha1_mpiml_policy_source.py b/sdk_v2/kubeflow/training/models/kubeflow_org_v2alpha1_mpiml_policy_source.py index 063b72f1e2..08afab12d3 100644 --- a/sdk_v2/kubeflow/training/models/kubeflow_org_v2alpha1_mpiml_policy_source.py +++ b/sdk_v2/kubeflow/training/models/kubeflow_org_v2alpha1_mpiml_policy_source.py @@ -33,62 +33,39 @@ class KubeflowOrgV2alpha1MPIMLPolicySource(object): and the value is json key in definition. """ openapi_types = { - 'ssh_auth_mount_path': 'str', 'mpi_implementation': 'str', 'num_proc_per_node': 'int', - 'run_launcher_as_node': 'bool' + 'run_launcher_as_node': 'bool', + 'ssh_auth_mount_path': 'str' } attribute_map = { - 'ssh_auth_mount_path': 'SSHAuthMountPath', 'mpi_implementation': 'mpiImplementation', 'num_proc_per_node': 'numProcPerNode', - 'run_launcher_as_node': 'runLauncherAsNode' + 'run_launcher_as_node': 'runLauncherAsNode', + 'ssh_auth_mount_path': 'sshAuthMountPath' } - def __init__(self, ssh_auth_mount_path=None, mpi_implementation=None, num_proc_per_node=None, run_launcher_as_node=None, local_vars_configuration=None): # noqa: E501 + def __init__(self, mpi_implementation=None, num_proc_per_node=None, run_launcher_as_node=None, ssh_auth_mount_path=None, local_vars_configuration=None): # noqa: E501 """KubeflowOrgV2alpha1MPIMLPolicySource - 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._ssh_auth_mount_path = None self._mpi_implementation = None self._num_proc_per_node = None self._run_launcher_as_node = None + self._ssh_auth_mount_path = None self.discriminator = None - if ssh_auth_mount_path is not None: - self.ssh_auth_mount_path = ssh_auth_mount_path if mpi_implementation is not None: self.mpi_implementation = mpi_implementation if num_proc_per_node is not None: self.num_proc_per_node = num_proc_per_node if run_launcher_as_node is not None: self.run_launcher_as_node = run_launcher_as_node - - @property - def ssh_auth_mount_path(self): - """Gets the ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. # noqa: E501 - - Directory where SSH keys are mounted. # noqa: E501 - - :return: The ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. # noqa: E501 - :rtype: str - """ - return self._ssh_auth_mount_path - - @ssh_auth_mount_path.setter - def ssh_auth_mount_path(self, ssh_auth_mount_path): - """Sets the ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. - - Directory where SSH keys are mounted. # noqa: E501 - - :param ssh_auth_mount_path: The ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. # noqa: E501 - :type: str - """ - - self._ssh_auth_mount_path = ssh_auth_mount_path + if ssh_auth_mount_path is not None: + self.ssh_auth_mount_path = ssh_auth_mount_path @property def mpi_implementation(self): @@ -159,6 +136,29 @@ def run_launcher_as_node(self, run_launcher_as_node): self._run_launcher_as_node = run_launcher_as_node + @property + def ssh_auth_mount_path(self): + """Gets the ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. # noqa: E501 + + Directory where SSH keys are mounted. # noqa: E501 + + :return: The ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. # noqa: E501 + :rtype: str + """ + return self._ssh_auth_mount_path + + @ssh_auth_mount_path.setter + def ssh_auth_mount_path(self, ssh_auth_mount_path): + """Sets the ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. + + Directory where SSH keys are mounted. # noqa: E501 + + :param ssh_auth_mount_path: The ssh_auth_mount_path of this KubeflowOrgV2alpha1MPIMLPolicySource. # noqa: E501 + :type: str + """ + + self._ssh_auth_mount_path = ssh_auth_mount_path + def to_dict(self): """Returns the model properties as a dict""" result = {}