Add clientset for MPIJob, PytorchJob, MXJob, and XGBoostJob (#1610)

This commit is contained in:
Yuki Iwai
2022-06-14 04:20:31 +00:00
committed by GitHub
parent c38406eb13
commit 0166d87791
233 changed files with 9003 additions and 8241 deletions
+2 -2
View File
@@ -1,4 +1,3 @@
# Image URL to use all building/pushing image targets
IMG ?= kubeflow/training-operator:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
@@ -45,6 +44,7 @@ generate: controller-gen ## Generate apidoc, sdk and code containing DeepCopy, D
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/apis/..."
hack/update-codegen.sh
hack/python-sdk/gen-sdk.sh
$(MAKE) apidoc
apidoc:
hack/generate-apidoc.sh
@@ -69,7 +69,7 @@ HAS_SETUP_ENVTEST := $(shell command -v setup-envtest;)
testall: manifests generate fmt vet golangci-lint test ## Run tests.
test: envtest
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell setup-envtest --arch=amd64 use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
envtest:
ifndef HAS_SETUP_ENVTEST
+4 -4
View File
@@ -9,7 +9,7 @@ resources:
controller: true
group: kubeflow.org
kind: XGBoostJob
path: github.com/kubeflow/training-operator/pkg/apis/xgboost/v1
path: github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1
version: v1
- api:
crdVersion: v1
@@ -17,7 +17,7 @@ resources:
controller: true
group: kubeflow.org
kind: PyTorchJob
path: github.com/kubeflow/training-operator/pkg/apis/pytorch/v1
path: github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1
version: v1
- api:
crdVersion: v1
@@ -25,7 +25,7 @@ resources:
controller: true
group: kubeflow.org
kind: TFJob
path: github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1
path: github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1
version: v1
- api:
crdVersion: v1
@@ -33,6 +33,6 @@ resources:
controller: true
group: kubeflow.org
kind: MXJob
path: github.com/kubeflow/training-operator/pkg/apis/mxnet/v1
path: github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1
version: v1
version: "3"
+6 -10
View File
@@ -12,11 +12,11 @@ run distributed or non-distributed TensorFlow/PyTorch/Apache MXNet/XGBoost/MPI j
> Note: Before v1.2 release, Kubeflow Training Operator only supports TFJob on Kubernetes.
- For a complete reference of the custom resource definitions, please refer to the API Definition.
- [TensorFlow API Definition](pkg/apis/tensorflow/v1/types.go)
- [PyTorch API Definition](pkg/apis/pytorch/v1/types.go)
- [Apache MXNet API Definition](pkg/apis/mxnet/v1/types.go)
- [XGBoost API Definition](pkg/apis/xgboost/v1/types.go)
- [MPI API Definition](pkg/apis/mpi/v1/types.go)
- [TensorFlow API Definition](pkg/apis/kubeflow.org/v1/tensorflow_types.go)
- [PyTorch API Definition](pkg/apis/kubeflow.org/v1/pytorch_types.go)
- [Apache MXNet API Definition](pkg/apis/kubeflow.org/v1/mxnet_types.go)
- [XGBoost API Definition](pkg/apis/kubeflow.org/v1/xgboost_types.go)
- [MPI API Definition](pkg/apis/kubeflow.org/v1/mpi_types.go)
- For details on API design, please refer to the [v1alpha2 design doc](https://github.com/kubeflow/community/blob/master/proposals/tf-operator-design-v1alpha2.md).
- For details of all-in-one operator design, please refer to the [All-in-one Kubeflow Training Operator](https://docs.google.com/document/d/1x1JPDQfDMIbnoQRftDH1IzGU0qvHGSU4W6Jl4rJLPhI/edit#heading=h.e33ufidnl8z6)
- For details on its observability, please refer to the [monitoring design doc](docs/monitoring/README.md).
@@ -67,11 +67,7 @@ Please refer to the [quick-start-v1.md](docs/quick-start-v1.md) and [Kubeflow Tr
Please refer to following API Documentation:
- [TensorFlow API Documentation](docs/api/tensorflow_generated.asciidoc)
- [PyTorch API Documentation](docs/api/pytorch_generated.asciidoc)
- [Apache MXNet API Documentation](docs/api/mxnet_generated.asciidoc)
- [XGBoost API Documentation](docs/api/xgboost_generated.asciidoc)
- [MPI API Documentation](docs/api/mpi_generated.asciidoc)
- [Kubeflow.org v1 API Documentation](docs/api/kubeflow.org_v1_generated.asciidoc)
## Community
+2 -10
View File
@@ -31,11 +31,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
commonutil "github.com/kubeflow/common/pkg/util"
mpiv1 "github.com/kubeflow/training-operator/pkg/apis/mpi/v1"
mxnetv1 "github.com/kubeflow/training-operator/pkg/apis/mxnet/v1"
pytorchv1 "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1"
tensorflowv1 "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1"
xgboostv1 "github.com/kubeflow/training-operator/pkg/apis/xgboost/v1"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1"
"github.com/kubeflow/training-operator/pkg/config"
controllerv1 "github.com/kubeflow/training-operator/pkg/controller.v1"
//+kubebuilder:scaffold:imports
@@ -48,11 +44,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(xgboostv1.AddToScheme(scheme))
utilruntime.Must(pytorchv1.AddToScheme(scheme))
utilruntime.Must(tensorflowv1.AddToScheme(scheme))
utilruntime.Must(mxnetv1.AddToScheme(scheme))
utilruntime.Must(mpiv1.AddToScheme(scheme))
utilruntime.Must(kubeflowv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}
+1 -1
View File
@@ -1,2 +1,2 @@
render:
kubernetesVersion: "1.19"
kubernetesVersion: "1.22"
+422
View File
@@ -0,0 +1,422 @@
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
= API Reference
.Packages
- xref:{anchor_prefix}-kubeflow-org-v1[$$kubeflow.org/v1$$]
[id="{anchor_prefix}-kubeflow-org-v1"]
== kubeflow.org/v1
Package v1 is the v1 version of the API.
Package v1 contains API Schema definitions for the kubeflow.org v1 API group
.Resource Types
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijob[$$MPIJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijoblist[$$MPIJobList$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjob[$$MXJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjoblist[$$MXJobList$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjob[$$PyTorchJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjoblist[$$PyTorchJobList$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjob[$$TFJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjoblist[$$TFJobList$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjob[$$XGBoostJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjoblist[$$XGBoostJobList$$]
=== Definitions
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-elasticpolicy"]
==== ElasticPolicy
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjobspec[$$PyTorchJobSpec$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`minReplicas`* __integer__ | minReplicas is the lower limit for the number of replicas to which the training job can scale down. It defaults to null.
| *`maxReplicas`* __integer__ | upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas, defaults to null.
| *`rdzvBackend`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-rdzvbackend[$$RDZVBackend$$]__ |
| *`rdzvPort`* __integer__ |
| *`rdzvHost`* __string__ |
| *`rdzvId`* __string__ |
| *`rdzvConf`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-rdzvconf[$$RDZVConf$$] array__ | RDZVConf contains additional rendezvous configuration (<key1>=<value1>,<key2>=<value2>,...).
| *`standalone`* __boolean__ | Start a local standalone rendezvous backend that is represented by a C10d TCP store on port 29400. Useful when launching single-node, multi-worker job. If specified --rdzv_backend, --rdzv_endpoint, --rdzv_id are auto-assigned; any explicitly set values are ignored.
| *`nProcPerNode`* __integer__ | Number of workers per node; supported values: [auto, cpu, gpu, int].
| *`maxRestarts`* __integer__ |
| *`metrics`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#metricspec-v2beta2-autoscaling[$$MetricSpec$$] array__ | Metrics contains the specifications which are used to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated with multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the HPA will not be created.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-jobmodetype"]
==== JobModeType (string)
JobModeType id the type for JobMode
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjobspec[$$MXJobSpec$$]
****
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijob"]
==== MPIJob
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijoblist[$$MPIJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MPIJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijobspec[$$MPIJobSpec$$]__ |
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijoblist"]
==== MPIJobList
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MPIJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijob[$$MPIJob$$] array__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijobspec"]
==== MPIJobSpec
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mpijob[$$MPIJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`slotsPerWorker`* __integer__ | Specifies the number of slots per worker used in hostfile. Defaults to 1.
| *`cleanPodPolicy`* __CleanPodPolicy__ | CleanPodPolicy defines the policy that whether to kill pods after the job completes. Defaults to None.
| *`mpiReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | `MPIReplicaSpecs` contains maps from `MPIReplicaType` to `ReplicaSpec` that specify the MPI replicas to run.
| *`mainContainer`* __string__ | MainContainer specifies name of the main container which executes the MPI code.
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | `RunPolicy` encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjob"]
==== MXJob
MXJob is the Schema for the mxjobs API
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjoblist[$$MXJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MXJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjobspec[$$MXJobSpec$$]__ |
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjoblist"]
==== MXJobList
MXJobList contains a list of MXJob
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MXJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjob[$$MXJob$$] array__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjobspec"]
==== MXJobSpec
MXJobSpec defines the desired state of MXJob
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-mxjob[$$MXJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
| *`jobMode`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-jobmodetype[$$JobModeType$$]__ | JobMode specify the kind of MXjob to do. Different mode may have different MXReplicaSpecs request
| *`mxReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | MXReplicaSpecs is map of commonv1.ReplicaType and commonv1.ReplicaSpec specifies the MX replicas to run. For example, { "Scheduler": commonv1.ReplicaSpec, "Server": commonv1.ReplicaSpec, "Worker": commonv1.ReplicaSpec, }
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjob"]
==== PyTorchJob
PyTorchJob Represents a PyTorchJob resource.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjoblist[$$PyTorchJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `PyTorchJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard Kubernetes type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjobspec[$$PyTorchJobSpec$$]__ | Specification of the desired state of the PyTorchJob.
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ | Most recently observed status of the PyTorchJob. Read-only (modified by the system).
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjoblist"]
==== PyTorchJobList
PyTorchJobList is a list of PyTorchJobs.
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `PyTorchJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjob[$$PyTorchJob$$] array__ | List of PyTorchJobs.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjobspec"]
==== PyTorchJobSpec
PyTorchJobSpec is a desired state description of the PyTorchJob.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-pytorchjob[$$PyTorchJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
| *`elasticPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-elasticpolicy[$$ElasticPolicy$$]__ |
| *`pytorchReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | A map of PyTorchReplicaType (type) to ReplicaSpec (value). Specifies the PyTorch cluster configuration. For example, { "Master": PyTorchReplicaSpec, "Worker": PyTorchReplicaSpec, }
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-rdzvbackend"]
==== RDZVBackend (string)
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-elasticpolicy[$$ElasticPolicy$$]
****
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-rdzvconf"]
==== RDZVConf
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-elasticpolicy[$$ElasticPolicy$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`key`* __string__ |
| *`value`* __string__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-successpolicy"]
==== SuccessPolicy (string)
SuccessPolicy is the success policy.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjobspec[$$TFJobSpec$$]
****
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjob"]
==== TFJob
TFJob represents a TFJob resource.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjoblist[$$TFJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `TFJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard Kubernetes type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjobspec[$$TFJobSpec$$]__ | Specification of the desired state of the TFJob.
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ | Most recently observed status of the TFJob. Populated by the system. Read-only.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjoblist"]
==== TFJobList
TFJobList is a list of TFJobs.
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `TFJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjob[$$TFJob$$] array__ | List of TFJobs.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjobspec"]
==== TFJobSpec
TFJobSpec is a desired state description of the TFJob.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-tfjob[$$TFJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
| *`successPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-successpolicy[$$SuccessPolicy$$]__ | SuccessPolicy defines the policy to mark the TFJob as succeeded. Default to "", using the default rules.
| *`tfReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | A map of TFReplicaType (type) to ReplicaSpec (value). Specifies the TF cluster configuration. For example, { "PS": ReplicaSpec, "Worker": ReplicaSpec, }
| *`enableDynamicWorker`* __boolean__ | A switch to enable dynamic worker
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjob"]
==== XGBoostJob
XGBoostJob is the Schema for the xgboostjobs API
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjoblist[$$XGBoostJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `XGBoostJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjobspec[$$XGBoostJobSpec$$]__ |
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjoblist"]
==== XGBoostJobList
XGBoostJobList contains a list of XGBoostJob
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `XGBoostJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjob[$$XGBoostJob$$] array__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjobspec"]
==== XGBoostJobSpec
XGBoostJobSpec defines the desired state of XGBoostJob
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-kubeflow-org-v1-xgboostjob[$$XGBoostJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file
| *`xgbReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ |
|===
-87
View File
@@ -1,87 +0,0 @@
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
= API Reference
.Packages
- xref:{anchor_prefix}-kubeflow-org-v1[$$kubeflow.org/v1$$]
[id="{anchor_prefix}-kubeflow-org-v1"]
== kubeflow.org/v1
Package v1 is the v1 version of the API.
Package v1 contains API Schema definitions for the kubeflow.org v1 API group
.Resource Types
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijob[$$MPIJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijoblist[$$MPIJobList$$]
=== Definitions
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijob"]
==== MPIJob
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijoblist[$$MPIJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MPIJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijobspec[$$MPIJobSpec$$]__ |
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijoblist"]
==== MPIJobList
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MPIJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijob[$$MPIJob$$] array__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijobspec"]
==== MPIJobSpec
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mpi-v1-mpijob[$$MPIJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`slotsPerWorker`* __integer__ | Specifies the number of slots per worker used in hostfile. Defaults to 1.
| *`cleanPodPolicy`* __CleanPodPolicy__ | CleanPodPolicy defines the policy that whether to kill pods after the job completes. Defaults to None.
| *`mpiReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | `MPIReplicaSpecs` contains maps from `MPIReplicaType` to `ReplicaSpec` that specify the MPI replicas to run.
| *`mainContainer`* __string__ | MainContainer specifies name of the main container which executes the MPI code.
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | `RunPolicy` encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
|===
-99
View File
@@ -1,99 +0,0 @@
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
= API Reference
.Packages
- xref:{anchor_prefix}-kubeflow-org-v1[$$kubeflow.org/v1$$]
[id="{anchor_prefix}-kubeflow-org-v1"]
== kubeflow.org/v1
Package v1 is the v1 version of the API.
Package v1 contains API Schema definitions for the kubeflow.org v1 API group
.Resource Types
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjob[$$MXJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjoblist[$$MXJobList$$]
=== Definitions
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-jobmodetype"]
==== JobModeType (string)
JobModeType id the type for JobMode
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjobspec[$$MXJobSpec$$]
****
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjob"]
==== MXJob
MXJob is the Schema for the mxjobs API
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjoblist[$$MXJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MXJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjobspec[$$MXJobSpec$$]__ |
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjoblist"]
==== MXJobList
MXJobList contains a list of MXJob
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `MXJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjob[$$MXJob$$] array__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjobspec"]
==== MXJobSpec
MXJobSpec defines the desired state of MXJob
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-mxjob[$$MXJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
| *`jobMode`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-mxnet-v1-jobmodetype[$$JobModeType$$]__ | JobMode specify the kind of MXjob to do. Different mode may have different MXReplicaSpecs request
| *`mxReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | MXReplicaSpecs is map of common.ReplicaType and common.ReplicaSpec specifies the MX replicas to run. For example, { "Scheduler": common.ReplicaSpec, "Server": common.ReplicaSpec, "Worker": common.ReplicaSpec, }
|===
-142
View File
@@ -1,142 +0,0 @@
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
= API Reference
.Packages
- xref:{anchor_prefix}-kubeflow-org-v1[$$kubeflow.org/v1$$]
[id="{anchor_prefix}-kubeflow-org-v1"]
== kubeflow.org/v1
Package v1 is the v1 version of the API.
Package v1 contains API Schema definitions for the kubeflow.org v1 API group
.Resource Types
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjob[$$PyTorchJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjoblist[$$PyTorchJobList$$]
=== Definitions
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-elasticpolicy"]
==== ElasticPolicy
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjobspec[$$PyTorchJobSpec$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`minReplicas`* __integer__ | minReplicas is the lower limit for the number of replicas to which the training job can scale down. It defaults to null.
| *`maxReplicas`* __integer__ | upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas, defaults to null.
| *`rdzvBackend`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-rdzvbackend[$$RDZVBackend$$]__ |
| *`rdzvPort`* __integer__ |
| *`rdzvHost`* __string__ |
| *`rdzvId`* __string__ |
| *`rdzvConf`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-rdzvconf[$$RDZVConf$$] array__ | RDZVConf contains additional rendezvous configuration (<key1>=<value1>,<key2>=<value2>,...).
| *`standalone`* __boolean__ | Start a local standalone rendezvous backend that is represented by a C10d TCP store on port 29400. Useful when launching single-node, multi-worker job. If specified --rdzv_backend, --rdzv_endpoint, --rdzv_id are auto-assigned; any explicitly set values are ignored.
| *`nProcPerNode`* __integer__ | Number of workers per node; supported values: [auto, cpu, gpu, int].
| *`maxRestarts`* __integer__ |
| *`metrics`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#metricspec-v2beta2-autoscaling[$$MetricSpec$$] array__ | Metrics contains the specifications which are used to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated with multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the HPA will not be created.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjob"]
==== PyTorchJob
PyTorchJob Represents a PyTorchJob resource.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjoblist[$$PyTorchJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `PyTorchJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard Kubernetes type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjobspec[$$PyTorchJobSpec$$]__ | Specification of the desired state of the PyTorchJob.
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ | Most recently observed status of the PyTorchJob. Read-only (modified by the system).
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjoblist"]
==== PyTorchJobList
PyTorchJobList is a list of PyTorchJobs.
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `PyTorchJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjob[$$PyTorchJob$$] array__ | List of PyTorchJobs.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjobspec"]
==== PyTorchJobSpec
PyTorchJobSpec is a desired state description of the PyTorchJob.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-pytorchjob[$$PyTorchJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
| *`elasticPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-elasticpolicy[$$ElasticPolicy$$]__ |
| *`pytorchReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | A map of PyTorchReplicaType (type) to ReplicaSpec (value). Specifies the PyTorch cluster configuration. For example, { "Master": PyTorchReplicaSpec, "Worker": PyTorchReplicaSpec, }
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-rdzvbackend"]
==== RDZVBackend (string)
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-elasticpolicy[$$ElasticPolicy$$]
****
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-rdzvconf"]
==== RDZVConf
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-pytorch-v1-elasticpolicy[$$ElasticPolicy$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`key`* __string__ |
| *`value`* __string__ |
|===
-86
View File
@@ -1,86 +0,0 @@
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
= API Reference
.Packages
- xref:{anchor_prefix}-kubeflow-org-v1[$$kubeflow.org/v1$$]
[id="{anchor_prefix}-kubeflow-org-v1"]
== kubeflow.org/v1
Package v1 is the v1 version of the API.
Package v1 contains API Schema definitions for the kubeflow.org v1 API group
.Resource Types
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjob[$$TFJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjoblist[$$TFJobList$$]
=== Definitions
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjob"]
==== TFJob
TFJob represents a TFJob resource.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjoblist[$$TFJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `TFJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard Kubernetes type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjobspec[$$TFJobSpec$$]__ | Specification of the desired state of the TFJob.
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ | Most recently observed status of the TFJob. Populated by the system. Read-only.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjoblist"]
==== TFJobList
TFJobList is a list of TFJobs.
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `TFJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ | Standard type metadata.
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjob[$$TFJob$$] array__ | List of TFJobs.
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjobspec"]
==== TFJobSpec
TFJobSpec is a desired state description of the TFJob.
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-tensorflow-v1-tfjob[$$TFJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.
| *`successPolicy`* __SuccessPolicy__ | SuccessPolicy defines the policy to mark the TFJob as succeeded. Default to "", using the default rules.
| *`tfReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ | A map of TFReplicaType (type) to ReplicaSpec (value). Specifies the TF cluster configuration. For example, { "PS": ReplicaSpec, "Worker": ReplicaSpec, }
| *`enableDynamicWorker`* __boolean__ | A switch to enable dynamic worker
|===
-84
View File
@@ -1,84 +0,0 @@
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
= API Reference
.Packages
- xref:{anchor_prefix}-kubeflow-org-v1[$$kubeflow.org/v1$$]
[id="{anchor_prefix}-kubeflow-org-v1"]
== kubeflow.org/v1
Package v1 is the v1 version of the API.
Package v1 contains API Schema definitions for the kubeflow.org v1 API group
.Resource Types
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjob[$$XGBoostJob$$]
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjoblist[$$XGBoostJobList$$]
=== Definitions
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjob"]
==== XGBoostJob
XGBoostJob is the Schema for the xgboostjobs API
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjoblist[$$XGBoostJobList$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `XGBoostJob`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`spec`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjobspec[$$XGBoostJobSpec$$]__ |
| *`status`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-jobstatus[$$JobStatus$$]__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjoblist"]
==== XGBoostJobList
XGBoostJobList contains a list of XGBoostJob
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`apiVersion`* __string__ | `kubeflow.org/v1`
| *`kind`* __string__ | `XGBoostJobList`
| *`TypeMeta`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#typemeta-v1-meta[$$TypeMeta$$]__ |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| *`items`* __xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjob[$$XGBoostJob$$] array__ |
|===
[id="{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjobspec"]
==== XGBoostJobSpec
XGBoostJobSpec defines the desired state of XGBoostJob
.Appears In:
****
- xref:{anchor_prefix}-github-com-kubeflow-training-operator-pkg-apis-xgboost-v1-xgboostjob[$$XGBoostJob$$]
****
[cols="25a,75a", options="header"]
|===
| Field | Description
| *`runPolicy`* __xref:{anchor_prefix}-github-com-kubeflow-common-pkg-apis-common-v1-runpolicy[$$RunPolicy$$]__ | INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file
| *`xgbReplicaSpecs`* __object (keys:ReplicaType, values:ReplicaSpec)__ |
|===
+1 -1
View File
@@ -16,6 +16,7 @@ require (
k8s.io/code-generator v0.24.1
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/controller-runtime v0.12.1
sigs.k8s.io/yaml v1.3.0
volcano.sh/apis v1.2.0-k8s1.19.6
@@ -86,7 +87,6 @@ require (
k8s.io/component-base v0.24.1 // indirect
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20220525155127-227cbc7cc124 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
)
+3 -31
View File
@@ -26,41 +26,13 @@ SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
cd ${SCRIPT_ROOT}
CRD_REF_GEN_VERSION=v0.0.8
go get -u github.com/elastic/crd-ref-docs@${CRD_REF_GEN_VERSION}
go install github.com/elastic/crd-ref-docs@${CRD_REF_GEN_VERSION}
crd-ref-docs --log-level DEBUG\
--source-path ./pkg/apis/tensorflow/v1 \
--source-path ./pkg/apis/kubeflow.org/v1 \
--config ./docs/api/autogen/config.yaml \
--templates-dir ./docs/api/autogen/templates \
--output-path ./docs/api/tensorflow_generated.asciidoc \
--max-depth 30
crd-ref-docs --log-level DEBUG\
--source-path ./pkg/apis/pytorch/v1 \
--config ./docs/api/autogen/config.yaml \
--templates-dir ./docs/api/autogen/templates \
--output-path ./docs/api/pytorch_generated.asciidoc \
--max-depth 30
crd-ref-docs --log-level DEBUG\
--source-path ./pkg/apis/mxnet/v1 \
--config ./docs/api/autogen/config.yaml \
--templates-dir ./docs/api/autogen/templates \
--output-path ./docs/api/mxnet_generated.asciidoc \
--max-depth 30
crd-ref-docs --log-level DEBUG\
--source-path ./pkg/apis/xgboost/v1 \
--config ./docs/api/autogen/config.yaml \
--templates-dir ./docs/api/autogen/templates \
--output-path ./docs/api/xgboost_generated.asciidoc \
--max-depth 30
crd-ref-docs --log-level DEBUG\
--source-path ./pkg/apis/mpi/v1 \
--config ./docs/api/autogen/config.yaml \
--templates-dir ./docs/api/autogen/templates \
--output-path ./docs/api/mpi_generated.asciidoc \
--output-path ./docs/api/kubeflow.org_v1_generated.asciidoc \
--max-depth 30
cd - > /dev/null
+2 -2
View File
@@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail
repo_root="$(dirname ${BASH_SOURCE})/../.."
repo_root="$(dirname "${BASH_SOURCE}")/../.."
SWAGGER_JAR_URL="https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar"
SWAGGER_CODEGEN_JAR="${repo_root}/hack/python-sdk/openapi-generator-cli.jar"
@@ -40,7 +40,7 @@ if [[ ! -f "$SWAGGER_CODEGEN_JAR" ]]; then
fi
echo "Generating swagger file ..."
go run "${repo_root}"/hack/python-sdk/main.go ${VERSION} >"${SWAGGER_CODEGEN_FILE}"
go run "${repo_root}"/hack/swagger/main.go ${VERSION} >"${SWAGGER_CODEGEN_FILE}"
echo "Removing previously generated files ..."
rm -rf "${SDK_OUTPUT_PATH}"/docs/V1*.md "${SDK_OUTPUT_PATH}"/kubeflow/training/models "${SDK_OUTPUT_PATH}"/kubeflow/training/*.py "${SDK_OUTPUT_PATH}"/test/*.py
+3 -1
View File
@@ -24,7 +24,9 @@ import re
__replacements = [
("import kubeflow.training", "from kubeflow.training.models import *"),
("kubeflow.training.models.v1\/.*.v1.", "V1")
("kubeflow.training.models.v1\/.*.v1.", "V1"),
("kubeflow.training.models.kubeflow/org/v1/", "kubeflow_org_v1_"),
("\.kubeflow.org.v1\.", ".KubeflowOrgV1"),
]
sdk_dir = os.path.abspath(os.path.join(__file__, "../../..", "sdk/python"))
+430 -430
View File
@@ -7,7 +7,7 @@
},
"paths": {},
"definitions": {
"v1.ElasticPolicy": {
"kubeflow.org.v1.ElasticPolicy": {
"type": "object",
"properties": {
"maxReplicas": {
@@ -45,7 +45,7 @@
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/v1.RDZVConf"
"$ref": "#/definitions/kubeflow.org.v1.RDZVConf"
}
},
"rdzvHost": {
@@ -64,6 +64,434 @@
}
}
},
"kubeflow.org.v1.MPIJob": {
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.MPIJobSpec"
},
"status": {
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"kubeflow.org.v1.MPIJobList": {
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.MPIJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"kubeflow.org.v1.MPIJobSpec": {
"type": "object",
"required": [
"mpiReplicaSpecs"
],
"properties": {
"cleanPodPolicy": {
"description": "CleanPodPolicy defines the policy that whether to kill pods after the job completes. Defaults to None.",
"type": "string"
},
"mainContainer": {
"description": "MainContainer specifies name of the main container which executes the MPI code.",
"type": "string"
},
"mpiReplicaSpecs": {
"description": "`MPIReplicaSpecs` contains maps from `MPIReplicaType` to `ReplicaSpec` that specify the MPI replicas to run.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "`RunPolicy` encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
},
"slotsPerWorker": {
"description": "Specifies the number of slots per worker used in hostfile. Defaults to 1.",
"type": "integer",
"format": "int32"
}
}
},
"kubeflow.org.v1.MXJob": {
"description": "MXJob is the Schema for the mxjobs API",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.MXJobSpec"
},
"status": {
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"kubeflow.org.v1.MXJobList": {
"description": "MXJobList contains a list of MXJob",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.MXJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"kubeflow.org.v1.MXJobSpec": {
"description": "MXJobSpec defines the desired state of MXJob",
"type": "object",
"required": [
"runPolicy",
"jobMode",
"mxReplicaSpecs"
],
"properties": {
"jobMode": {
"description": "JobMode specify the kind of MXjob to do. Different mode may have different MXReplicaSpecs request",
"type": "string",
"default": ""
},
"mxReplicaSpecs": {
"description": "MXReplicaSpecs is map of commonv1.ReplicaType and commonv1.ReplicaSpec specifies the MX replicas to run. For example,\n {\n \"Scheduler\": commonv1.ReplicaSpec,\n \"Server\": commonv1.ReplicaSpec,\n \"Worker\": commonv1.ReplicaSpec,\n }",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
}
}
},
"kubeflow.org.v1.MXJobStatus": {
"description": "MXJobStatus defines the observed state of MXJob",
"type": "object"
},
"kubeflow.org.v1.PyTorchJob": {
"description": "PyTorchJob Represents a PyTorchJob resource.",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"description": "Specification of the desired state of the PyTorchJob.",
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.PyTorchJobSpec"
},
"status": {
"description": "Most recently observed status of the PyTorchJob. Read-only (modified by the system).",
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"kubeflow.org.v1.PyTorchJobList": {
"description": "PyTorchJobList is a list of PyTorchJobs.",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"description": "List of PyTorchJobs.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.PyTorchJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"description": "Standard list metadata.",
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"kubeflow.org.v1.PyTorchJobSpec": {
"description": "PyTorchJobSpec is a desired state description of the PyTorchJob.",
"type": "object",
"required": [
"runPolicy",
"pytorchReplicaSpecs"
],
"properties": {
"elasticPolicy": {
"$ref": "#/definitions/kubeflow.org.v1.ElasticPolicy"
},
"pytorchReplicaSpecs": {
"description": "A map of PyTorchReplicaType (type) to ReplicaSpec (value). Specifies the PyTorch cluster configuration. For example,\n {\n \"Master\": PyTorchReplicaSpec,\n \"Worker\": PyTorchReplicaSpec,\n }",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
}
}
},
"kubeflow.org.v1.RDZVConf": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"kubeflow.org.v1.TFJob": {
"description": "TFJob represents a TFJob resource.",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"description": "Specification of the desired state of the TFJob.",
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.TFJobSpec"
},
"status": {
"description": "Most recently observed status of the TFJob. Populated by the system. Read-only.",
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"kubeflow.org.v1.TFJobList": {
"description": "TFJobList is a list of TFJobs.",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"description": "List of TFJobs.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.TFJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"description": "Standard list metadata.",
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"kubeflow.org.v1.TFJobSpec": {
"description": "TFJobSpec is a desired state description of the TFJob.",
"type": "object",
"required": [
"runPolicy",
"tfReplicaSpecs"
],
"properties": {
"enableDynamicWorker": {
"description": "A switch to enable dynamic worker",
"type": "boolean"
},
"runPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
},
"successPolicy": {
"description": "SuccessPolicy defines the policy to mark the TFJob as succeeded. Default to \"\", using the default rules.",
"type": "string"
},
"tfReplicaSpecs": {
"description": "A map of TFReplicaType (type) to ReplicaSpec (value). Specifies the TF cluster configuration. For example,\n {\n \"PS\": ReplicaSpec,\n \"Worker\": ReplicaSpec,\n }",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
}
}
},
"kubeflow.org.v1.XGBoostJob": {
"description": "XGBoostJob is the Schema for the xgboostjobs API",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.XGBoostJobSpec"
},
"status": {
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"kubeflow.org.v1.XGBoostJobList": {
"description": "XGBoostJobList contains a list of XGBoostJob",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/kubeflow.org.v1.XGBoostJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"kubeflow.org.v1.XGBoostJobSpec": {
"description": "XGBoostJobSpec defines the desired state of XGBoostJob",
"type": "object",
"required": [
"runPolicy",
"xgbReplicaSpecs"
],
"properties": {
"runPolicy": {
"description": "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
},
"xgbReplicaSpecs": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
}
}
},
"v1.JobCondition": {
"description": "JobCondition describes the state of the job at a certain point.",
"type": "object",
@@ -139,271 +567,6 @@
}
}
},
"v1.MPIJob": {
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"default": {},
"$ref": "#/definitions/v1.MPIJobSpec"
},
"status": {
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"v1.MPIJobList": {
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/v1.MPIJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"v1.MPIJobSpec": {
"type": "object",
"required": [
"mpiReplicaSpecs"
],
"properties": {
"cleanPodPolicy": {
"description": "CleanPodPolicy defines the policy that whether to kill pods after the job completes. Defaults to None.",
"type": "string"
},
"mainContainer": {
"description": "MainContainer specifies name of the main container which executes the MPI code.",
"type": "string"
},
"mpiReplicaSpecs": {
"description": "`MPIReplicaSpecs` contains maps from `MPIReplicaType` to `ReplicaSpec` that specify the MPI replicas to run.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "`RunPolicy` encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
},
"slotsPerWorker": {
"description": "Specifies the number of slots per worker used in hostfile. Defaults to 1.",
"type": "integer",
"format": "int32"
}
}
},
"v1.MXJob": {
"description": "MXJob is the Schema for the mxjobs API",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"default": {},
"$ref": "#/definitions/v1.MXJobSpec"
},
"status": {
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"v1.MXJobList": {
"description": "MXJobList contains a list of MXJob",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/v1.MXJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"v1.MXJobSpec": {
"description": "MXJobSpec defines the desired state of MXJob",
"type": "object",
"required": [
"runPolicy",
"jobMode",
"mxReplicaSpecs"
],
"properties": {
"jobMode": {
"description": "JobMode specify the kind of MXjob to do. Different mode may have different MXReplicaSpecs request",
"type": "string",
"default": ""
},
"mxReplicaSpecs": {
"description": "MXReplicaSpecs is map of common.ReplicaType and common.ReplicaSpec specifies the MX replicas to run. For example,\n {\n \"Scheduler\": common.ReplicaSpec,\n \"Server\": common.ReplicaSpec,\n \"Worker\": common.ReplicaSpec,\n }",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
}
}
},
"v1.MXJobStatus": {
"description": "MXJobStatus defines the observed state of MXJob",
"type": "object"
},
"v1.PyTorchJob": {
"description": "PyTorchJob Represents a PyTorchJob resource.",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"description": "Specification of the desired state of the PyTorchJob.",
"default": {},
"$ref": "#/definitions/v1.PyTorchJobSpec"
},
"status": {
"description": "Most recently observed status of the PyTorchJob. Read-only (modified by the system).",
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"v1.PyTorchJobList": {
"description": "PyTorchJobList is a list of PyTorchJobs.",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"description": "List of PyTorchJobs.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/v1.PyTorchJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"description": "Standard list metadata.",
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"v1.PyTorchJobSpec": {
"description": "PyTorchJobSpec is a desired state description of the PyTorchJob.",
"type": "object",
"required": [
"runPolicy",
"pytorchReplicaSpecs"
],
"properties": {
"elasticPolicy": {
"$ref": "#/definitions/v1.ElasticPolicy"
},
"pytorchReplicaSpecs": {
"description": "A map of PyTorchReplicaType (type) to ReplicaSpec (value). Specifies the PyTorch cluster configuration. For example,\n {\n \"Master\": PyTorchReplicaSpec,\n \"Worker\": PyTorchReplicaSpec,\n }",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
}
}
},
"v1.RDZVConf": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"v1.ReplicaSpec": {
"description": "ReplicaSpec is a description of the replica",
"type": "object",
@@ -500,169 +663,6 @@
"type": "string"
}
}
},
"v1.TFJob": {
"description": "TFJob represents a TFJob resource.",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"description": "Specification of the desired state of the TFJob.",
"default": {},
"$ref": "#/definitions/v1.TFJobSpec"
},
"status": {
"description": "Most recently observed status of the TFJob. Populated by the system. Read-only.",
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"v1.TFJobList": {
"description": "TFJobList is a list of TFJobs.",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"description": "List of TFJobs.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/v1.TFJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"description": "Standard list metadata.",
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"v1.TFJobSpec": {
"description": "TFJobSpec is a desired state description of the TFJob.",
"type": "object",
"required": [
"runPolicy",
"tfReplicaSpecs"
],
"properties": {
"enableDynamicWorker": {
"description": "A switch to enable dynamic worker",
"type": "boolean"
},
"runPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
},
"successPolicy": {
"description": "SuccessPolicy defines the policy to mark the TFJob as succeeded. Default to \"\", using the default rules.",
"type": "string"
},
"tfReplicaSpecs": {
"description": "A map of TFReplicaType (type) to ReplicaSpec (value). Specifies the TF cluster configuration. For example,\n {\n \"PS\": ReplicaSpec,\n \"Worker\": ReplicaSpec,\n }",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
}
}
},
"v1.XGBoostJob": {
"description": "XGBoostJob is the Schema for the xgboostjobs API",
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"default": {},
"$ref": "#/definitions/v1.XGBoostJobSpec"
},
"status": {
"default": {},
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"v1.XGBoostJobList": {
"description": "XGBoostJobList contains a list of XGBoostJob",
"type": "object",
"required": [
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/v1.XGBoostJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"default": {},
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"v1.XGBoostJobSpec": {
"description": "XGBoostJobSpec defines the desired state of XGBoostJob",
"type": "object",
"required": [
"runPolicy",
"xgbReplicaSpecs"
],
"properties": {
"runPolicy": {
"description": "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file",
"default": {},
"$ref": "#/definitions/v1.RunPolicy"
},
"xgbReplicaSpecs": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
}
}
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"packageName" : "kubeflow.training",
"projectName" : "training",
"packageVersion": "1.3.0",
"packageVersion": "1.4.0",
"importMappings": {
"V1Container": "from kubernetes.client import V1Container",
"V1ObjectMeta": "from kubernetes.client import V1ObjectMeta",
+46
View File
@@ -0,0 +1,46 @@
module github.com/kubeflow/training-operator/hack/swagger
go 1.17
require (
github.com/kubeflow/training-operator v0.0.0-00010101000000-000000000000
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20220603121420-31174f50af60
)
replace github.com/kubeflow/training-operator => ../../
require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/emicklei/go-restful/v3 v3.7.5-0.20220308211933-7c971ca4d0fd // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kubeflow/common v0.4.2 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
golang.org/x/net v0.0.0-20220607020251-c690dde0001d // indirect
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
k8s.io/api v0.24.1 // indirect
k8s.io/apimachinery v0.24.1 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/controller-runtime v0.12.1 // indirect
sigs.k8s.io/json v0.0.0-20220525155127-227cbc7cc124 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
)
+1061
View File
File diff suppressed because it is too large Load Diff
@@ -22,14 +22,11 @@ import (
"os"
"strings"
mpi "github.com/kubeflow/training-operator/pkg/apis/mpi/v1"
mxnet "github.com/kubeflow/training-operator/pkg/apis/mxnet/v1"
pytorch "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1"
tensorflow "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1"
xgboost "github.com/kubeflow/training-operator/pkg/apis/xgboost/v1"
"k8s.io/klog"
"k8s.io/kube-openapi/pkg/common"
"k8s.io/kube-openapi/pkg/validation/spec"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1"
)
// Generate OpenAPI spec definitions for API resources
@@ -48,23 +45,7 @@ func main() {
return spec.MustCreateRef("#/definitions/" + common.EscapeJsonPointer(swaggify(name)))
}
for k, v := range tensorflow.GetOpenAPIDefinitions(refCallback) {
oAPIDefs[k] = v
}
for k, v := range pytorch.GetOpenAPIDefinitions(refCallback) {
oAPIDefs[k] = v
}
for k, v := range mxnet.GetOpenAPIDefinitions(refCallback) {
oAPIDefs[k] = v
}
for k, v := range xgboost.GetOpenAPIDefinitions(refCallback) {
oAPIDefs[k] = v
}
for k, v := range mpi.GetOpenAPIDefinitions(refCallback) {
for k, v := range kubeflowv1.GetOpenAPIDefinitions(refCallback) {
oAPIDefs[k] = v
}
@@ -93,11 +74,7 @@ func main() {
}
func swaggify(name string) string {
name = strings.Replace(name, "github.com/kubeflow/training-operator/pkg/apis/tensorflow/", "", -1)
name = strings.Replace(name, "github.com/kubeflow/training-operator/pkg/apis/pytorch/", "", -1)
name = strings.Replace(name, "github.com/kubeflow/training-operator/pkg/apis/mxnet/", "", -1)
name = strings.Replace(name, "github.com/kubeflow/training-operator/pkg/apis/xgboost/", "", -1)
name = strings.Replace(name, "github.com/kubeflow/training-operator/pkg/apis/mpi/", "", -1)
name = strings.Replace(name, "github.com/kubeflow/training-operator/pkg/apis/", "", -1)
name = strings.Replace(name, "github.com/kubeflow/common/pkg/apis/common/", "", -1)
name = strings.Replace(name, "k8s.io/api/core/", "", -1)
name = strings.Replace(name, "k8s.io/apimachinery/pkg/apis/meta/", "", -1)
+7 -63
View File
@@ -74,7 +74,7 @@ chmod +x ${CODEGEN_PKG}/generate-groups.sh
cd ${SCRIPT_ROOT}
${CODEGEN_PKG}/generate-groups.sh "all" \
github.com/kubeflow/training-operator/pkg/client github.com/kubeflow/training-operator/pkg/apis \
tensorflow:v1 \
kubeflow.org:v1 \
--output-base "${TEMP_DIR}" \
--go-header-file hack/boilerplate/boilerplate.go.txt
@@ -84,38 +84,10 @@ ${CODEGEN_PKG}/generate-groups.sh "all" \
#go build -o defaulter-gen ${CODEGEN_PKG}/cmd/defaulter-gen
# ${GOPATH}/bin/defaulter-gen is automatically built from ${CODEGEN_PKG}/generate-groups.sh
echo "Generating defaulters for tensorflow/v1"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1 \
echo "Generating defaulters for kubeflow.org/v1"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \
-O zz_generated.defaults \
--output-package github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating defaulters for pytorch/v1"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/pytorch/v1 \
-O zz_generated.defaults \
--output-package github.com/kubeflow/training-operator/pkg/apis/pytorch/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating defaulters for mxnet/v1"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/mxnet/v1 \
-O zz_generated.defaults \
--output-package github.com/kubeflow/training-operator/pkg/apis/mxnet/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating defaulters for xgboost/v1"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/xgboost/v1 \
-O zz_generated.defaults \
--output-package github.com/kubeflow/training-operator/pkg/apis/xgboost/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating defaulters for mpi/v1"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/mpi/v1 \
-O zz_generated.defaults \
--output-package github.com/kubeflow/training-operator/pkg/apis/mpi/v1 \
--output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
@@ -126,38 +98,10 @@ cd - >/dev/null
echo "Building openapi-gen"
go build -o openapi-gen ${OPENAPI_PKG}/cmd/openapi-gen
echo "Generating OpenAPI specification for tensorflow/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1,github.com/kubeflow/common/pkg/apis/common/v1 \
echo "Generating OpenAPI specification for kubeflow.org/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1,github.com/kubeflow/common/pkg/apis/common/v1 \
--report-filename=hack/violation_exception.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating OpenAPI specification for pytorch/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/pytorch/v1,github.com/kubeflow/common/pkg/apis/common/v1 \
--report-filename=hack/violation_exception.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/pytorch/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating OpenAPI specification for mxnet/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/mxnet/v1,github.com/kubeflow/common/pkg/apis/common/v1 \
--report-filename=hack/violation_exception.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/mxnet/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating OpenAPI specification for xgboost/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/xgboost/v1,github.com/kubeflow/common/pkg/apis/common/v1 \
--report-filename=hack/violation_exception.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/xgboost/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
echo "Generating OpenAPI specification for mpi/v1"
./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/mpi/v1,github.com/kubeflow/common/pkg/apis/common/v1 \
--report-filename=hack/violation_exception.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/mpi/v1 \
--output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt "$@" \
--output-base "${TEMP_DIR}"
+4
View File
@@ -1 +1,5 @@
API rule violation: list_type_missing,github.com/kubeflow/common/pkg/apis/common/v1,JobStatus,Conditions
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1,ElasticPolicy,Metrics
API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1,ElasticPolicy,RDZVConf
API rule violation: names_match,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1,ElasticPolicy,RDZVID
API rule violation: names_match,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1,PyTorchJobSpec,PyTorchReplicaSpecs
+3 -3
View File
@@ -7727,10 +7727,10 @@ spec:
type: object
type: object
type: object
description: 'MXReplicaSpecs is map of common.ReplicaType and common.ReplicaSpec
description: 'MXReplicaSpecs is map of commonv1.ReplicaType and commonv1.ReplicaSpec
specifies the MX replicas to run. For example, { "Scheduler":
common.ReplicaSpec, "Server": common.ReplicaSpec, "Worker":
common.ReplicaSpec, }'
commonv1.ReplicaSpec, "Server": commonv1.ReplicaSpec, "Worker":
commonv1.ReplicaSpec, }'
type: object
runPolicy:
description: RunPolicy encapsulates various runtime policies of the
@@ -0,0 +1,60 @@
package v1
import (
"strings"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
)
func getDefaultContainerIndex(spec *corev1.PodSpec, defaultContainerName string) int {
for i, container := range spec.Containers {
if container.Name == defaultContainerName {
return i
}
}
return 0
}
func hasDefaultPort(spec *corev1.PodSpec, containerIndex int, defaultPortName string) bool {
for _, port := range spec.Containers[containerIndex].Ports {
if port.Name == defaultPortName {
return true
}
}
return false
}
func setDefaultPort(spec *corev1.PodSpec, defaultPortName string, defaultPort int32, defaultContainerIndex int) {
spec.Containers[defaultContainerIndex].Ports = append(spec.Containers[defaultContainerIndex].Ports,
corev1.ContainerPort{
Name: defaultPortName,
ContainerPort: defaultPort,
})
}
func setDefaultRestartPolicy(replicaSpec *commonv1.ReplicaSpec, defaultRestartPolicy commonv1.RestartPolicy) {
if replicaSpec != nil && replicaSpec.RestartPolicy == "" {
replicaSpec.RestartPolicy = defaultRestartPolicy
}
}
func setDefaultReplicas(replicaSpec *commonv1.ReplicaSpec, replicas int32) {
if replicaSpec != nil && replicaSpec.Replicas == nil {
replicaSpec.Replicas = pointer.Int32(replicas)
}
}
// setTypeNameToCamelCase sets the name of the replica type from any case to correct case.
// E.g. from server to Server; from WORKER to Worker.
func setTypeNameToCamelCase(replicaSpecs map[commonv1.ReplicaType]*commonv1.ReplicaSpec, typ commonv1.ReplicaType) {
for t := range replicaSpecs {
if strings.EqualFold(string(t), string(typ)) && t != typ {
spec := replicaSpecs[t]
delete(replicaSpecs, t)
replicaSpecs[typ] = spec
return
}
}
}
@@ -28,7 +28,7 @@ var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "kubeflow.org", Version: "v1"}
SchemeGroupVersionKind = schema.GroupVersionKind{Group: "kubeflow.org", Version: "v1", Kind: Kind}
MPIJobSchemeGroupVersionKind = schema.GroupVersionKind{Group: "kubeflow.org", Version: "v1", Kind: MPIJobKind}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
@@ -15,45 +15,26 @@
package v1
import (
common "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/apimachinery/pkg/runtime"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
// Int32 is a helper routine that allocates a new int32 value
// to store v and returns a pointer to it.
func Int32(v int32) *int32 {
return &v
}
func addDefaultingFuncs(scheme *runtime.Scheme) error {
func addMPIJobDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setDefaultsTypeLauncher sets the default value to launcher.
func setDefaultsTypeLauncher(spec *common.ReplicaSpec) {
if spec != nil && spec.RestartPolicy == "" {
spec.RestartPolicy = DefaultRestartPolicy
}
}
// setDefaultsTypeWorker sets the default value to worker.
func setDefaultsTypeWorker(spec *common.ReplicaSpec) {
if spec != nil && spec.RestartPolicy == "" {
spec.RestartPolicy = DefaultRestartPolicy
}
}
func SetDefaults_MPIJob(mpiJob *MPIJob) {
// Set default CleanPodPolicy to None when neither fields specified.
if mpiJob.Spec.CleanPodPolicy == nil && mpiJob.Spec.RunPolicy.CleanPodPolicy == nil {
none := common.CleanPodPolicyNone
none := commonv1.CleanPodPolicyNone
mpiJob.Spec.CleanPodPolicy = &none
mpiJob.Spec.RunPolicy.CleanPodPolicy = &none
}
// set default to Launcher
setDefaultsTypeLauncher(mpiJob.Spec.MPIReplicaSpecs[MPIReplicaTypeLauncher])
setDefaultRestartPolicy(mpiJob.Spec.MPIReplicaSpecs[MPIJobReplicaTypeLauncher], MPIJobDefaultRestartPolicy)
// set default to Worker
setDefaultsTypeWorker(mpiJob.Spec.MPIReplicaSpecs[MPIReplicaTypeWorker])
setDefaultRestartPolicy(mpiJob.Spec.MPIReplicaSpecs[MPIJobReplicaTypeWorker], MPIJobDefaultRestartPolicy)
}
@@ -19,6 +19,28 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// MPIJobDefaultPortName is name of the port used to communicate between Master and Workers.
MPIJobDefaultPortName = "mpi-port"
// MPIJobDefaultPort is default value of the port.
MPIJobDefaultPort = 9999
// MPIJobDefaultContainerName is the name of the MPIJob container.
MPIJobDefaultContainerName = "mpi"
// MPIJobDefaultRestartPolicy is default RestartPolicy for ReplicaSpec.
MPIJobDefaultRestartPolicy = commonv1.RestartPolicyNever
MPIJobKind = "MPIJob"
// MPIJobPlural is the MPIJobPlural for TFJob.
MPIJobPlural = "mpijobs"
// MPIJobSingular is the singular for TFJob.
MPIJobSingular = "mpijob"
// MPIJobFrameworkName is the name of the ML Framework
MPIJobFrameworkName = "mpi"
// MPIJobReplicaTypeLauncher is the type for launcher replica.
MPIJobReplicaTypeLauncher commonv1.ReplicaType = "Launcher"
// MPIJobReplicaTypeWorker is the type for worker replicas.
MPIJobReplicaTypeWorker commonv1.ReplicaType = "Worker"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resource:path=mpijob
@@ -59,14 +81,6 @@ type MPIJobSpec struct {
RunPolicy commonv1.RunPolicy `json:"runPolicy,omitempty"`
}
const (
// MPIReplicaTypeLauncher is the type for launcher replica.
MPIReplicaTypeLauncher commonv1.ReplicaType = "Launcher"
// MPIReplicaTypeWorker is the type for worker replicas.
MPIReplicaTypeWorker commonv1.ReplicaType = "Worker"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resource:path=mpijobs
// +kubebuilder:object:root=true
@@ -79,5 +93,5 @@ type MPIJobList struct {
func init() {
SchemeBuilder.Register(&MPIJob{}, &MPIJobList{})
SchemeBuilder.SchemeBuilder.Register(addDefaultingFuncs)
SchemeBuilder.SchemeBuilder.Register(addMPIJobDefaultingFuncs)
}
@@ -12,17 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"fmt"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
mpiv1 "github.com/kubeflow/training-operator/pkg/apis/mpi/v1"
)
func ValidateV1MpiJobSpec(c *mpiv1.MPIJobSpec) error {
func ValidateV1MpiJobSpec(c *MPIJobSpec) error {
if c.MPIReplicaSpecs == nil {
return fmt.Errorf("MPIReplicaSpecs is not valid")
}
@@ -32,7 +30,7 @@ func ValidateV1MpiJobSpec(c *mpiv1.MPIJobSpec) error {
return fmt.Errorf("MPIReplicaSpecs is not valid: containers definition expected in %v", rType)
}
// Make sure the replica type is valid.
validReplicaTypes := []commonv1.ReplicaType{mpiv1.MPIReplicaTypeLauncher, mpiv1.MPIReplicaTypeWorker}
validReplicaTypes := []commonv1.ReplicaType{MPIJobReplicaTypeLauncher, MPIJobReplicaTypeWorker}
isValidReplicaType := false
for _, t := range validReplicaTypes {
@@ -56,7 +54,7 @@ func ValidateV1MpiJobSpec(c *mpiv1.MPIJobSpec) error {
return fmt.Errorf(msg)
}
}
if rType == mpiv1.MPIReplicaTypeLauncher {
if rType == MPIJobReplicaTypeLauncher {
launcherExists = true
if value.Replicas != nil && int(*value.Replicas) != 1 {
return fmt.Errorf("MPIReplicaSpec is not valid: There must be only 1 launcher replica")
@@ -12,28 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
mpiv1 "github.com/kubeflow/training-operator/pkg/apis/mpi/v1"
v1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
)
func TestValidateV1MpiJobSpec(t *testing.T) {
testCases := []mpiv1.MPIJobSpec{
testCases := []MPIJobSpec{
{
MPIReplicaSpecs: nil,
},
{
MPIReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mpiv1.MPIReplicaTypeLauncher: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
MPIJobReplicaTypeLauncher: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{},
},
},
},
@@ -41,11 +40,11 @@ func TestValidateV1MpiJobSpec(t *testing.T) {
},
{
MPIReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mpiv1.MPIReplicaTypeLauncher: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
MPIJobReplicaTypeLauncher: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Image: "",
},
},
@@ -56,11 +55,11 @@ func TestValidateV1MpiJobSpec(t *testing.T) {
},
{
MPIReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mpiv1.MPIReplicaTypeLauncher: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
MPIJobReplicaTypeLauncher: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: "",
Image: "kubeflow/tf-dist-mnist-test:1.0",
},
@@ -72,12 +71,12 @@ func TestValidateV1MpiJobSpec(t *testing.T) {
},
{
MPIReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mpiv1.MPIReplicaTypeLauncher: &commonv1.ReplicaSpec{
Replicas: mpiv1.Int32(2),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
MPIJobReplicaTypeLauncher: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(2),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: "tensorflow",
Image: "kubeflow/tf-dist-mnist-test:1.0",
},
@@ -91,7 +90,7 @@ func TestValidateV1MpiJobSpec(t *testing.T) {
for _, c := range testCases {
err := ValidateV1MpiJobSpec(&c)
if err == nil {
t.Error("Failed validate the v1.MpiJobSpec")
t.Error("Failed validate the kubeflowv1.MpiJobSpec")
}
}
}
@@ -0,0 +1,66 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
func addMXNetDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setMXNetDefaultPort sets the default ports for mxnet container.
func setMXNetDefaultPort(spec *corev1.PodSpec) {
index := getDefaultContainerIndex(spec, MXJobDefaultContainerName)
if ok := hasDefaultPort(spec, index, MXJobDefaultPortName); !ok {
setDefaultPort(spec, MXJobDefaultPortName, MXJobDefaultPort, index)
}
}
// setMXNetTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setMXNetTypeNamesToCamelCase(mxJob *MXJob) {
replicaTypes := []commonv1.ReplicaType{
MXJobReplicaTypeScheduler,
MXJobReplicaTypeServer,
MXJobReplicaTypeWorker,
}
for _, replicaType := range replicaTypes {
setTypeNameToCamelCase(mxJob.Spec.MXReplicaSpecs, replicaType)
}
}
// SetDefaults_MXJob sets any unspecified values to defaults.
func SetDefaults_MXJob(mxjob *MXJob) {
// Set default cleanpod policy to All.
if mxjob.Spec.RunPolicy.CleanPodPolicy == nil {
all := commonv1.CleanPodPolicyAll
mxjob.Spec.RunPolicy.CleanPodPolicy = &all
}
// Update the key of MXReplicaSpecs to camel case.
setMXNetTypeNamesToCamelCase(mxjob)
for _, spec := range mxjob.Spec.MXReplicaSpecs {
// Set default replicas to 1
setDefaultReplicas(spec, 1)
// Set default default restartPolicy
setDefaultRestartPolicy(spec, MXJobDefaultRestartPolicy)
// Set default port to mxnet container.
setMXNetDefaultPort(&spec.Template.Spec)
}
}
@@ -15,27 +15,21 @@
package v1
import (
"encoding/json"
"fmt"
"reflect"
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
log "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
)
const (
testImage = "test-image:latest"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
)
func expectedMXNetJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy commonv1.RestartPolicy, replicas int32, portName string, port int32) *MXJob {
ports := []v1.ContainerPort{}
ports := []corev1.ContainerPort{}
// port not set
if portName != "" {
ports = append(ports,
v1.ContainerPort{
corev1.ContainerPort{
Name: portName,
ContainerPort: port,
},
@@ -43,11 +37,11 @@ func expectedMXNetJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy comm
}
// port set with custom name
if portName != DefaultPortName {
if portName != MXJobDefaultPortName {
ports = append(ports,
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
corev1.ContainerPort{
Name: MXJobDefaultPortName,
ContainerPort: MXJobDefaultPort,
},
)
}
@@ -58,14 +52,14 @@ func expectedMXNetJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy comm
CleanPodPolicy: &cleanPodPolicy,
},
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
MXReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(replicas),
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(replicas),
RestartPolicy: restartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: MXJobDefaultContainerName,
Image: testImage,
Ports: ports,
},
@@ -87,12 +81,12 @@ func TestSetDefaults_MXJob(t *testing.T) {
original: &MXJob{
Spec: MXJobSpec{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
MXReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: MXJobDefaultContainerName,
Image: testImage,
},
},
@@ -102,19 +96,19 @@ func TestSetDefaults_MXJob(t *testing.T) {
},
},
},
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 1, DefaultPortName, DefaultPort),
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, MXJobDefaultRestartPolicy, 1, MXJobDefaultPortName, MXJobDefaultPort),
},
"Set spec with restart policy": {
original: &MXJob{
Spec: MXJobSpec{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
MXReplicaTypeWorker: &commonv1.ReplicaSpec{
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
RestartPolicy: commonv1.RestartPolicyOnFailure,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: MXJobDefaultContainerName,
Image: testImage,
},
},
@@ -124,19 +118,19 @@ func TestSetDefaults_MXJob(t *testing.T) {
},
},
},
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, commonv1.RestartPolicyOnFailure, 1, DefaultPortName, DefaultPort),
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, commonv1.RestartPolicyOnFailure, 1, MXJobDefaultPortName, MXJobDefaultPort),
},
"Set spec with replicas": {
original: &MXJob{
Spec: MXJobSpec{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
MXReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(3),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(3),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: MXJobDefaultContainerName,
Image: testImage,
},
},
@@ -146,24 +140,24 @@ func TestSetDefaults_MXJob(t *testing.T) {
},
},
},
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 3, DefaultPortName, DefaultPort),
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, MXJobDefaultRestartPolicy, 3, MXJobDefaultPortName, MXJobDefaultPort),
},
"Set spec with default node port name and port": {
original: &MXJob{
Spec: MXJobSpec{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
MXReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: MXJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: MXJobDefaultPortName,
ContainerPort: MXJobDefaultPort,
},
},
},
@@ -174,23 +168,23 @@ func TestSetDefaults_MXJob(t *testing.T) {
},
},
},
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 1, DefaultPortName, DefaultPort),
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, MXJobDefaultRestartPolicy, 1, MXJobDefaultPortName, MXJobDefaultPort),
},
"Set spec with node port": {
original: &MXJob{
Spec: MXJobSpec{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
MXReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: MXJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: MXJobDefaultPortName,
ContainerPort: 9999,
},
},
@@ -202,7 +196,7 @@ func TestSetDefaults_MXJob(t *testing.T) {
},
},
},
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 1, DefaultPortName, 9999),
expected: expectedMXNetJob(commonv1.CleanPodPolicyAll, MXJobDefaultRestartPolicy, 1, MXJobDefaultPortName, 9999),
},
}
@@ -214,16 +208,3 @@ func TestSetDefaults_MXJob(t *testing.T) {
}
}
// pformat returns a pretty format output of any value that can be marshaled to JSON.
func pformat(value interface{}) string {
if s, ok := value.(string); ok {
return s
}
valueJSON, err := json.MarshalIndent(value, "", " ")
if err != nil {
log.Warningf("Couldn't pretty format %v, error: %v", value, err)
return fmt.Sprintf("%v", value)
}
return string(valueJSON)
}
@@ -15,31 +15,71 @@
package v1
import (
common "github.com/kubeflow/common/pkg/apis/common/v1"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// MXJobDefaultPortName is name of the port used to communicate between scheduler and
// servers & workers.
MXJobDefaultPortName = "mxjob-port"
// MXJobDefaultContainerName is the name of the MXJob container.
MXJobDefaultContainerName = "mxnet"
// MXJobDefaultPort is default value of the port.
MXJobDefaultPort = 9091
// MXJobDefaultRestartPolicy is default RestartPolicy for MXReplicaSpec.
MXJobDefaultRestartPolicy = commonv1.RestartPolicyNever
// MXJobKind is the kind name.
MXJobKind = "MXJob"
// MXJobPlural is the MXNetPlural for mxJob.
MXJobPlural = "mxjobs"
// MXJobSingular is the singular for mxJob.
MXJobSingular = "mxjob"
// MXJobFrameworkName is the name of the ML Framework
MXJobFrameworkName = "mxnet"
// MXJobReplicaTypeScheduler is the type for scheduler replica in MXNet.
MXJobReplicaTypeScheduler commonv1.ReplicaType = "Scheduler"
// MXJobReplicaTypeServer is the type for parameter servers of distributed MXNet.
MXJobReplicaTypeServer commonv1.ReplicaType = "Server"
// MXJobReplicaTypeWorker is the type for workers of distributed MXNet.
// This is also used for non-distributed MXNet.
MXJobReplicaTypeWorker commonv1.ReplicaType = "Worker"
// MXJobReplicaTypeTunerTracker
// This the auto-tuning tracker e.g. autotvm tracker, it will dispatch tuning task to TunerServer
MXJobReplicaTypeTunerTracker commonv1.ReplicaType = "TunerTracker"
// MXJobReplicaTypeTunerServer
MXJobReplicaTypeTunerServer commonv1.ReplicaType = "TunerServer"
// MXJobReplicaTypeTuner is the type for auto-tuning of distributed MXNet.
// This is also used for non-distributed MXNet.
MXJobReplicaTypeTuner commonv1.ReplicaType = "Tuner"
)
// MXJobSpec defines the desired state of MXJob
type MXJobSpec struct {
// RunPolicy encapsulates various runtime policies of the distributed training
// job, for example how to clean up resources and how long the job can stay
// active.
//+kubebuilder:validation:Optional
RunPolicy common.RunPolicy `json:"runPolicy"`
RunPolicy commonv1.RunPolicy `json:"runPolicy"`
// JobMode specify the kind of MXjob to do. Different mode may have
// different MXReplicaSpecs request
JobMode JobModeType `json:"jobMode"`
// MXReplicaSpecs is map of common.ReplicaType and common.ReplicaSpec
// MXReplicaSpecs is map of commonv1.ReplicaType and commonv1.ReplicaSpec
// specifies the MX replicas to run.
// For example,
// {
// "Scheduler": common.ReplicaSpec,
// "Server": common.ReplicaSpec,
// "Worker": common.ReplicaSpec,
// "Scheduler": commonv1.ReplicaSpec,
// "Server": commonv1.ReplicaSpec,
// "Worker": commonv1.ReplicaSpec,
// }
MXReplicaSpecs map[common.ReplicaType]*common.ReplicaSpec `json:"mxReplicaSpecs"`
MXReplicaSpecs map[commonv1.ReplicaType]*commonv1.ReplicaSpec `json:"mxReplicaSpecs"`
}
// JobModeType id the type for JobMode
@@ -55,29 +95,6 @@ const (
MXTune JobModeType = "MXTune"
)
const (
// MXReplicaTypeScheduler is the type for scheduler replica in MXNet.
MXReplicaTypeScheduler common.ReplicaType = "Scheduler"
// MXReplicaTypeServer is the type for parameter servers of distributed MXNet.
MXReplicaTypeServer common.ReplicaType = "Server"
// MXReplicaTypeWorker is the type for workers of distributed MXNet.
// This is also used for non-distributed MXNet.
MXReplicaTypeWorker common.ReplicaType = "Worker"
// MXReplicaTypeTunerTracker
// This the auto-tuning tracker e.g. autotvm tracker, it will dispatch tuning task to TunerServer
MXReplicaTypeTunerTracker common.ReplicaType = "TunerTracker"
// MXReplicaTypeTunerServer
MXReplicaTypeTunerServer common.ReplicaType = "TunerServer"
// MXReplicaTuner is the type for auto-tuning of distributed MXNet.
// This is also used for non-distributed MXNet.
MXReplicaTypeTuner common.ReplicaType = "Tuner"
)
// MXJobStatus defines the observed state of MXJob
type MXJobStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
@@ -87,7 +104,6 @@ type MXJobStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resource:path=mxjob
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.conditions[-1:].type`
@@ -98,8 +114,8 @@ type MXJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MXJobSpec `json:"spec,omitempty"`
Status common.JobStatus `json:"status,omitempty"`
Spec MXJobSpec `json:"spec,omitempty"`
Status commonv1.JobStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
@@ -113,5 +129,5 @@ type MXJobList struct {
func init() {
SchemeBuilder.Register(&MXJob{}, &MXJobList{})
SchemeBuilder.SchemeBuilder.Register(addDefaultingFuncs)
SchemeBuilder.SchemeBuilder.Register(addMXNetDefaultingFuncs)
}
@@ -12,29 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"fmt"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
log "github.com/sirupsen/logrus"
mxv1 "github.com/kubeflow/training-operator/pkg/apis/mxnet/v1"
)
// ValidateV1MXJobSpec checks that the v1.MXJobSpec is valid.
func ValidateV1MXJobSpec(c *mxv1.MXJobSpec) error {
return validateV1ReplicaSpecs(c.MXReplicaSpecs)
// ValidateV1MXJobSpec checks that the kubeflowv1.MXJobSpec is valid.
func ValidateV1MXJobSpec(c *MXJobSpec) error {
return validateMXNetReplicaSpecs(c.MXReplicaSpecs)
}
// IsScheduler returns true if the type is Scheduler.
func IsScheduler(typ commonv1.ReplicaType) bool {
return typ == mxv1.MXReplicaTypeScheduler
return typ == MXJobReplicaTypeScheduler
}
func validateV1ReplicaSpecs(specs map[commonv1.ReplicaType]*commonv1.ReplicaSpec) error {
func validateMXNetReplicaSpecs(specs map[commonv1.ReplicaType]*commonv1.ReplicaSpec) error {
if specs == nil {
return fmt.Errorf("MXJobSpec is not valid")
}
@@ -53,7 +50,7 @@ func validateV1ReplicaSpecs(specs map[commonv1.ReplicaType]*commonv1.ReplicaSpec
log.Warn("Image is undefined in the container")
return fmt.Errorf("MXJobSpec is not valid")
}
if container.Name == mxv1.DefaultContainerName {
if container.Name == MXJobDefaultContainerName {
numNamedMXNet++
}
}
@@ -12,24 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License
package validation
package v1
import (
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
mxv1 "github.com/kubeflow/training-operator/pkg/apis/mxnet/v1"
v1 "k8s.io/api/core/v1"
)
func TestValidateV1MXJobSpec(t *testing.T) {
testCases := []mxv1.MXJobSpec{
testCases := []MXJobSpec{
{
MXReplicaSpecs: nil,
},
{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mxv1.MXReplicaTypeWorker: &commonv1.ReplicaSpec{
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
@@ -40,7 +39,7 @@ func TestValidateV1MXJobSpec(t *testing.T) {
},
{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mxv1.MXReplicaTypeWorker: &commonv1.ReplicaSpec{
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
@@ -55,7 +54,7 @@ func TestValidateV1MXJobSpec(t *testing.T) {
},
{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mxv1.MXReplicaTypeWorker: &commonv1.ReplicaSpec{
MXJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
@@ -71,7 +70,7 @@ func TestValidateV1MXJobSpec(t *testing.T) {
},
{
MXReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
mxv1.MXReplicaTypeScheduler: &commonv1.ReplicaSpec{
MXJobReplicaTypeScheduler: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,84 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
func addPytorchDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setPytorchDefaultPort sets the default ports for pytorch container.
func setPytorchDefaultPort(spec *corev1.PodSpec) {
index := getDefaultContainerIndex(spec, PytorchJobDefaultContainerName)
if ok := hasDefaultPort(spec, index, PytorchJobDefaultPortName); !ok {
setDefaultPort(spec, PytorchJobDefaultPortName, PytorchJobDefaultPort, index)
}
}
func setElasticPolicy(pytorchJob *PyTorchJob) {
if pytorchJob.Spec.ElasticPolicy != nil {
if pytorchJob.Spec.ElasticPolicy.MaxReplicas != nil &&
pytorchJob.Spec.ElasticPolicy.MinReplicas != nil {
return
} else if pytorchJob.Spec.ElasticPolicy.MaxReplicas != nil {
// Set MinRepliacs to elasticPolicy.MaxReplicas.
pytorchJob.Spec.ElasticPolicy.MinReplicas = pytorchJob.Spec.ElasticPolicy.MaxReplicas
} else if pytorchJob.Spec.ElasticPolicy.MinReplicas != nil {
pytorchJob.Spec.ElasticPolicy.MaxReplicas = pytorchJob.Spec.ElasticPolicy.MinReplicas
} else {
workerReplicas := pytorchJob.Spec.PyTorchReplicaSpecs[PyTorchJobReplicaTypeWorker].Replicas
// Set Min and Max to worker.spec.Replicas.
pytorchJob.Spec.ElasticPolicy.MaxReplicas = workerReplicas
pytorchJob.Spec.ElasticPolicy.MinReplicas = workerReplicas
}
}
}
// setPytorchTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setPytorchTypeNamesToCamelCase(pytorchJob *PyTorchJob) {
replicaTypes := []commonv1.ReplicaType{
PyTorchJobReplicaTypeMaster,
PyTorchJobReplicaTypeWorker,
}
for _, replicaType := range replicaTypes {
setTypeNameToCamelCase(pytorchJob.Spec.PyTorchReplicaSpecs, replicaType)
}
}
// SetDefaults_PyTorchJob sets any unspecified values to defaults.
func SetDefaults_PyTorchJob(job *PyTorchJob) {
// Set default cleanpod policy to None.
if job.Spec.RunPolicy.CleanPodPolicy == nil {
policy := commonv1.CleanPodPolicyNone
job.Spec.RunPolicy.CleanPodPolicy = &policy
}
// Update the key of PyTorchReplicaSpecs to camel case.
setPytorchTypeNamesToCamelCase(job)
for _, spec := range job.Spec.PyTorchReplicaSpecs {
setDefaultReplicas(spec, 1)
setDefaultRestartPolicy(spec, PytorchJobDefaultRestartPolicy)
setPytorchDefaultPort(&spec.Template.Spec)
}
// Set default elastic policy.
setElasticPolicy(job)
}
@@ -5,8 +5,9 @@ import (
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
"k8s.io/utils/pointer"
v1 "github.com/kubeflow/common/pkg/apis/common/v1"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
func TestSetElasticPolicy(t *testing.T) {
@@ -30,17 +31,17 @@ func TestSetElasticPolicy(t *testing.T) {
job: &PyTorchJob{
Spec: PyTorchJobSpec{
ElasticPolicy: &ElasticPolicy{},
PyTorchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{
PyTorchReplicaTypeWorker: {
Replicas: int32Ptr(1),
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
PyTorchJobReplicaTypeWorker: {
Replicas: pointer.Int32(1),
},
},
},
},
},
result: result{
expectedMinReplicas: int32Ptr(1),
expectedMaxReplicas: int32Ptr(1),
expectedMinReplicas: pointer.Int32(1),
expectedMaxReplicas: pointer.Int32(1),
},
},
{
@@ -49,20 +50,20 @@ func TestSetElasticPolicy(t *testing.T) {
job: &PyTorchJob{
Spec: PyTorchJobSpec{
ElasticPolicy: &ElasticPolicy{
MaxReplicas: int32Ptr(1),
MinReplicas: int32Ptr(1),
MaxReplicas: pointer.Int32(1),
MinReplicas: pointer.Int32(1),
},
PyTorchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{
PyTorchReplicaTypeWorker: {
Replicas: int32Ptr(1),
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
PyTorchJobReplicaTypeWorker: {
Replicas: pointer.Int32(1),
},
},
},
},
},
result: result{
expectedMinReplicas: int32Ptr(1),
expectedMaxReplicas: int32Ptr(1),
expectedMinReplicas: pointer.Int32(1),
expectedMaxReplicas: pointer.Int32(1),
},
},
{
@@ -71,20 +72,20 @@ func TestSetElasticPolicy(t *testing.T) {
job: &PyTorchJob{
Spec: PyTorchJobSpec{
ElasticPolicy: &ElasticPolicy{
MaxReplicas: int32Ptr(1),
MinReplicas: int32Ptr(1),
MaxReplicas: pointer.Int32(1),
MinReplicas: pointer.Int32(1),
},
PyTorchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{
PyTorchReplicaTypeWorker: {
Replicas: int32Ptr(1),
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
PyTorchJobReplicaTypeWorker: {
Replicas: pointer.Int32(1),
},
},
},
},
},
result: result{
expectedMinReplicas: int32Ptr(1),
expectedMaxReplicas: int32Ptr(1),
expectedMinReplicas: pointer.Int32(1),
expectedMaxReplicas: pointer.Int32(1),
},
},
{
@@ -93,20 +94,20 @@ func TestSetElasticPolicy(t *testing.T) {
job: &PyTorchJob{
Spec: PyTorchJobSpec{
ElasticPolicy: &ElasticPolicy{
MaxReplicas: int32Ptr(1),
MaxReplicas: pointer.Int32(1),
MinReplicas: nil,
},
PyTorchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{
PyTorchReplicaTypeWorker: {
Replicas: int32Ptr(1),
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
PyTorchJobReplicaTypeWorker: {
Replicas: pointer.Int32(1),
},
},
},
},
},
result: result{
expectedMinReplicas: int32Ptr(1),
expectedMaxReplicas: int32Ptr(1),
expectedMinReplicas: pointer.Int32(1),
expectedMaxReplicas: pointer.Int32(1),
},
},
{
@@ -116,19 +117,19 @@ func TestSetElasticPolicy(t *testing.T) {
Spec: PyTorchJobSpec{
ElasticPolicy: &ElasticPolicy{
MaxReplicas: nil,
MinReplicas: int32Ptr(1),
MinReplicas: pointer.Int32(1),
},
PyTorchReplicaSpecs: map[v1.ReplicaType]*v1.ReplicaSpec{
PyTorchReplicaTypeWorker: {
Replicas: int32Ptr(1),
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
PyTorchJobReplicaTypeWorker: {
Replicas: pointer.Int32(1),
},
},
},
},
},
result: result{
expectedMinReplicas: int32Ptr(1),
expectedMaxReplicas: int32Ptr(1),
expectedMinReplicas: pointer.Int32(1),
expectedMaxReplicas: pointer.Int32(1),
},
},
}
@@ -153,8 +154,3 @@ func TestSetElasticPolicy(t *testing.T) {
})
}
}
func int32Ptr(n int) *int32 {
val := int32(n)
return &val
}
@@ -15,11 +15,35 @@
package v1
import (
common "github.com/kubeflow/common/pkg/apis/common/v1"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// PytorchJobDefaultPortName is name of the port used to communicate between Master and
// workers.
PytorchJobDefaultPortName = "pytorchjob-port"
// PytorchJobDefaultContainerName is the name of the PyTorchJob container.
PytorchJobDefaultContainerName = "pytorch"
// PytorchJobDefaultPort is default value of the port.
PytorchJobDefaultPort = 23456
// PytorchJobDefaultRestartPolicy is default RestartPolicy for PyTorchReplicaSpec.
PytorchJobDefaultRestartPolicy = commonv1.RestartPolicyOnFailure
// PytorchJobKind is the kind name.
PytorchJobKind = "PyTorchJob"
// PytorchJobPlural is the PytorchPlural for pytorchJob.
PytorchJobPlural = "pytorchjobs"
// PytorchJobSingular is the singular for pytorchJob.
PytorchJobSingular = "pytorchjob"
// PytorchJobFrameworkName is the name of the ML Framework
PytorchJobFrameworkName = "pytorch"
// PyTorchJobReplicaTypeMaster is the type of Master of distributed PyTorch
PyTorchJobReplicaTypeMaster commonv1.ReplicaType = "Master"
// PyTorchJobReplicaTypeWorker is the type for workers of distributed PyTorch.
PyTorchJobReplicaTypeWorker commonv1.ReplicaType = "Worker"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resource:path=pytorchjob
@@ -41,7 +65,7 @@ type PyTorchJob struct {
// Most recently observed status of the PyTorchJob.
// Read-only (modified by the system).
Status common.JobStatus `json:"status,omitempty"`
Status commonv1.JobStatus `json:"status,omitempty"`
}
// PyTorchJobSpec is a desired state description of the PyTorchJob.
@@ -50,7 +74,7 @@ type PyTorchJobSpec struct {
// job, for example how to clean up resources and how long the job can stay
// active.
//+kubebuilder:validation:Optional
RunPolicy common.RunPolicy `json:"runPolicy"`
RunPolicy commonv1.RunPolicy `json:"runPolicy"`
ElasticPolicy *ElasticPolicy `json:"elasticPolicy,omitempty"`
@@ -60,7 +84,7 @@ type PyTorchJobSpec struct {
// "Master": PyTorchReplicaSpec,
// "Worker": PyTorchReplicaSpec,
// }
PyTorchReplicaSpecs map[common.ReplicaType]*common.ReplicaSpec `json:"pytorchReplicaSpecs"`
PyTorchReplicaSpecs map[commonv1.ReplicaType]*commonv1.ReplicaSpec `json:"pytorchReplicaSpecs"`
}
type ElasticPolicy struct {
@@ -114,11 +138,6 @@ const (
BackendETCD RDZVBackend = "etcd"
// BackendETCDV2 is the rendezvous backend type for ETCD v2.
BackendETCDV2 RDZVBackend = "etcd-v2"
// PyTorchReplicaTypeMaster is the type of Master of distributed PyTorch
PyTorchReplicaTypeMaster common.ReplicaType = "Master"
// PyTorchReplicaTypeWorker is the type for workers of distributed PyTorch.
PyTorchReplicaTypeWorker common.ReplicaType = "Worker"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -139,5 +158,5 @@ type PyTorchJobList struct {
func init() {
SchemeBuilder.Register(&PyTorchJob{}, &PyTorchJobList{})
SchemeBuilder.SchemeBuilder.Register(addDefaultingFuncs)
SchemeBuilder.SchemeBuilder.Register(addPytorchDefaultingFuncs)
}
@@ -12,17 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"fmt"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
torchv1 "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1"
)
func ValidateV1PyTorchJobSpec(c *torchv1.PyTorchJobSpec) error {
func ValidateV1PyTorchJobSpec(c *PyTorchJobSpec) error {
if c.PyTorchReplicaSpecs == nil {
return fmt.Errorf("PyTorchJobSpec is not valid")
}
@@ -31,7 +29,7 @@ func ValidateV1PyTorchJobSpec(c *torchv1.PyTorchJobSpec) error {
return fmt.Errorf("PyTorchJobSpec is not valid: containers definition expected in %v", rType)
}
// Make sure the replica type is valid.
validReplicaTypes := []commonv1.ReplicaType{torchv1.PyTorchReplicaTypeMaster, torchv1.PyTorchReplicaTypeWorker}
validReplicaTypes := []commonv1.ReplicaType{PyTorchJobReplicaTypeMaster, PyTorchJobReplicaTypeWorker}
isValidReplicaType := false
for _, t := range validReplicaTypes {
@@ -52,16 +50,16 @@ func ValidateV1PyTorchJobSpec(c *torchv1.PyTorchJobSpec) error {
msg := fmt.Sprintf("PyTorchJobSpec is not valid: Image is undefined in the container of %v", rType)
return fmt.Errorf(msg)
}
if container.Name == torchv1.DefaultContainerName {
if container.Name == PytorchJobDefaultContainerName {
defaultContainerPresent = true
}
}
//Make sure there has at least one container named "pytorch"
if !defaultContainerPresent {
msg := fmt.Sprintf("PyTorchJobSpec is not valid: There is no container named %s in %v", torchv1.DefaultContainerName, rType)
msg := fmt.Sprintf("PyTorchJobSpec is not valid: There is no container named %s in %v", PytorchJobDefaultContainerName, rType)
return fmt.Errorf(msg)
}
if rType == torchv1.PyTorchReplicaTypeMaster {
if rType == PyTorchJobReplicaTypeMaster {
if value.Replicas != nil && int(*value.Replicas) != 1 {
return fmt.Errorf("PyTorchJobSpec is not valid: There must be only 1 master replica")
}
@@ -12,25 +12,24 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"k8s.io/utils/pointer"
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
torchv1 "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1"
v1 "k8s.io/api/core/v1"
)
func TestValidateV1PyTorchJobSpec(t *testing.T) {
testCases := []torchv1.PyTorchJobSpec{
testCases := []PyTorchJobSpec{
{
PyTorchReplicaSpecs: nil,
},
{
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
torchv1.PyTorchReplicaTypeWorker: {
PyTorchJobReplicaTypeWorker: {
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
@@ -41,7 +40,7 @@ func TestValidateV1PyTorchJobSpec(t *testing.T) {
},
{
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
torchv1.PyTorchReplicaTypeWorker: {
PyTorchJobReplicaTypeWorker: {
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
@@ -56,7 +55,7 @@ func TestValidateV1PyTorchJobSpec(t *testing.T) {
},
{
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
torchv1.PyTorchReplicaTypeWorker: {
PyTorchJobReplicaTypeWorker: {
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
@@ -72,8 +71,8 @@ func TestValidateV1PyTorchJobSpec(t *testing.T) {
},
{
PyTorchReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
torchv1.PyTorchReplicaTypeMaster: {
Replicas: torchv1.Int32(2),
PyTorchJobReplicaTypeMaster: {
Replicas: pointer.Int32(2),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
@@ -0,0 +1,75 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
// addTensorflowDefaultingFuncs is used to register default funcs
func addTensorflowDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setTensorflowDefaultPort sets the default ports for tensorflow container.
func setTensorflowDefaultPort(spec *corev1.PodSpec) {
index := getDefaultContainerIndex(spec, TFJobDefaultContainerName)
if ok := hasDefaultPort(spec, index, TFJobDefaultPortName); !ok {
setDefaultPort(spec, TFJobDefaultPortName, TFJobDefaultPort, index)
}
}
// setTensorflowTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setTensorflowTypeNamesToCamelCase(tfJob *TFJob) {
replicaTypes := []commonv1.ReplicaType{
TFJobReplicaTypePS,
TFJobReplicaTypeWorker,
TFJobReplicaTypeChief,
TFJobReplicaTypeMaster,
TFJobReplicaTypeEval,
}
for _, replicaType := range replicaTypes {
setTypeNameToCamelCase(tfJob.Spec.TFReplicaSpecs, replicaType)
}
}
// SetDefaults_TFJob sets any unspecified values to defaults.
func SetDefaults_TFJob(tfJob *TFJob) {
// Set default cleanpod policy to Running.
if tfJob.Spec.RunPolicy.CleanPodPolicy == nil {
running := commonv1.CleanPodPolicyRunning
tfJob.Spec.RunPolicy.CleanPodPolicy = &running
}
// Set default success policy to "".
if tfJob.Spec.SuccessPolicy == nil {
defaultPolicy := SuccessPolicyDefault
tfJob.Spec.SuccessPolicy = &defaultPolicy
}
// Update the key of TFReplicaSpecs to camel case.
setTensorflowTypeNamesToCamelCase(tfJob)
for _, spec := range tfJob.Spec.TFReplicaSpecs {
// Set default replicas to 1.
setDefaultReplicas(spec, 1)
// Set default restartPolicy
setDefaultRestartPolicy(spec, TFJobDefaultRestartPolicy)
// Set default port to tensorFlow container.
setTensorflowDefaultPort(&spec.Template.Spec)
}
}
@@ -18,23 +18,20 @@ import (
"reflect"
"testing"
v1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"github.com/kubeflow/common/pkg/util"
)
const (
testImage = "test-image:latest"
)
func expectedTFJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy commonv1.RestartPolicy, portName string, port int32) *TFJob {
ports := []v1.ContainerPort{}
var ports []corev1.ContainerPort
// port not set
if portName != "" {
ports = append(ports,
v1.ContainerPort{
corev1.ContainerPort{
Name: portName,
ContainerPort: port,
},
@@ -42,11 +39,11 @@ func expectedTFJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy commonv
}
// port set with custom name
if portName != DefaultPortName {
if portName != TFJobDefaultPortName {
ports = append(ports,
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
corev1.ContainerPort{
Name: TFJobDefaultPortName,
ContainerPort: TFJobDefaultPort,
},
)
}
@@ -60,14 +57,14 @@ func expectedTFJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy commonv
CleanPodPolicy: &cleanPodPolicy,
},
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(1),
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(1),
RestartPolicy: restartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
Ports: ports,
},
@@ -83,16 +80,16 @@ func expectedTFJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy commonv
func TestSetTypeNames(t *testing.T) {
spec := &commonv1.ReplicaSpec{
RestartPolicy: commonv1.RestartPolicyAlways,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: TFJobDefaultPortName,
ContainerPort: TFJobDefaultPort,
},
},
},
@@ -110,12 +107,12 @@ func TestSetTypeNames(t *testing.T) {
},
}
setTypeNamesToCamelCase(original)
setTensorflowTypeNamesToCamelCase(original)
if _, ok := original.Spec.TFReplicaSpecs[workerUpperCase]; ok {
t.Errorf("Failed to delete key %s", workerUpperCase)
}
if _, ok := original.Spec.TFReplicaSpecs[TFReplicaTypeWorker]; !ok {
t.Errorf("Failed to set key %s", TFReplicaTypeWorker)
if _, ok := original.Spec.TFReplicaSpecs[TFJobReplicaTypeWorker]; !ok {
t.Errorf("Failed to set key %s", TFJobReplicaTypeWorker)
}
}
@@ -132,18 +129,18 @@ func TestSetDefaultTFJob(t *testing.T) {
original: &TFJob{
Spec: TFJobSpec{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
TFReplicaTypeWorker: &commonv1.ReplicaSpec{
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
RestartPolicy: customRestartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
Ports: []corev1.ContainerPort{
{
Name: TFJobDefaultPortName,
ContainerPort: TFJobDefaultPort,
},
},
},
@@ -154,23 +151,23 @@ func TestSetDefaultTFJob(t *testing.T) {
},
},
},
expected: expectedTFJob(commonv1.CleanPodPolicyRunning, customRestartPolicy, DefaultPortName, DefaultPort),
expected: expectedTFJob(commonv1.CleanPodPolicyRunning, customRestartPolicy, TFJobDefaultPortName, TFJobDefaultPort),
},
"set replicas with default restartpolicy": {
original: &TFJob{
Spec: TFJobSpec{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: TFJobDefaultPortName,
ContainerPort: TFJobDefaultPort,
},
},
},
@@ -181,20 +178,20 @@ func TestSetDefaultTFJob(t *testing.T) {
},
},
},
expected: expectedTFJob(commonv1.CleanPodPolicyRunning, DefaultRestartPolicy, DefaultPortName, DefaultPort),
expected: expectedTFJob(commonv1.CleanPodPolicyRunning, TFJobDefaultRestartPolicy, TFJobDefaultPortName, TFJobDefaultPort),
},
"set replicas with default port": {
original: &TFJob{
Spec: TFJobSpec{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(1),
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(1),
RestartPolicy: customRestartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
},
},
@@ -210,17 +207,17 @@ func TestSetDefaultTFJob(t *testing.T) {
original: &TFJob{
Spec: TFJobSpec{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(1),
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(1),
RestartPolicy: customRestartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: customPortName,
ContainerPort: customPort,
},
@@ -242,17 +239,17 @@ func TestSetDefaultTFJob(t *testing.T) {
CleanPodPolicy: cleanPodPolicyPointer(commonv1.CleanPodPolicyAll),
},
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(1),
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(1),
RestartPolicy: customRestartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: TFJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: customPortName,
ContainerPort: customPort,
},
@@ -19,6 +19,26 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// TFJobDefaultPortName is name of the port used to communicate between PS and
// workers.
TFJobDefaultPortName = "tfjob-port"
// TFJobDefaultContainerName is the name of the TFJob container.
TFJobDefaultContainerName = "tensorflow"
// TFJobDefaultPort is default value of the port.
TFJobDefaultPort = 2222
// TFJobDefaultRestartPolicy is default RestartPolicy for TFReplicaSpec.
TFJobDefaultRestartPolicy = commonv1.RestartPolicyNever
// TFJobKind is the kind name.
TFJobKind = "TFJob"
// TFJobPlural is the TensorflowPlural for TFJob.
TFJObPlural = "tfjobs"
// TFJobSingular is the singular for TFJob.
TFJobSingular = "tfjob"
// TFJobFrameworkName is the name of the ML Framework
TFJobFrameworkName = "tensorflow"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resource:path=tfjob
@@ -71,28 +91,36 @@ type TFJobSpec struct {
EnableDynamicWorker bool `json:"enableDynamicWorker,omitempty"`
}
// SuccessPolicy is the success policy.
type SuccessPolicy string
const (
SuccessPolicyDefault SuccessPolicy = ""
SuccessPolicyAllWorkers SuccessPolicy = "AllWorkers"
)
// TFReplicaType is the type for TFReplica. Can be one of: "Chief"/"Master" (semantically equivalent),
// "Worker", "PS", or "Evaluator".
const (
// TFReplicaTypePS is the type for parameter servers of distributed TensorFlow.
TFReplicaTypePS commonv1.ReplicaType = "PS"
// TFJobReplicaTypePS is the type for parameter servers of distributed TensorFlow.
TFJobReplicaTypePS commonv1.ReplicaType = "PS"
// TFReplicaTypeWorker is the type for workers of distributed TensorFlow.
// TFJobReplicaTypeWorker is the type for workers of distributed TensorFlow.
// This is also used for non-distributed TensorFlow.
TFReplicaTypeWorker commonv1.ReplicaType = "Worker"
TFJobReplicaTypeWorker commonv1.ReplicaType = "Worker"
// TFReplicaTypeChief is the type for chief worker of distributed TensorFlow.
// TFJobReplicaTypeChief is the type for chief worker of distributed TensorFlow.
// If there is "chief" replica type, it's the "chief worker".
// Else, worker:0 is the chief worker.
TFReplicaTypeChief commonv1.ReplicaType = "Chief"
TFJobReplicaTypeChief commonv1.ReplicaType = "Chief"
// TFReplicaTypeMaster is the type for master worker of distributed TensorFlow.
// TFJobReplicaTypeMaster is the type for master worker of distributed TensorFlow.
// This is similar to chief, and kept just for backwards compatibility.
TFReplicaTypeMaster commonv1.ReplicaType = "Master"
TFJobReplicaTypeMaster commonv1.ReplicaType = "Master"
// TFReplicaTypeEval is the type for evaluation replica in TensorFlow.
TFReplicaTypeEval commonv1.ReplicaType = "Evaluator"
// TFJobReplicaTypeEval is the type for evaluation replica in TensorFlow.
TFJobReplicaTypeEval commonv1.ReplicaType = "Evaluator"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -114,5 +142,5 @@ type TFJobList struct {
func init() {
SchemeBuilder.Register(&TFJob{}, &TFJobList{})
SchemeBuilder.SchemeBuilder.Register(addDefaultingFuncs)
SchemeBuilder.SchemeBuilder.Register(addTensorflowDefaultingFuncs)
}
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"fmt"
@@ -20,11 +20,25 @@ import (
log "github.com/sirupsen/logrus"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
tfv1 "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1"
)
// IsChieforMaster returns true if the type is Master or Chief.
func IsChieforMaster(typ commonv1.ReplicaType) bool {
return typ == TFJobReplicaTypeChief || typ == TFJobReplicaTypeMaster
}
// IsWorker returns true if the type is Worker.
func IsWorker(typ commonv1.ReplicaType) bool {
return typ == TFJobReplicaTypeWorker
}
// IsEvaluator returns true if the type is Evaluator.
func IsEvaluator(typ commonv1.ReplicaType) bool {
return typ == TFJobReplicaTypeEval
}
// ValidateV1TFJobSpec checks that the v1.TFJobSpec is valid.
func ValidateV1TFJobSpec(c *tfv1.TFJobSpec) error {
func ValidateV1TFJobSpec(c *TFJobSpec) error {
return validateV1ReplicaSpecs(c.TFReplicaSpecs)
}
@@ -37,7 +51,7 @@ func validateV1ReplicaSpecs(specs map[commonv1.ReplicaType]*commonv1.ReplicaSpec
if value == nil || len(value.Template.Spec.Containers) == 0 {
return fmt.Errorf("TFJobSpec is not valid: containers definition expected in %v", rType)
}
if tfv1.IsChieforMaster(rType) {
if IsChieforMaster(rType) {
foundChief++
}
// Make sure the image is defined in the container.
@@ -48,13 +62,13 @@ func validateV1ReplicaSpecs(specs map[commonv1.ReplicaType]*commonv1.ReplicaSpec
log.Error(msg)
return fmt.Errorf(msg)
}
if container.Name == tfv1.DefaultContainerName {
if container.Name == TFJobDefaultContainerName {
numNamedTensorflow++
}
}
// Make sure there has at least one container named "tensorflow".
if numNamedTensorflow == 0 {
msg := fmt.Sprintf("TFJobSpec is not valid: There is no container named %s in %v", tfv1.DefaultContainerName, rType)
msg := fmt.Sprintf("TFJobSpec is not valid: There is no container named %s in %v", TFJobDefaultContainerName, rType)
log.Error(msg)
return fmt.Errorf(msg)
}
@@ -12,28 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
tfv1 "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1"
v1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
)
func TestValidateV1TFJobSpec(t *testing.T) {
testCases := []tfv1.TFJobSpec{
testCases := []TFJobSpec{
{
TFReplicaSpecs: nil,
},
{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
tfv1.TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{},
},
},
},
@@ -41,11 +39,11 @@ func TestValidateV1TFJobSpec(t *testing.T) {
},
{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
tfv1.TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Image: "",
},
},
@@ -56,11 +54,11 @@ func TestValidateV1TFJobSpec(t *testing.T) {
},
{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
tfv1.TFReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
TFJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: "",
Image: "kubeflow/tf-dist-mnist-test:1.0",
},
@@ -72,17 +70,17 @@ func TestValidateV1TFJobSpec(t *testing.T) {
},
{
TFReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
tfv1.TFReplicaTypeChief: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
TFJobReplicaTypeChief: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{},
},
},
},
tfv1.TFReplicaTypeMaster: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
TFJobReplicaTypeMaster: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{},
},
},
},
@@ -96,3 +94,30 @@ func TestValidateV1TFJobSpec(t *testing.T) {
}
}
}
func TestIsChieforMaster(t *testing.T) {
tc := []struct {
Type commonv1.ReplicaType
Expected bool
}{
{
Type: TFJobReplicaTypeChief,
Expected: true,
},
{
Type: TFJobReplicaTypeMaster,
Expected: true,
},
{
Type: TFJobReplicaTypeWorker,
Expected: false,
},
}
for _, c := range tc {
actual := IsChieforMaster(c.Type)
if actual != c.Expected {
t.Errorf("Expected %v; Got %v", c.Expected, actual)
}
}
}
@@ -0,0 +1,25 @@
package v1
import (
"encoding/json"
"fmt"
log "github.com/sirupsen/logrus"
)
const (
testImage = "test-image:latest"
)
// pformat returns a pretty format output of any value that can be marshaled to JSON.
func pformat(value interface{}) string {
if s, ok := value.(string); ok {
return s
}
valueJSON, err := json.MarshalIndent(value, "", " ")
if err != nil {
log.Warningf("Couldn't pretty format %v, error: %v", value, err)
return fmt.Sprintf("%v", value)
}
return string(valueJSON)
}
@@ -0,0 +1,66 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
func addXGBoostJobDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setXGBoostJobDefaultPort sets the default ports for mxnet container.
func setXGBoostJobDefaultPort(spec *corev1.PodSpec) {
index := getDefaultContainerIndex(spec, XGBoostJobDefaultContainerName)
if ok := hasDefaultPort(spec, index, XGBoostJobDefaultPortName); !ok {
setDefaultPort(spec, XGBoostJobDefaultPortName, XGBoostJobDefaultPort, index)
}
}
// setXGBoostJobTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setXGBoostJobTypeNamesToCamelCase(xgboostJob *XGBoostJob) {
replicaTypes := []commonv1.ReplicaType{
XGBoostJobReplicaTypeMaster,
XGBoostJobReplicaTypeWorker,
}
for _, replicaType := range replicaTypes {
setTypeNameToCamelCase(xgboostJob.Spec.XGBReplicaSpecs, replicaType)
}
}
// SetDefaults_XGBoostJob sets any unspecified values to defaults.
func SetDefaults_XGBoostJob(xgboostJob *XGBoostJob) {
// Set default cleanpod policy to All.
if xgboostJob.Spec.RunPolicy.CleanPodPolicy == nil {
all := commonv1.CleanPodPolicyAll
xgboostJob.Spec.RunPolicy.CleanPodPolicy = &all
}
// Update the key of MXReplicaSpecs to camel case.
setXGBoostJobTypeNamesToCamelCase(xgboostJob)
for _, spec := range xgboostJob.Spec.XGBReplicaSpecs {
// Set default replicas to 1.
setDefaultReplicas(spec, 1)
// Set default restartPolicy
setDefaultRestartPolicy(spec, XGBoostJobDefaultRestartPolicy)
// Set default port to mxnet container.
setXGBoostJobDefaultPort(&spec.Template.Spec)
}
}
@@ -15,27 +15,21 @@
package v1
import (
"encoding/json"
"fmt"
"reflect"
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
log "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
)
const (
testImage = "test-image:latest"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
)
func expectedXGBoostJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy commonv1.RestartPolicy, replicas int32, portName string, port int32) *XGBoostJob {
ports := []v1.ContainerPort{}
var ports []corev1.ContainerPort
// port not set
if portName != "" {
ports = append(ports,
v1.ContainerPort{
corev1.ContainerPort{
Name: portName,
ContainerPort: port,
},
@@ -43,11 +37,11 @@ func expectedXGBoostJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy co
}
// port set with custom name
if portName != DefaultPortName {
if portName != XGBoostJobDefaultPortName {
ports = append(ports,
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
corev1.ContainerPort{
Name: XGBoostJobDefaultPortName,
ContainerPort: XGBoostJobDefaultPort,
},
)
}
@@ -58,14 +52,14 @@ func expectedXGBoostJob(cleanPodPolicy commonv1.CleanPodPolicy, restartPolicy co
CleanPodPolicy: &cleanPodPolicy,
},
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(replicas),
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(replicas),
RestartPolicy: restartPolicy,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: XGBoostJobDefaultContainerName,
Image: testImage,
Ports: ports,
},
@@ -87,12 +81,12 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
original: &XGBoostJob{
Spec: XGBoostJobSpec{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: XGBoostJobDefaultContainerName,
Image: testImage,
},
},
@@ -102,19 +96,19 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
},
},
},
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 1, DefaultPortName, DefaultPort),
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, XGBoostJobDefaultRestartPolicy, 1, XGBoostJobDefaultPortName, XGBoostJobDefaultPort),
},
"Set spec with restart policy": {
original: &XGBoostJob{
Spec: XGBoostJobSpec{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
RestartPolicy: commonv1.RestartPolicyOnFailure,
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: XGBoostJobDefaultContainerName,
Image: testImage,
},
},
@@ -124,19 +118,19 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
},
},
},
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, commonv1.RestartPolicyOnFailure, 1, DefaultPortName, DefaultPort),
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, commonv1.RestartPolicyOnFailure, 1, XGBoostJobDefaultPortName, XGBoostJobDefaultPort),
},
"Set spec with replicas": {
original: &XGBoostJob{
Spec: XGBoostJobSpec{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: Int32(3),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(3),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: XGBoostJobDefaultContainerName,
Image: testImage,
},
},
@@ -146,24 +140,24 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
},
},
},
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 3, DefaultPortName, DefaultPort),
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, XGBoostJobDefaultRestartPolicy, 3, XGBoostJobDefaultPortName, XGBoostJobDefaultPort),
},
"Set spec with default node port name and port": {
original: &XGBoostJob{
Spec: XGBoostJobSpec{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: XGBoostJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: XGBoostJobDefaultPortName,
ContainerPort: XGBoostJobDefaultPort,
},
},
},
@@ -174,23 +168,23 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
},
},
},
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 1, DefaultPortName, DefaultPort),
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, XGBoostJobDefaultRestartPolicy, 1, XGBoostJobDefaultPortName, XGBoostJobDefaultPort),
},
"Set spec with node port": {
original: &XGBoostJob{
Spec: XGBoostJobSpec{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
Name: DefaultContainerName,
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: XGBoostJobDefaultContainerName,
Image: testImage,
Ports: []v1.ContainerPort{
v1.ContainerPort{
Name: DefaultPortName,
Ports: []corev1.ContainerPort{
corev1.ContainerPort{
Name: XGBoostJobDefaultPortName,
ContainerPort: 9999,
},
},
@@ -202,7 +196,7 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
},
},
},
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, DefaultRestartPolicy, 1, DefaultPortName, 9999),
expected: expectedXGBoostJob(commonv1.CleanPodPolicyAll, XGBoostJobDefaultRestartPolicy, 1, XGBoostJobDefaultPortName, 9999),
},
}
@@ -214,16 +208,3 @@ func TestSetDefaults_XGBoostJob(t *testing.T) {
}
}
// pformat returns a pretty format output of any value that can be marshaled to JSON.
func pformat(value interface{}) string {
if s, ok := value.(string); ok {
return s
}
valueJSON, err := json.MarshalIndent(value, "", " ")
if err != nil {
log.Warningf("Couldn't pretty format %v, error: %v", value, err)
return fmt.Sprintf("%v", value)
}
return string(valueJSON)
}
@@ -22,6 +22,29 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
const (
// XGBoostJobDefaultPortName is name of the port used to communicate between Master and Workers.
XGBoostJobDefaultPortName = "xgboostjob-port"
// XGBoostJobDefaultContainerName is the name of the XGBoostJob container.
XGBoostJobDefaultContainerName = "xgboost"
// XGBoostJobDefaultPort is default value of the port.
XGBoostJobDefaultPort = 9999
// XGBoostJobDefaultRestartPolicy is default RestartPolicy for XGBReplicaSpecs.
XGBoostJobDefaultRestartPolicy = commonv1.RestartPolicyNever
// XGBoostJobKind is the kind name.
XGBoostJobKind = "XGBoostJob"
// XGBoostJobPlural is the XGBoostJobPlural for XGBoostJob.
XGBoostJobPlural = "xgboostjobs"
// XGBoostJobSingular is the singular for XGBoostJob.
XGBoostJobSingular = "xgboostjob"
// XGBoostJobFrameworkName is the name of the ML Framework
XGBoostJobFrameworkName = "xgboost"
// XGBoostJobReplicaTypeMaster is the type for master replica.
XGBoostJobReplicaTypeMaster commonv1.ReplicaType = "Master"
// XGBoostJobReplicaTypeWorker is the type for worker replicas.
XGBoostJobReplicaTypeWorker commonv1.ReplicaType = "Worker"
)
// XGBoostJobSpec defines the desired state of XGBoostJob
type XGBoostJobSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
@@ -59,15 +82,7 @@ type XGBoostJobList struct {
Items []XGBoostJob `json:"items"`
}
const (
// XGBoostReplicaTypeMaster is the type for master replica.
XGBoostReplicaTypeMaster commonv1.ReplicaType = "Master"
// XGBoostReplicaTypeWorker is the type for worker replicas.
XGBoostReplicaTypeWorker commonv1.ReplicaType = "Worker"
)
func init() {
SchemeBuilder.Register(&XGBoostJob{}, &XGBoostJobList{})
SchemeBuilder.SchemeBuilder.Register(addDefaultingFuncs)
SchemeBuilder.SchemeBuilder.Register(addXGBoostJobDefaultingFuncs)
}
@@ -12,17 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"fmt"
xgboostv1 "github.com/kubeflow/training-operator/pkg/apis/xgboost/v1"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
func ValidateV1XGBoostJobSpec(c *xgboostv1.XGBoostJobSpec) error {
func ValidateXGBoostJobSpec(c *XGBoostJobSpec) error {
if c.XGBReplicaSpecs == nil {
return fmt.Errorf("XGBoostJobSpec is not valid")
}
@@ -32,7 +30,7 @@ func ValidateV1XGBoostJobSpec(c *xgboostv1.XGBoostJobSpec) error {
return fmt.Errorf("XGBoostJobSpec is not valid: containers definition expected in %v", rType)
}
// Make sure the replica type is valid.
validReplicaTypes := []commonv1.ReplicaType{xgboostv1.XGBoostReplicaTypeMaster, xgboostv1.XGBoostReplicaTypeWorker}
validReplicaTypes := []commonv1.ReplicaType{XGBoostJobReplicaTypeMaster, XGBoostJobReplicaTypeWorker}
isValidReplicaType := false
for _, t := range validReplicaTypes {
@@ -53,16 +51,16 @@ func ValidateV1XGBoostJobSpec(c *xgboostv1.XGBoostJobSpec) error {
msg := fmt.Sprintf("XGBoostReplicaType is not valid: Image is undefined in the container of %v", rType)
return fmt.Errorf(msg)
}
if container.Name == xgboostv1.DefaultContainerName {
if container.Name == XGBoostJobDefaultContainerName {
defaultContainerPresent = true
}
}
//Make sure there has at least one container named "xgboost"
if !defaultContainerPresent {
msg := fmt.Sprintf("XGBoostReplicaType is not valid: There is no container named %s in %v", xgboostv1.DefaultContainerName, rType)
msg := fmt.Sprintf("XGBoostReplicaType is not valid: There is no container named %s in %v", XGBoostJobDefaultContainerName, rType)
return fmt.Errorf(msg)
}
if rType == xgboostv1.XGBoostReplicaTypeMaster {
if rType == XGBoostJobReplicaTypeMaster {
masterExists = true
if value.Replicas != nil && int(*value.Replicas) != 1 {
return fmt.Errorf("XGBoostReplicaType is not valid: There must be only 1 master replica")
@@ -12,28 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package validation
package v1
import (
"k8s.io/utils/pointer"
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
xgboostv1 "github.com/kubeflow/training-operator/pkg/apis/xgboost/v1"
v1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
)
func TestValidateV1XGBoostJobSpec(t *testing.T) {
testCases := []xgboostv1.XGBoostJobSpec{
func TestValidateXGBoostJobSpec(t *testing.T) {
testCases := []XGBoostJobSpec{
{
XGBReplicaSpecs: nil,
},
{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
xgboostv1.XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{},
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{},
},
},
},
@@ -41,11 +40,11 @@ func TestValidateV1XGBoostJobSpec(t *testing.T) {
},
{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
xgboostv1.XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Image: "",
},
},
@@ -56,11 +55,11 @@ func TestValidateV1XGBoostJobSpec(t *testing.T) {
},
{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
xgboostv1.XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: "",
Image: "gcr.io/kubeflow-ci/xgboost-dist-mnist_test:1.0",
},
@@ -72,12 +71,12 @@ func TestValidateV1XGBoostJobSpec(t *testing.T) {
},
{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
xgboostv1.XGBoostReplicaTypeMaster: &commonv1.ReplicaSpec{
Replicas: xgboostv1.Int32(2),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
XGBoostJobReplicaTypeMaster: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(2),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: "xgboost",
Image: "gcr.io/kubeflow-ci/xgboost-dist-mnist_test:1.0",
},
@@ -89,12 +88,12 @@ func TestValidateV1XGBoostJobSpec(t *testing.T) {
},
{
XGBReplicaSpecs: map[commonv1.ReplicaType]*commonv1.ReplicaSpec{
xgboostv1.XGBoostReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: xgboostv1.Int32(1),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
v1.Container{
XGBoostJobReplicaTypeWorker: &commonv1.ReplicaSpec{
Replicas: pointer.Int32(1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
Name: "xgboost",
Image: "gcr.io/kubeflow-ci/xgboost-dist-mnist_test:1.0",
},
@@ -106,9 +105,9 @@ func TestValidateV1XGBoostJobSpec(t *testing.T) {
},
}
for _, c := range testCases {
err := ValidateV1XGBoostJobSpec(&c)
err := ValidateXGBoostJobSpec(&c)
if err == nil {
t.Error("Failed validate the v1.XGBoostJobSpec")
t.Error("Failed validate the corev1.XGBoostJobSpec")
}
}
}
@@ -0,0 +1,598 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/api/autoscaling/v2beta2"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ElasticPolicy) DeepCopyInto(out *ElasticPolicy) {
*out = *in
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32)
**out = **in
}
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(int32)
**out = **in
}
if in.RDZVBackend != nil {
in, out := &in.RDZVBackend, &out.RDZVBackend
*out = new(RDZVBackend)
**out = **in
}
if in.RDZVPort != nil {
in, out := &in.RDZVPort, &out.RDZVPort
*out = new(int32)
**out = **in
}
if in.RDZVHost != nil {
in, out := &in.RDZVHost, &out.RDZVHost
*out = new(string)
**out = **in
}
if in.RDZVID != nil {
in, out := &in.RDZVID, &out.RDZVID
*out = new(string)
**out = **in
}
if in.RDZVConf != nil {
in, out := &in.RDZVConf, &out.RDZVConf
*out = make([]RDZVConf, len(*in))
copy(*out, *in)
}
if in.Standalone != nil {
in, out := &in.Standalone, &out.Standalone
*out = new(bool)
**out = **in
}
if in.NProcPerNode != nil {
in, out := &in.NProcPerNode, &out.NProcPerNode
*out = new(int32)
**out = **in
}
if in.MaxRestarts != nil {
in, out := &in.MaxRestarts, &out.MaxRestarts
*out = new(int32)
**out = **in
}
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]v2beta2.MetricSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticPolicy.
func (in *ElasticPolicy) DeepCopy() *ElasticPolicy {
if in == nil {
return nil
}
out := new(ElasticPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MPIJob) DeepCopyInto(out *MPIJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIJob.
func (in *MPIJob) DeepCopy() *MPIJob {
if in == nil {
return nil
}
out := new(MPIJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MPIJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MPIJobList) DeepCopyInto(out *MPIJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]MPIJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIJobList.
func (in *MPIJobList) DeepCopy() *MPIJobList {
if in == nil {
return nil
}
out := new(MPIJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MPIJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MPIJobSpec) DeepCopyInto(out *MPIJobSpec) {
*out = *in
if in.SlotsPerWorker != nil {
in, out := &in.SlotsPerWorker, &out.SlotsPerWorker
*out = new(int32)
**out = **in
}
if in.CleanPodPolicy != nil {
in, out := &in.CleanPodPolicy, &out.CleanPodPolicy
*out = new(commonv1.CleanPodPolicy)
**out = **in
}
if in.MPIReplicaSpecs != nil {
in, out := &in.MPIReplicaSpecs, &out.MPIReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIJobSpec.
func (in *MPIJobSpec) DeepCopy() *MPIJobSpec {
if in == nil {
return nil
}
out := new(MPIJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJob) DeepCopyInto(out *MXJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJob.
func (in *MXJob) DeepCopy() *MXJob {
if in == nil {
return nil
}
out := new(MXJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MXJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJobList) DeepCopyInto(out *MXJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]MXJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJobList.
func (in *MXJobList) DeepCopy() *MXJobList {
if in == nil {
return nil
}
out := new(MXJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MXJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJobSpec) DeepCopyInto(out *MXJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.MXReplicaSpecs != nil {
in, out := &in.MXReplicaSpecs, &out.MXReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJobSpec.
func (in *MXJobSpec) DeepCopy() *MXJobSpec {
if in == nil {
return nil
}
out := new(MXJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJobStatus) DeepCopyInto(out *MXJobStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJobStatus.
func (in *MXJobStatus) DeepCopy() *MXJobStatus {
if in == nil {
return nil
}
out := new(MXJobStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PyTorchJob) DeepCopyInto(out *PyTorchJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PyTorchJob.
func (in *PyTorchJob) DeepCopy() *PyTorchJob {
if in == nil {
return nil
}
out := new(PyTorchJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PyTorchJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PyTorchJobList) DeepCopyInto(out *PyTorchJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PyTorchJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PyTorchJobList.
func (in *PyTorchJobList) DeepCopy() *PyTorchJobList {
if in == nil {
return nil
}
out := new(PyTorchJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PyTorchJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PyTorchJobSpec) DeepCopyInto(out *PyTorchJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.ElasticPolicy != nil {
in, out := &in.ElasticPolicy, &out.ElasticPolicy
*out = new(ElasticPolicy)
(*in).DeepCopyInto(*out)
}
if in.PyTorchReplicaSpecs != nil {
in, out := &in.PyTorchReplicaSpecs, &out.PyTorchReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PyTorchJobSpec.
func (in *PyTorchJobSpec) DeepCopy() *PyTorchJobSpec {
if in == nil {
return nil
}
out := new(PyTorchJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RDZVConf) DeepCopyInto(out *RDZVConf) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RDZVConf.
func (in *RDZVConf) DeepCopy() *RDZVConf {
if in == nil {
return nil
}
out := new(RDZVConf)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TFJob) DeepCopyInto(out *TFJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TFJob.
func (in *TFJob) DeepCopy() *TFJob {
if in == nil {
return nil
}
out := new(TFJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TFJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TFJobList) DeepCopyInto(out *TFJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]TFJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TFJobList.
func (in *TFJobList) DeepCopy() *TFJobList {
if in == nil {
return nil
}
out := new(TFJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TFJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TFJobSpec) DeepCopyInto(out *TFJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.SuccessPolicy != nil {
in, out := &in.SuccessPolicy, &out.SuccessPolicy
*out = new(SuccessPolicy)
**out = **in
}
if in.TFReplicaSpecs != nil {
in, out := &in.TFReplicaSpecs, &out.TFReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TFJobSpec.
func (in *TFJobSpec) DeepCopy() *TFJobSpec {
if in == nil {
return nil
}
out := new(TFJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *XGBoostJob) DeepCopyInto(out *XGBoostJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XGBoostJob.
func (in *XGBoostJob) DeepCopy() *XGBoostJob {
if in == nil {
return nil
}
out := new(XGBoostJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *XGBoostJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *XGBoostJobList) DeepCopyInto(out *XGBoostJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]XGBoostJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XGBoostJobList.
func (in *XGBoostJobList) DeepCopy() *XGBoostJobList {
if in == nil {
return nil
}
out := new(XGBoostJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *XGBoostJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *XGBoostJobSpec) DeepCopyInto(out *XGBoostJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.XGBReplicaSpecs != nil {
in, out := &in.XGBReplicaSpecs, &out.XGBReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XGBoostJobSpec.
func (in *XGBoostJobSpec) DeepCopy() *XGBoostJobSpec {
if in == nil {
return nil
}
out := new(XGBoostJobSpec)
in.DeepCopyInto(out)
return out
}
@@ -0,0 +1,96 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&MPIJob{}, func(obj interface{}) { SetObjectDefaults_MPIJob(obj.(*MPIJob)) })
scheme.AddTypeDefaultingFunc(&MPIJobList{}, func(obj interface{}) { SetObjectDefaults_MPIJobList(obj.(*MPIJobList)) })
scheme.AddTypeDefaultingFunc(&MXJob{}, func(obj interface{}) { SetObjectDefaults_MXJob(obj.(*MXJob)) })
scheme.AddTypeDefaultingFunc(&MXJobList{}, func(obj interface{}) { SetObjectDefaults_MXJobList(obj.(*MXJobList)) })
scheme.AddTypeDefaultingFunc(&PyTorchJob{}, func(obj interface{}) { SetObjectDefaults_PyTorchJob(obj.(*PyTorchJob)) })
scheme.AddTypeDefaultingFunc(&PyTorchJobList{}, func(obj interface{}) { SetObjectDefaults_PyTorchJobList(obj.(*PyTorchJobList)) })
scheme.AddTypeDefaultingFunc(&TFJob{}, func(obj interface{}) { SetObjectDefaults_TFJob(obj.(*TFJob)) })
scheme.AddTypeDefaultingFunc(&TFJobList{}, func(obj interface{}) { SetObjectDefaults_TFJobList(obj.(*TFJobList)) })
scheme.AddTypeDefaultingFunc(&XGBoostJob{}, func(obj interface{}) { SetObjectDefaults_XGBoostJob(obj.(*XGBoostJob)) })
scheme.AddTypeDefaultingFunc(&XGBoostJobList{}, func(obj interface{}) { SetObjectDefaults_XGBoostJobList(obj.(*XGBoostJobList)) })
return nil
}
func SetObjectDefaults_MPIJob(in *MPIJob) {
SetDefaults_MPIJob(in)
}
func SetObjectDefaults_MPIJobList(in *MPIJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_MPIJob(a)
}
}
func SetObjectDefaults_MXJob(in *MXJob) {
SetDefaults_MXJob(in)
}
func SetObjectDefaults_MXJobList(in *MXJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_MXJob(a)
}
}
func SetObjectDefaults_PyTorchJob(in *PyTorchJob) {
SetDefaults_PyTorchJob(in)
}
func SetObjectDefaults_PyTorchJobList(in *PyTorchJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_PyTorchJob(a)
}
}
func SetObjectDefaults_TFJob(in *TFJob) {
SetDefaults_TFJob(in)
}
func SetObjectDefaults_TFJobList(in *TFJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_TFJob(a)
}
}
func SetObjectDefaults_XGBoostJob(in *XGBoostJob) {
SetDefaults_XGBoostJob(in)
}
func SetObjectDefaults_XGBoostJobList(in *XGBoostJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_XGBoostJob(a)
}
}
-36
View File
@@ -1,36 +0,0 @@
// Copyright 2019 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import common "github.com/kubeflow/common/pkg/apis/common/v1"
const (
// DefaultPortName is name of the port used to communicate between Master and Workers.
DefaultPortName = "mpi-port"
// DefaultContainerName is the name of the MPIJob container.
DefaultContainerName = "mpi"
// DefaultPort is default value of the port.
DefaultPort = 9999
// DefaultRestartPolicy is default RestartPolicy for ReplicaSpec.
DefaultRestartPolicy = common.RestartPolicyNever
Kind = "MPIJob"
// Plural is the Plural for TFJob.
Plural = "mpijobs"
// Singular is the singular for TFJob.
Singular = "mpijob"
// FrameworkName is the name of the ML Framework
FrameworkName = "mpi"
)
-488
View File
@@ -1,488 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition": schema_pkg_apis_common_v1_JobCondition(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus": schema_pkg_apis_common_v1_JobStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec": schema_pkg_apis_common_v1_ReplicaSpec(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus": schema_pkg_apis_common_v1_ReplicaStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy": schema_pkg_apis_common_v1_RunPolicy(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy": schema_pkg_apis_common_v1_SchedulingPolicy(ref),
"github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJob": schema_pkg_apis_mpi_v1_MPIJob(ref),
"github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJobList": schema_pkg_apis_mpi_v1_MPIJobList(ref),
"github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJobSpec": schema_pkg_apis_mpi_v1_MPIJobSpec(ref),
}
}
func schema_pkg_apis_common_v1_JobCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobCondition describes the state of the job at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type of job condition.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status of the condition, one of True, False, Unknown.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"reason": {
SchemaProps: spec.SchemaProps{
Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "A human readable message indicating details about the transition.",
Type: []string{"string"},
Format: "",
},
},
"lastUpdateTime": {
SchemaProps: spec.SchemaProps{
Description: "The last time this condition was updated.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastTransitionTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition transitioned from one status to another.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"type", "status"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_JobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobStatus represents the current observed state of the training Job.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"conditions": {
SchemaProps: spec.SchemaProps{
Description: "Conditions is an array of current observed job conditions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobCondition"),
},
},
},
},
},
"replicaStatuses": {
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus"),
},
},
},
},
},
"startTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"completionTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastReconcileTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents last time when the job was reconciled. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"conditions", "replicaStatuses"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition", "github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_ReplicaSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaSpec is a description of the replica",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "Replicas is the desired number of replicas of the given template. If unspecified, defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "Template is the object that describes the pod that will be created for this replica. RestartPolicy in PodTemplateSpec will be overide by RestartPolicy in ReplicaSpec",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"),
},
},
"restartPolicy": {
SchemaProps: spec.SchemaProps{
Description: "Restart policy for all replicas within the job. One of Always, OnFailure, Never and ExitCode. Default to Never.",
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/core/v1.PodTemplateSpec"},
}
}
func schema_pkg_apis_common_v1_ReplicaStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatus represents the current observed state of the replica.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "The number of actively running pods.",
Type: []string{"integer"},
Format: "int32",
},
},
"succeeded": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Succeeded.",
Type: []string{"integer"},
Format: "int32",
},
},
"failed": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"labelSelector": {
SchemaProps: spec.SchemaProps{
Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}
func schema_pkg_apis_common_v1_RunPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"cleanPodPolicy": {
SchemaProps: spec.SchemaProps{
Description: "CleanPodPolicy defines the policy to kill pods after the job completes. Default to Running.",
Type: []string{"string"},
Format: "",
},
},
"ttlSecondsAfterFinished": {
SchemaProps: spec.SchemaProps{
Description: "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.",
Type: []string{"integer"},
Format: "int32",
},
},
"activeDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
Type: []string{"integer"},
Format: "int64",
},
},
"backoffLimit": {
SchemaProps: spec.SchemaProps{
Description: "Optional number of retries before marking this job failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"schedulingPolicy": {
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy defines the policy related to scheduling, e.g. gang-scheduling",
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"},
}
}
func schema_pkg_apis_common_v1_SchedulingPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy encapsulates various scheduling policies of the distributed training job, for example `minAvailable` for gang-scheduling.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"minAvailable": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"queue": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"minResources": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
},
},
},
},
},
"priorityClass": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
func schema_pkg_apis_mpi_v1_MPIJob(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus", "github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJobSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_pkg_apis_mpi_v1_MPIJobList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/kubeflow/training-operator/pkg/apis/mpi/v1.MPIJob", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_mpi_v1_MPIJobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"slotsPerWorker": {
SchemaProps: spec.SchemaProps{
Description: "Specifies the number of slots per worker used in hostfile. Defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"cleanPodPolicy": {
SchemaProps: spec.SchemaProps{
Description: "CleanPodPolicy defines the policy that whether to kill pods after the job completes. Defaults to None.",
Type: []string{"string"},
Format: "",
},
},
"mpiReplicaSpecs": {
SchemaProps: spec.SchemaProps{
Description: "`MPIReplicaSpecs` contains maps from `MPIReplicaType` to `ReplicaSpec` that specify the MPI replicas to run.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec"),
},
},
},
},
},
"mainContainer": {
SchemaProps: spec.SchemaProps{
Description: "MainContainer specifies name of the main container which executes the MPI code.",
Type: []string{"string"},
Format: "",
},
},
"runPolicy": {
SchemaProps: spec.SchemaProps{
Description: "`RunPolicy` encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"),
},
},
},
Required: []string{"mpiReplicaSpecs"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec", "github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"},
}
}
-252
View File
@@ -1,252 +0,0 @@
{
"swagger": "2.0",
"info": {
"description": "Python SDK for MPI-Operator",
"title": "mpijob",
"version": "v0.1"
},
"paths": {},
"definitions": {
"v1.JobCondition": {
"description": "JobCondition describes the state of the job at a certain point.",
"type": "object",
"required": [
"type",
"status"
],
"properties": {
"lastTransitionTime": {
"description": "Last time the condition transitioned from one status to another.",
"$ref": "#/definitions/v1.Time"
},
"lastUpdateTime": {
"description": "The last time this condition was updated.",
"$ref": "#/definitions/v1.Time"
},
"message": {
"description": "A human readable message indicating details about the transition.",
"type": "string"
},
"reason": {
"description": "The reason for the condition's last transition.",
"type": "string"
},
"status": {
"description": "Status of the condition, one of True, False, Unknown.",
"type": "string"
},
"type": {
"description": "Type of job condition.",
"type": "string"
}
}
},
"v1.JobStatus": {
"description": "JobStatus represents the current observed state of the training Job.",
"type": "object",
"required": [
"conditions",
"replicaStatuses"
],
"properties": {
"completionTime": {
"description": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
"$ref": "#/definitions/v1.Time"
},
"conditions": {
"description": "Conditions is an array of current observed job conditions.",
"type": "array",
"items": {
"$ref": "#/definitions/v1.JobCondition"
}
},
"lastReconcileTime": {
"description": "Represents last time when the job was reconciled. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
"$ref": "#/definitions/v1.Time"
},
"replicaStatuses": {
"description": "ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaStatus"
}
},
"startTime": {
"description": "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
"$ref": "#/definitions/v1.Time"
}
}
},
"v1.MPIJob": {
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"$ref": "#/definitions/v1.ObjectMeta"
},
"spec": {
"$ref": "#/definitions/v1.MPIJobSpec"
},
"status": {
"$ref": "#/definitions/v1.JobStatus"
}
}
},
"v1.MPIJobList": {
"type": "object",
"required": [
"metadata",
"items"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.MPIJob"
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"$ref": "#/definitions/v1.ListMeta"
}
}
},
"v1.MPIJobSpec": {
"type": "object",
"required": [
"mpiReplicaSpecs"
],
"properties": {
"cleanPodPolicy": {
"description": "CleanPodPolicy defines the policy that whether to kill pods after the job completes. Defaults to None.",
"type": "string"
},
"mainContainer": {
"description": "MainContainer specifies name of the main container which executes the MPI code.",
"type": "string"
},
"mpiReplicaSpecs": {
"description": "`MPIReplicaSpecs` contains maps from `MPIReplicaType` to `ReplicaSpec` that specify the MPI replicas to run.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/v1.ReplicaSpec"
}
},
"runPolicy": {
"description": "`RunPolicy` encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"$ref": "#/definitions/v1.RunPolicy"
},
"slotsPerWorker": {
"description": "Specifies the number of slots per worker used in hostfile. Defaults to 1.",
"type": "integer",
"format": "int32"
}
}
},
"v1.ReplicaSpec": {
"description": "ReplicaSpec is a description of the replica",
"type": "object",
"properties": {
"replicas": {
"description": "Replicas is the desired number of replicas of the given template. If unspecified, defaults to 1.",
"type": "integer",
"format": "int32"
},
"restartPolicy": {
"description": "Restart policy for all replicas within the job. One of Always, OnFailure, Never and ExitCode. Default to Never.",
"type": "string"
},
"template": {
"description": "Template is the object that describes the pod that will be created for this replica. RestartPolicy in PodTemplateSpec will be overide by RestartPolicy in ReplicaSpec",
"$ref": "#/definitions/v1.PodTemplateSpec"
}
}
},
"v1.ReplicaStatus": {
"description": "ReplicaStatus represents the current observed state of the replica.",
"type": "object",
"properties": {
"active": {
"description": "The number of actively running pods.",
"type": "integer",
"format": "int32"
},
"failed": {
"description": "The number of pods which reached phase Failed.",
"type": "integer",
"format": "int32"
},
"succeeded": {
"description": "The number of pods which reached phase Succeeded.",
"type": "integer",
"format": "int32"
}
}
},
"v1.RunPolicy": {
"description": "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
"type": "object",
"properties": {
"activeDeadlineSeconds": {
"description": "Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
"type": "integer",
"format": "int64"
},
"backoffLimit": {
"description": "Optional number of retries before marking this job failed.",
"type": "integer",
"format": "int32"
},
"cleanPodPolicy": {
"description": "CleanPodPolicy defines the policy to kill pods after the job completes. Default to Running.",
"type": "string"
},
"schedulingPolicy": {
"description": "SchedulingPolicy defines the policy related to scheduling, e.g. gang-scheduling",
"$ref": "#/definitions/v1.SchedulingPolicy"
},
"ttlSecondsAfterFinished": {
"description": "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.",
"type": "integer",
"format": "int32"
}
}
},
"v1.SchedulingPolicy": {
"description": "SchedulingPolicy encapsulates various scheduling policies of the distributed training job, for example `minAvailable` for gang-scheduling.",
"type": "object",
"properties": {
"minAvailable": {
"type": "integer",
"format": "int32"
},
"minResources": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/resource.Quantity"
}
},
"priorityClass": {
"type": "string"
},
"queue": {
"type": "string"
}
}
}
}
}
-125
View File
@@ -1,125 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MPIJob) DeepCopyInto(out *MPIJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIJob.
func (in *MPIJob) DeepCopy() *MPIJob {
if in == nil {
return nil
}
out := new(MPIJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MPIJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MPIJobList) DeepCopyInto(out *MPIJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]MPIJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIJobList.
func (in *MPIJobList) DeepCopy() *MPIJobList {
if in == nil {
return nil
}
out := new(MPIJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MPIJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MPIJobSpec) DeepCopyInto(out *MPIJobSpec) {
*out = *in
if in.SlotsPerWorker != nil {
in, out := &in.SlotsPerWorker, &out.SlotsPerWorker
*out = new(int32)
**out = **in
}
if in.CleanPodPolicy != nil {
in, out := &in.CleanPodPolicy, &out.CleanPodPolicy
*out = new(commonv1.CleanPodPolicy)
**out = **in
}
if in.MPIReplicaSpecs != nil {
in, out := &in.MPIReplicaSpecs, &out.MPIReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIJobSpec.
func (in *MPIJobSpec) DeepCopy() *MPIJobSpec {
if in == nil {
return nil
}
out := new(MPIJobSpec)
in.DeepCopyInto(out)
return out
}
-44
View File
@@ -1,44 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&MPIJob{}, func(obj interface{}) { SetObjectDefaults_MPIJob(obj.(*MPIJob)) })
scheme.AddTypeDefaultingFunc(&MPIJobList{}, func(obj interface{}) { SetObjectDefaults_MPIJobList(obj.(*MPIJobList)) })
return nil
}
func SetObjectDefaults_MPIJob(in *MPIJob) {
SetDefaults_MPIJob(in)
}
func SetObjectDefaults_MPIJobList(in *MPIJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_MPIJob(a)
}
}
-37
View File
@@ -1,37 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
package v1
import commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
const (
// DefaultPortName is name of the port used to communicate between scheduler and
// servers & workers.
DefaultPortName = "mxjob-port"
// DefaultContainerName is the name of the MXJob container.
DefaultContainerName = "mxnet"
// DefaultPort is default value of the port.
DefaultPort = 9091
// DefaultRestartPolicy is default RestartPolicy for MXReplicaSpec.
DefaultRestartPolicy = commonv1.RestartPolicyNever
// Kind is the kind name.
Kind = "MXJob"
// Plural is the Plural for mxJob.
Plural = "mxjobs"
// Singular is the singular for mxJob.
Singular = "mxjob"
// FrameworkName is the name of the ML Framework
FrameworkName = "mxnet"
)
-107
View File
@@ -1,107 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"strings"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// Int32 is a helper routine that allocates a new int32 value
// to store v and returns a pointer to it.
func Int32(v int32) *int32 {
return &v
}
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setDefaultPort sets the default ports for mxnet container.
func setDefaultPort(spec *v1.PodSpec) {
index := 0
for i, container := range spec.Containers {
if container.Name == DefaultContainerName {
index = i
break
}
}
hasMXJobPort := false
for _, port := range spec.Containers[index].Ports {
if port.Name == DefaultPortName {
hasMXJobPort = true
break
}
}
if !hasMXJobPort {
spec.Containers[index].Ports = append(spec.Containers[index].Ports, v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
})
}
}
func setDefaultReplicas(spec *commonv1.ReplicaSpec) {
if spec.Replicas == nil {
spec.Replicas = Int32(1)
}
if spec.RestartPolicy == "" {
spec.RestartPolicy = DefaultRestartPolicy
}
}
// setTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setTypeNamesToCamelCase(mxJob *MXJob) {
setTypeNameToCamelCase(mxJob, MXReplicaTypeScheduler)
setTypeNameToCamelCase(mxJob, MXReplicaTypeServer)
setTypeNameToCamelCase(mxJob, MXReplicaTypeWorker)
}
// setTypeNameToCamelCase sets the name of the replica type from any case to correct case.
// E.g. from server to Server; from WORKER to Worker.
func setTypeNameToCamelCase(mxJob *MXJob, typ commonv1.ReplicaType) {
for t := range mxJob.Spec.MXReplicaSpecs {
if strings.EqualFold(string(t), string(typ)) && t != typ {
spec := mxJob.Spec.MXReplicaSpecs[t]
delete(mxJob.Spec.MXReplicaSpecs, t)
mxJob.Spec.MXReplicaSpecs[typ] = spec
return
}
}
}
// SetDefaults_MXJob sets any unspecified values to defaults.
func SetDefaults_MXJob(mxjob *MXJob) {
// Set default cleanpod policy to All.
if mxjob.Spec.RunPolicy.CleanPodPolicy == nil {
all := commonv1.CleanPodPolicyAll
mxjob.Spec.RunPolicy.CleanPodPolicy = &all
}
// Update the key of MXReplicaSpecs to camel case.
setTypeNamesToCamelCase(mxjob)
for _, spec := range mxjob.Spec.MXReplicaSpecs {
// Set default replicas to 1.
setDefaultReplicas(spec)
// Set default port to mxnet container.
setDefaultPort(&spec.Template.Spec)
}
}
-20
View File
@@ -1,20 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// Package v1 is the v1 version of the API.
// +groupName=kubeflow.org
package v1
-34
View File
@@ -1,34 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package v1 contains API Schema definitions for the kubeflow.org v1 API group
//+kubebuilder:object:generate=true
//+groupName=kubeflow.org
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "kubeflow.org", Version: "v1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
-490
View File
@@ -1,490 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition": schema_pkg_apis_common_v1_JobCondition(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus": schema_pkg_apis_common_v1_JobStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec": schema_pkg_apis_common_v1_ReplicaSpec(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus": schema_pkg_apis_common_v1_ReplicaStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy": schema_pkg_apis_common_v1_RunPolicy(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy": schema_pkg_apis_common_v1_SchedulingPolicy(ref),
"github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJob": schema_pkg_apis_mxnet_v1_MXJob(ref),
"github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJobList": schema_pkg_apis_mxnet_v1_MXJobList(ref),
"github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJobSpec": schema_pkg_apis_mxnet_v1_MXJobSpec(ref),
"github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJobStatus": schema_pkg_apis_mxnet_v1_MXJobStatus(ref),
}
}
func schema_pkg_apis_common_v1_JobCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobCondition describes the state of the job at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type of job condition.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status of the condition, one of True, False, Unknown.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"reason": {
SchemaProps: spec.SchemaProps{
Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "A human readable message indicating details about the transition.",
Type: []string{"string"},
Format: "",
},
},
"lastUpdateTime": {
SchemaProps: spec.SchemaProps{
Description: "The last time this condition was updated.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastTransitionTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition transitioned from one status to another.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"type", "status"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_JobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobStatus represents the current observed state of the training Job.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"conditions": {
SchemaProps: spec.SchemaProps{
Description: "Conditions is an array of current observed job conditions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobCondition"),
},
},
},
},
},
"replicaStatuses": {
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus"),
},
},
},
},
},
"startTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"completionTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastReconcileTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents last time when the job was reconciled. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"conditions", "replicaStatuses"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition", "github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_ReplicaSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaSpec is a description of the replica",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "Replicas is the desired number of replicas of the given template. If unspecified, defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "Template is the object that describes the pod that will be created for this replica. RestartPolicy in PodTemplateSpec will be overide by RestartPolicy in ReplicaSpec",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"),
},
},
"restartPolicy": {
SchemaProps: spec.SchemaProps{
Description: "Restart policy for all replicas within the job. One of Always, OnFailure, Never and ExitCode. Default to Never.",
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/core/v1.PodTemplateSpec"},
}
}
func schema_pkg_apis_common_v1_ReplicaStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatus represents the current observed state of the replica.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "The number of actively running pods.",
Type: []string{"integer"},
Format: "int32",
},
},
"succeeded": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Succeeded.",
Type: []string{"integer"},
Format: "int32",
},
},
"failed": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"labelSelector": {
SchemaProps: spec.SchemaProps{
Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}
func schema_pkg_apis_common_v1_RunPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"cleanPodPolicy": {
SchemaProps: spec.SchemaProps{
Description: "CleanPodPolicy defines the policy to kill pods after the job completes. Default to Running.",
Type: []string{"string"},
Format: "",
},
},
"ttlSecondsAfterFinished": {
SchemaProps: spec.SchemaProps{
Description: "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.",
Type: []string{"integer"},
Format: "int32",
},
},
"activeDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
Type: []string{"integer"},
Format: "int64",
},
},
"backoffLimit": {
SchemaProps: spec.SchemaProps{
Description: "Optional number of retries before marking this job failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"schedulingPolicy": {
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy defines the policy related to scheduling, e.g. gang-scheduling",
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"},
}
}
func schema_pkg_apis_common_v1_SchedulingPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy encapsulates various scheduling policies of the distributed training job, for example `minAvailable` for gang-scheduling.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"minAvailable": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"queue": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"minResources": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
},
},
},
},
},
"priorityClass": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
func schema_pkg_apis_mxnet_v1_MXJob(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MXJob is the Schema for the mxjobs API",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus", "github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJobSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_pkg_apis_mxnet_v1_MXJobList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MXJobList contains a list of MXJob",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/kubeflow/training-operator/pkg/apis/mxnet/v1.MXJob", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_mxnet_v1_MXJobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MXJobSpec defines the desired state of MXJob",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"runPolicy": {
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"),
},
},
"jobMode": {
SchemaProps: spec.SchemaProps{
Description: "JobMode specify the kind of MXjob to do. Different mode may have different MXReplicaSpecs request",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"mxReplicaSpecs": {
SchemaProps: spec.SchemaProps{
Description: "MXReplicaSpecs is map of common.ReplicaType and common.ReplicaSpec specifies the MX replicas to run. For example,\n {\n \"Scheduler\": common.ReplicaSpec,\n \"Server\": common.ReplicaSpec,\n \"Worker\": common.ReplicaSpec,\n }",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec"),
},
},
},
},
},
},
Required: []string{"runPolicy", "jobMode", "mxReplicaSpecs"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec", "github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"},
}
}
func schema_pkg_apis_mxnet_v1_MXJobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MXJobStatus defines the observed state of MXJob",
Type: []string{"object"},
},
},
}
}
-27
View File
@@ -1,27 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
)
// SchemeGroupVersion is group version used to register these objects.
var SchemeGroupVersion = GroupVersion
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {
return GroupVersion.WithResource(resource).GroupResource()
}
-130
View File
@@ -1,130 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJob) DeepCopyInto(out *MXJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJob.
func (in *MXJob) DeepCopy() *MXJob {
if in == nil {
return nil
}
out := new(MXJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MXJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJobList) DeepCopyInto(out *MXJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]MXJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJobList.
func (in *MXJobList) DeepCopy() *MXJobList {
if in == nil {
return nil
}
out := new(MXJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MXJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJobSpec) DeepCopyInto(out *MXJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.MXReplicaSpecs != nil {
in, out := &in.MXReplicaSpecs, &out.MXReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJobSpec.
func (in *MXJobSpec) DeepCopy() *MXJobSpec {
if in == nil {
return nil
}
out := new(MXJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MXJobStatus) DeepCopyInto(out *MXJobStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MXJobStatus.
func (in *MXJobStatus) DeepCopy() *MXJobStatus {
if in == nil {
return nil
}
out := new(MXJobStatus)
in.DeepCopyInto(out)
return out
}
@@ -1,44 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&MXJob{}, func(obj interface{}) { SetObjectDefaults_MXJob(obj.(*MXJob)) })
scheme.AddTypeDefaultingFunc(&MXJobList{}, func(obj interface{}) { SetObjectDefaults_MXJobList(obj.(*MXJobList)) })
return nil
}
func SetObjectDefaults_MXJob(in *MXJob) {
SetDefaults_MXJob(in)
}
func SetObjectDefaults_MXJobList(in *MXJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_MXJob(a)
}
}
-39
View File
@@ -1,39 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
common "github.com/kubeflow/common/pkg/apis/common/v1"
)
const (
// DefaultPortName is name of the port used to communicate between Master and
// workers.
DefaultPortName = "pytorchjob-port"
// DefaultContainerName is the name of the PyTorchJob container.
DefaultContainerName = "pytorch"
// DefaultPort is default value of the port.
DefaultPort = 23456
// DefaultRestartPolicy is default RestartPolicy for PyTorchReplicaSpec.
DefaultRestartPolicy = common.RestartPolicyOnFailure
// Kind is the kind name.
Kind = "PyTorchJob"
// Plural is the Plural for pytorchJob.
Plural = "pytorchjobs"
// Singular is the singular for pytorchJob.
Singular = "pytorchjob"
// FrameworkName is the name of the ML Framework
FrameworkName = "pytorch"
)
-127
View File
@@ -1,127 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"strings"
common "github.com/kubeflow/common/pkg/apis/common/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// Int32 is a helper routine that allocates a new int32 value
// to store v and returns a pointer to it.
func Int32(v int32) *int32 {
return &v
}
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setDefaultPort sets the default ports for pytorch container.
func setDefaultPort(spec *v1.PodSpec) {
index := 0
for i, container := range spec.Containers {
if container.Name == DefaultContainerName {
index = i
break
}
}
hasPyTorchJobPort := false
for _, port := range spec.Containers[index].Ports {
if port.Name == DefaultPortName {
hasPyTorchJobPort = true
break
}
}
if !hasPyTorchJobPort {
spec.Containers[index].Ports = append(spec.Containers[index].Ports, v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
})
}
}
func setElasticPolicy(job *PyTorchJob) {
if job.Spec.ElasticPolicy != nil {
if job.Spec.ElasticPolicy.MaxReplicas != nil &&
job.Spec.ElasticPolicy.MinReplicas != nil {
return
} else if job.Spec.ElasticPolicy.MaxReplicas != nil {
// Set MinRepliacs to elasticPolicy.MaxReplicas.
job.Spec.ElasticPolicy.MinReplicas = job.Spec.ElasticPolicy.MaxReplicas
} else if job.Spec.ElasticPolicy.MinReplicas != nil {
job.Spec.ElasticPolicy.MaxReplicas = job.Spec.ElasticPolicy.MinReplicas
} else {
workerReplicas := job.Spec.PyTorchReplicaSpecs[PyTorchReplicaTypeWorker].Replicas
// Set Min and Max to worker.spec.Replicas.
job.Spec.ElasticPolicy.MaxReplicas = workerReplicas
job.Spec.ElasticPolicy.MinReplicas = workerReplicas
}
}
}
func setDefaultReplicas(spec *common.ReplicaSpec) {
if spec.Replicas == nil {
spec.Replicas = Int32(1)
}
}
func setDefaultRestartPolicy(spec *common.ReplicaSpec) {
if spec.RestartPolicy == "" {
spec.RestartPolicy = DefaultRestartPolicy
}
}
// setTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setTypeNamesToCamelCase(job *PyTorchJob) {
setTypeNameToCamelCase(job, PyTorchReplicaTypeMaster)
setTypeNameToCamelCase(job, PyTorchReplicaTypeWorker)
}
// setTypeNameToCamelCase sets the name of the replica type from any case to correct case.
func setTypeNameToCamelCase(job *PyTorchJob, typ common.ReplicaType) {
for t := range job.Spec.PyTorchReplicaSpecs {
if strings.EqualFold(string(t), string(typ)) && t != typ {
spec := job.Spec.PyTorchReplicaSpecs[t]
delete(job.Spec.PyTorchReplicaSpecs, t)
job.Spec.PyTorchReplicaSpecs[typ] = spec
return
}
}
}
// SetDefaults_PyTorchJob sets any unspecified values to defaults.
func SetDefaults_PyTorchJob(job *PyTorchJob) {
// Set default cleanpod policy to None.
if job.Spec.RunPolicy.CleanPodPolicy == nil {
policy := common.CleanPodPolicyNone
job.Spec.RunPolicy.CleanPodPolicy = &policy
}
// Update the key of PyTorchReplicaSpecs to camel case.
setTypeNamesToCamelCase(job)
for _, spec := range job.Spec.PyTorchReplicaSpecs {
setDefaultReplicas(spec)
setDefaultRestartPolicy(spec)
setDefaultPort(&spec.Template.Spec)
}
// Set default elastic policy.
setElasticPolicy(job)
}
-20
View File
@@ -1,20 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// Package v1 is the v1 version of the API.
// +groupName=kubeflow.org
package v1
-34
View File
@@ -1,34 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package v1 contains API Schema definitions for the kubeflow.org v1 API group
//+kubebuilder:object:generate=true
//+groupName=kubeflow.org
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "kubeflow.org", Version: "v1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
-605
View File
@@ -1,605 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition": schema_pkg_apis_common_v1_JobCondition(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus": schema_pkg_apis_common_v1_JobStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec": schema_pkg_apis_common_v1_ReplicaSpec(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus": schema_pkg_apis_common_v1_ReplicaStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy": schema_pkg_apis_common_v1_RunPolicy(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy": schema_pkg_apis_common_v1_SchedulingPolicy(ref),
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.ElasticPolicy": schema_pkg_apis_pytorch_v1_ElasticPolicy(ref),
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJob": schema_pkg_apis_pytorch_v1_PyTorchJob(ref),
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJobList": schema_pkg_apis_pytorch_v1_PyTorchJobList(ref),
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJobSpec": schema_pkg_apis_pytorch_v1_PyTorchJobSpec(ref),
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.RDZVConf": schema_pkg_apis_pytorch_v1_RDZVConf(ref),
}
}
func schema_pkg_apis_common_v1_JobCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobCondition describes the state of the job at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type of job condition.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status of the condition, one of True, False, Unknown.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"reason": {
SchemaProps: spec.SchemaProps{
Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "A human readable message indicating details about the transition.",
Type: []string{"string"},
Format: "",
},
},
"lastUpdateTime": {
SchemaProps: spec.SchemaProps{
Description: "The last time this condition was updated.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastTransitionTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition transitioned from one status to another.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"type", "status"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_JobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobStatus represents the current observed state of the training Job.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"conditions": {
SchemaProps: spec.SchemaProps{
Description: "Conditions is an array of current observed job conditions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobCondition"),
},
},
},
},
},
"replicaStatuses": {
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus"),
},
},
},
},
},
"startTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"completionTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastReconcileTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents last time when the job was reconciled. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"conditions", "replicaStatuses"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition", "github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_ReplicaSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaSpec is a description of the replica",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "Replicas is the desired number of replicas of the given template. If unspecified, defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "Template is the object that describes the pod that will be created for this replica. RestartPolicy in PodTemplateSpec will be overide by RestartPolicy in ReplicaSpec",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"),
},
},
"restartPolicy": {
SchemaProps: spec.SchemaProps{
Description: "Restart policy for all replicas within the job. One of Always, OnFailure, Never and ExitCode. Default to Never.",
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/core/v1.PodTemplateSpec"},
}
}
func schema_pkg_apis_common_v1_ReplicaStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatus represents the current observed state of the replica.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "The number of actively running pods.",
Type: []string{"integer"},
Format: "int32",
},
},
"succeeded": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Succeeded.",
Type: []string{"integer"},
Format: "int32",
},
},
"failed": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"labelSelector": {
SchemaProps: spec.SchemaProps{
Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}
func schema_pkg_apis_common_v1_RunPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"cleanPodPolicy": {
SchemaProps: spec.SchemaProps{
Description: "CleanPodPolicy defines the policy to kill pods after the job completes. Default to Running.",
Type: []string{"string"},
Format: "",
},
},
"ttlSecondsAfterFinished": {
SchemaProps: spec.SchemaProps{
Description: "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.",
Type: []string{"integer"},
Format: "int32",
},
},
"activeDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
Type: []string{"integer"},
Format: "int64",
},
},
"backoffLimit": {
SchemaProps: spec.SchemaProps{
Description: "Optional number of retries before marking this job failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"schedulingPolicy": {
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy defines the policy related to scheduling, e.g. gang-scheduling",
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"},
}
}
func schema_pkg_apis_common_v1_SchedulingPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy encapsulates various scheduling policies of the distributed training job, for example `minAvailable` for gang-scheduling.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"minAvailable": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"queue": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"minResources": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
},
},
},
},
},
"priorityClass": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
func schema_pkg_apis_pytorch_v1_ElasticPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"minReplicas": {
SchemaProps: spec.SchemaProps{
Description: "minReplicas is the lower limit for the number of replicas to which the training job can scale down. It defaults to null.",
Type: []string{"integer"},
Format: "int32",
},
},
"maxReplicas": {
SchemaProps: spec.SchemaProps{
Description: "upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas, defaults to null.",
Type: []string{"integer"},
Format: "int32",
},
},
"rdzvBackend": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"rdzvPort": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"rdzvHost": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"rdzvId": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"rdzvConf": {
SchemaProps: spec.SchemaProps{
Description: "RDZVConf contains additional rendezvous configuration (<key1>=<value1>,<key2>=<value2>,...).",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.RDZVConf"),
},
},
},
},
},
"standalone": {
SchemaProps: spec.SchemaProps{
Description: "Start a local standalone rendezvous backend that is represented by a C10d TCP store on port 29400. Useful when launching single-node, multi-worker job. If specified --rdzv_backend, --rdzv_endpoint, --rdzv_id are auto-assigned; any explicitly set values are ignored.",
Type: []string{"boolean"},
Format: "",
},
},
"nProcPerNode": {
SchemaProps: spec.SchemaProps{
Description: "Number of workers per node; supported values: [auto, cpu, gpu, int].",
Type: []string{"integer"},
Format: "int32",
},
},
"maxRestarts": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"metrics": {
SchemaProps: spec.SchemaProps{
Description: "Metrics contains the specifications which are used to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated with multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the HPA will not be created.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/autoscaling/v2beta2.MetricSpec"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.RDZVConf", "k8s.io/api/autoscaling/v2beta2.MetricSpec"},
}
}
func schema_pkg_apis_pytorch_v1_PyTorchJob(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "PyTorchJob Represents a PyTorchJob resource.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "Specification of the desired state of the PyTorchJob.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Most recently observed status of the PyTorchJob. Read-only (modified by the system).",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus", "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJobSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_pkg_apis_pytorch_v1_PyTorchJobList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "PyTorchJobList is a list of PyTorchJobs.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "List of PyTorchJobs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.PyTorchJob", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_pytorch_v1_PyTorchJobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "PyTorchJobSpec is a desired state description of the PyTorchJob.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"runPolicy": {
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"),
},
},
"elasticPolicy": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.ElasticPolicy"),
},
},
"pytorchReplicaSpecs": {
SchemaProps: spec.SchemaProps{
Description: "A map of PyTorchReplicaType (type) to ReplicaSpec (value). Specifies the PyTorch cluster configuration. For example,\n {\n \"Master\": PyTorchReplicaSpec,\n \"Worker\": PyTorchReplicaSpec,\n }",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec"),
},
},
},
},
},
},
Required: []string{"runPolicy", "pytorchReplicaSpecs"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec", "github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy", "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1.ElasticPolicy"},
}
}
func schema_pkg_apis_pytorch_v1_RDZVConf(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"key": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"value": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
-27
View File
@@ -1,27 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
)
// SchemeGroupVersion is group version used to register these objects.
var SchemeGroupVersion = GroupVersion
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {
return GroupVersion.WithResource(resource).GroupResource()
}
@@ -1,208 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/api/autoscaling/v2beta2"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ElasticPolicy) DeepCopyInto(out *ElasticPolicy) {
*out = *in
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32)
**out = **in
}
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(int32)
**out = **in
}
if in.RDZVBackend != nil {
in, out := &in.RDZVBackend, &out.RDZVBackend
*out = new(RDZVBackend)
**out = **in
}
if in.RDZVPort != nil {
in, out := &in.RDZVPort, &out.RDZVPort
*out = new(int32)
**out = **in
}
if in.RDZVHost != nil {
in, out := &in.RDZVHost, &out.RDZVHost
*out = new(string)
**out = **in
}
if in.RDZVID != nil {
in, out := &in.RDZVID, &out.RDZVID
*out = new(string)
**out = **in
}
if in.RDZVConf != nil {
in, out := &in.RDZVConf, &out.RDZVConf
*out = make([]RDZVConf, len(*in))
copy(*out, *in)
}
if in.Standalone != nil {
in, out := &in.Standalone, &out.Standalone
*out = new(bool)
**out = **in
}
if in.NProcPerNode != nil {
in, out := &in.NProcPerNode, &out.NProcPerNode
*out = new(int32)
**out = **in
}
if in.MaxRestarts != nil {
in, out := &in.MaxRestarts, &out.MaxRestarts
*out = new(int32)
**out = **in
}
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]v2beta2.MetricSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticPolicy.
func (in *ElasticPolicy) DeepCopy() *ElasticPolicy {
if in == nil {
return nil
}
out := new(ElasticPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PyTorchJob) DeepCopyInto(out *PyTorchJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PyTorchJob.
func (in *PyTorchJob) DeepCopy() *PyTorchJob {
if in == nil {
return nil
}
out := new(PyTorchJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PyTorchJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PyTorchJobList) DeepCopyInto(out *PyTorchJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PyTorchJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PyTorchJobList.
func (in *PyTorchJobList) DeepCopy() *PyTorchJobList {
if in == nil {
return nil
}
out := new(PyTorchJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PyTorchJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PyTorchJobSpec) DeepCopyInto(out *PyTorchJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.ElasticPolicy != nil {
in, out := &in.ElasticPolicy, &out.ElasticPolicy
*out = new(ElasticPolicy)
(*in).DeepCopyInto(*out)
}
if in.PyTorchReplicaSpecs != nil {
in, out := &in.PyTorchReplicaSpecs, &out.PyTorchReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PyTorchJobSpec.
func (in *PyTorchJobSpec) DeepCopy() *PyTorchJobSpec {
if in == nil {
return nil
}
out := new(PyTorchJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RDZVConf) DeepCopyInto(out *RDZVConf) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RDZVConf.
func (in *RDZVConf) DeepCopy() *RDZVConf {
if in == nil {
return nil
}
out := new(RDZVConf)
in.DeepCopyInto(out)
return out
}
@@ -1,44 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&PyTorchJob{}, func(obj interface{}) { SetObjectDefaults_PyTorchJob(obj.(*PyTorchJob)) })
scheme.AddTypeDefaultingFunc(&PyTorchJobList{}, func(obj interface{}) { SetObjectDefaults_PyTorchJobList(obj.(*PyTorchJobList)) })
return nil
}
func SetObjectDefaults_PyTorchJob(in *PyTorchJob) {
SetDefaults_PyTorchJob(in)
}
func SetObjectDefaults_PyTorchJobList(in *PyTorchJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_PyTorchJob(a)
}
}
-23
View File
@@ -1,23 +0,0 @@
// Copyright 2020 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
// SuccessPolicy is the success policy.
type SuccessPolicy string
const (
SuccessPolicyDefault SuccessPolicy = ""
SuccessPolicyAllWorkers SuccessPolicy = "AllWorkers"
)
-39
View File
@@ -1,39 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
common "github.com/kubeflow/common/pkg/apis/common/v1"
)
const (
// DefaultPortName is name of the port used to communicate between PS and
// workers.
DefaultPortName = "tfjob-port"
// DefaultContainerName is the name of the TFJob container.
DefaultContainerName = "tensorflow"
// DefaultPort is default value of the port.
DefaultPort = 2222
// DefaultRestartPolicy is default RestartPolicy for TFReplicaSpec.
DefaultRestartPolicy = common.RestartPolicyNever
// Kind is the kind name.
Kind = "TFJob"
// Plural is the Plural for TFJob.
Plural = "tfjobs"
// Singular is the singular for TFJob.
Singular = "tfjob"
// FrameworkName is the name of the ML Framework
FrameworkName = "tensorflow"
)
-115
View File
@@ -1,115 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"strings"
"k8s.io/apimachinery/pkg/runtime"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
v1 "k8s.io/api/core/v1"
)
// Int32 is a helper routine that allocates a new int32 value
// to store v and returns a pointer to it.
func Int32(v int32) *int32 {
return &v
}
// addDefaultingFuncs is used to register default funcs
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setDefaultPort sets the default ports for tensorflow container.
func setDefaultPort(spec *v1.PodSpec) {
index := 0
for i, container := range spec.Containers {
if container.Name == DefaultContainerName {
index = i
break
}
}
hasTFJobPort := false
for _, port := range spec.Containers[index].Ports {
if port.Name == DefaultPortName {
hasTFJobPort = true
break
}
}
if !hasTFJobPort {
spec.Containers[index].Ports = append(spec.Containers[index].Ports, v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
})
}
}
func setDefaultReplicas(spec *commonv1.ReplicaSpec) {
if spec.Replicas == nil {
spec.Replicas = Int32(1)
}
if spec.RestartPolicy == "" {
spec.RestartPolicy = DefaultRestartPolicy
}
}
// setTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setTypeNamesToCamelCase(tfJob *TFJob) {
setTypeNameToCamelCase(tfJob, TFReplicaTypePS)
setTypeNameToCamelCase(tfJob, TFReplicaTypeWorker)
setTypeNameToCamelCase(tfJob, TFReplicaTypeChief)
setTypeNameToCamelCase(tfJob, TFReplicaTypeMaster)
setTypeNameToCamelCase(tfJob, TFReplicaTypeEval)
}
// setTypeNameToCamelCase sets the name of the replica type from any case to correct case.
// E.g. from ps to PS; from WORKER to Worker.
func setTypeNameToCamelCase(tfJob *TFJob, typ commonv1.ReplicaType) {
for t := range tfJob.Spec.TFReplicaSpecs {
if strings.EqualFold(string(t), string(typ)) && t != typ {
spec := tfJob.Spec.TFReplicaSpecs[t]
delete(tfJob.Spec.TFReplicaSpecs, t)
tfJob.Spec.TFReplicaSpecs[typ] = spec
return
}
}
}
// SetDefaults_TFJob sets any unspecified values to defaults.
func SetDefaults_TFJob(tfjob *TFJob) {
// Set default cleanpod policy to Running.
if tfjob.Spec.RunPolicy.CleanPodPolicy == nil {
running := commonv1.CleanPodPolicyRunning
tfjob.Spec.RunPolicy.CleanPodPolicy = &running
}
// Set default success policy to "".
if tfjob.Spec.SuccessPolicy == nil {
defaultPolicy := SuccessPolicyDefault
tfjob.Spec.SuccessPolicy = &defaultPolicy
}
// Update the key of TFReplicaSpecs to camel case.
setTypeNamesToCamelCase(tfjob)
for _, spec := range tfjob.Spec.TFReplicaSpecs {
// Set default replicas to 1.
setDefaultReplicas(spec)
// Set default port to tensorFlow container.
setDefaultPort(&spec.Template.Spec)
}
}
-20
View File
@@ -1,20 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// Package v1 is the v1 version of the API.
// +groupName=kubeflow.org
package v1
@@ -1,34 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package v1 contains API Schema definitions for the kubeflow.org v1 API group
//+kubebuilder:object:generate=true
//+groupName=kubeflow.org
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "kubeflow.org", Version: "v1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
-488
View File
@@ -1,488 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition": schema_pkg_apis_common_v1_JobCondition(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus": schema_pkg_apis_common_v1_JobStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec": schema_pkg_apis_common_v1_ReplicaSpec(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus": schema_pkg_apis_common_v1_ReplicaStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy": schema_pkg_apis_common_v1_RunPolicy(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy": schema_pkg_apis_common_v1_SchedulingPolicy(ref),
"github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJob": schema_pkg_apis_tensorflow_v1_TFJob(ref),
"github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJobList": schema_pkg_apis_tensorflow_v1_TFJobList(ref),
"github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJobSpec": schema_pkg_apis_tensorflow_v1_TFJobSpec(ref),
}
}
func schema_pkg_apis_common_v1_JobCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobCondition describes the state of the job at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type of job condition.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status of the condition, one of True, False, Unknown.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"reason": {
SchemaProps: spec.SchemaProps{
Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "A human readable message indicating details about the transition.",
Type: []string{"string"},
Format: "",
},
},
"lastUpdateTime": {
SchemaProps: spec.SchemaProps{
Description: "The last time this condition was updated.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastTransitionTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition transitioned from one status to another.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"type", "status"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_JobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobStatus represents the current observed state of the training Job.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"conditions": {
SchemaProps: spec.SchemaProps{
Description: "Conditions is an array of current observed job conditions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobCondition"),
},
},
},
},
},
"replicaStatuses": {
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus"),
},
},
},
},
},
"startTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"completionTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastReconcileTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents last time when the job was reconciled. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"conditions", "replicaStatuses"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition", "github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_ReplicaSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaSpec is a description of the replica",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "Replicas is the desired number of replicas of the given template. If unspecified, defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "Template is the object that describes the pod that will be created for this replica. RestartPolicy in PodTemplateSpec will be overide by RestartPolicy in ReplicaSpec",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"),
},
},
"restartPolicy": {
SchemaProps: spec.SchemaProps{
Description: "Restart policy for all replicas within the job. One of Always, OnFailure, Never and ExitCode. Default to Never.",
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/core/v1.PodTemplateSpec"},
}
}
func schema_pkg_apis_common_v1_ReplicaStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatus represents the current observed state of the replica.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "The number of actively running pods.",
Type: []string{"integer"},
Format: "int32",
},
},
"succeeded": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Succeeded.",
Type: []string{"integer"},
Format: "int32",
},
},
"failed": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"labelSelector": {
SchemaProps: spec.SchemaProps{
Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}
func schema_pkg_apis_common_v1_RunPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"cleanPodPolicy": {
SchemaProps: spec.SchemaProps{
Description: "CleanPodPolicy defines the policy to kill pods after the job completes. Default to Running.",
Type: []string{"string"},
Format: "",
},
},
"ttlSecondsAfterFinished": {
SchemaProps: spec.SchemaProps{
Description: "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.",
Type: []string{"integer"},
Format: "int32",
},
},
"activeDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
Type: []string{"integer"},
Format: "int64",
},
},
"backoffLimit": {
SchemaProps: spec.SchemaProps{
Description: "Optional number of retries before marking this job failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"schedulingPolicy": {
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy defines the policy related to scheduling, e.g. gang-scheduling",
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"},
}
}
func schema_pkg_apis_common_v1_SchedulingPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy encapsulates various scheduling policies of the distributed training job, for example `minAvailable` for gang-scheduling.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"minAvailable": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"queue": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"minResources": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
},
},
},
},
},
"priorityClass": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
func schema_pkg_apis_tensorflow_v1_TFJob(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "TFJob represents a TFJob resource.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "Specification of the desired state of the TFJob.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Most recently observed status of the TFJob. Populated by the system. Read-only.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus", "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJobSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_pkg_apis_tensorflow_v1_TFJobList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "TFJobList is a list of TFJobs.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "List of TFJobs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1.TFJob", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_tensorflow_v1_TFJobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "TFJobSpec is a desired state description of the TFJob.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"runPolicy": {
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"),
},
},
"successPolicy": {
SchemaProps: spec.SchemaProps{
Description: "SuccessPolicy defines the policy to mark the TFJob as succeeded. Default to \"\", using the default rules.",
Type: []string{"string"},
Format: "",
},
},
"tfReplicaSpecs": {
SchemaProps: spec.SchemaProps{
Description: "A map of TFReplicaType (type) to ReplicaSpec (value). Specifies the TF cluster configuration. For example,\n {\n \"PS\": ReplicaSpec,\n \"Worker\": ReplicaSpec,\n }",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec"),
},
},
},
},
},
"enableDynamicWorker": {
SchemaProps: spec.SchemaProps{
Description: "A switch to enable dynamic worker",
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"runPolicy", "tfReplicaSpecs"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec", "github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"},
}
}
-27
View File
@@ -1,27 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
)
// SchemeGroupVersion is group version used to register these objects.
var SchemeGroupVersion = GroupVersion
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {
return GroupVersion.WithResource(resource).GroupResource()
}
-34
View File
@@ -1,34 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
// IsChieforMaster returns true if the type is Master or Chief.
func IsChieforMaster(typ commonv1.ReplicaType) bool {
return typ == TFReplicaTypeChief || typ == TFReplicaTypeMaster
}
// IsWorker returns true if the type is Worker.
func IsWorker(typ commonv1.ReplicaType) bool {
return typ == TFReplicaTypeWorker
}
// IsEvaluator returns true if the type is Evaluator.
func IsEvaluator(typ commonv1.ReplicaType) bool {
return typ == TFReplicaTypeEval
}
-48
View File
@@ -1,48 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"testing"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)
func TestIsChieforMaster(t *testing.T) {
tc := []struct {
Type commonv1.ReplicaType
Expected bool
}{
{
Type: TFReplicaTypeChief,
Expected: true,
},
{
Type: TFReplicaTypeMaster,
Expected: true,
},
{
Type: TFReplicaTypeWorker,
Expected: false,
},
}
for _, c := range tc {
actual := IsChieforMaster(c.Type)
if actual != c.Expected {
t.Errorf("Expected %v; Got %v", c.Expected, actual)
}
}
}
@@ -1,120 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TFJob) DeepCopyInto(out *TFJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TFJob.
func (in *TFJob) DeepCopy() *TFJob {
if in == nil {
return nil
}
out := new(TFJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TFJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TFJobList) DeepCopyInto(out *TFJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]TFJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TFJobList.
func (in *TFJobList) DeepCopy() *TFJobList {
if in == nil {
return nil
}
out := new(TFJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TFJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TFJobSpec) DeepCopyInto(out *TFJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.SuccessPolicy != nil {
in, out := &in.SuccessPolicy, &out.SuccessPolicy
*out = new(SuccessPolicy)
**out = **in
}
if in.TFReplicaSpecs != nil {
in, out := &in.TFReplicaSpecs, &out.TFReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TFJobSpec.
func (in *TFJobSpec) DeepCopy() *TFJobSpec {
if in == nil {
return nil
}
out := new(TFJobSpec)
in.DeepCopyInto(out)
return out
}
@@ -1,44 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&TFJob{}, func(obj interface{}) { SetObjectDefaults_TFJob(obj.(*TFJob)) })
scheme.AddTypeDefaultingFunc(&TFJobList{}, func(obj interface{}) { SetObjectDefaults_TFJobList(obj.(*TFJobList)) })
return nil
}
func SetObjectDefaults_TFJob(in *TFJob) {
SetDefaults_TFJob(in)
}
func SetObjectDefaults_TFJobList(in *TFJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_TFJob(a)
}
}
-36
View File
@@ -1,36 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
package v1
import commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
const (
// DefaultPortName is name of the port used to communicate between Master and Workers.
DefaultPortName = "xgboostjob-port"
// DefaultContainerName is the name of the XGBoostJob container.
DefaultContainerName = "xgboost"
// DefaultPort is default value of the port.
DefaultPort = 9999
// DefaultRestartPolicy is default RestartPolicy for XGBReplicaSpecs.
DefaultRestartPolicy = commonv1.RestartPolicyNever
// Kind is the kind name.
Kind = "XGBoostJob"
// Plural is the Plural for XGBoostJob.
Plural = "xgboostjobs"
// Singular is the singular for XGBoostJob.
Singular = "xgboostjob"
// FrameworkName is the name of the ML Framework
FrameworkName = "xgboost"
)
-107
View File
@@ -1,107 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
"strings"
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// Int32 is a helper routine that allocates a new int32 value
// to store v and returns a pointer to it.
func Int32(v int32) *int32 {
return &v
}
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
// setDefaultPort sets the default ports for mxnet container.
func setDefaultPort(spec *v1.PodSpec) {
index := 0
for i, container := range spec.Containers {
if container.Name == DefaultContainerName {
index = i
break
}
}
hasMXJobPort := false
for _, port := range spec.Containers[index].Ports {
if port.Name == DefaultPortName {
hasMXJobPort = true
break
}
}
if !hasMXJobPort {
spec.Containers[index].Ports = append(spec.Containers[index].Ports, v1.ContainerPort{
Name: DefaultPortName,
ContainerPort: DefaultPort,
})
}
}
func setDefaultReplicas(spec *commonv1.ReplicaSpec) {
if spec.Replicas == nil {
spec.Replicas = Int32(1)
}
if spec.RestartPolicy == "" {
spec.RestartPolicy = DefaultRestartPolicy
}
}
// setTypeNamesToCamelCase sets the name of all replica types from any case to correct case.
func setTypeNamesToCamelCase(xgboostJob *XGBoostJob) {
setTypeNameToCamelCase(xgboostJob, XGBoostReplicaTypeMaster)
setTypeNameToCamelCase(xgboostJob, XGBoostReplicaTypeWorker)
}
// setTypeNameToCamelCase sets the name of the replica type from any case to correct case.
// E.g. from server to Server; from WORKER to Worker.
func setTypeNameToCamelCase(xgboostJob *XGBoostJob, typ commonv1.ReplicaType) {
for t := range xgboostJob.Spec.XGBReplicaSpecs {
if strings.EqualFold(string(t), string(typ)) && t != typ {
spec := xgboostJob.Spec.XGBReplicaSpecs[t]
delete(xgboostJob.Spec.XGBReplicaSpecs, t)
xgboostJob.Spec.XGBReplicaSpecs[typ] = spec
return
}
}
}
// SetDefaults_XGBoostJob sets any unspecified values to defaults.
func SetDefaults_XGBoostJob(xgboostJob *XGBoostJob) {
// Set default cleanpod policy to All.
if xgboostJob.Spec.RunPolicy.CleanPodPolicy == nil {
all := commonv1.CleanPodPolicyAll
xgboostJob.Spec.RunPolicy.CleanPodPolicy = &all
}
// Update the key of MXReplicaSpecs to camel case.
setTypeNamesToCamelCase(xgboostJob)
for _, spec := range xgboostJob.Spec.XGBReplicaSpecs {
// Set default replicas to 1.
setDefaultReplicas(spec)
// Set default port to mxnet container.
setDefaultPort(&spec.Template.Spec)
}
}
-20
View File
@@ -1,20 +0,0 @@
// Copyright 2018 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// Package v1 is the v1 version of the API.
// +groupName=kubeflow.org
package v1
-34
View File
@@ -1,34 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package v1 contains API Schema definitions for the kubeflow.org v1 API group
//+kubebuilder:object:generate=true
//+groupName=kubeflow.org
package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "kubeflow.org", Version: "v1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
-469
View File
@@ -1,469 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition": schema_pkg_apis_common_v1_JobCondition(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus": schema_pkg_apis_common_v1_JobStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec": schema_pkg_apis_common_v1_ReplicaSpec(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus": schema_pkg_apis_common_v1_ReplicaStatus(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy": schema_pkg_apis_common_v1_RunPolicy(ref),
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy": schema_pkg_apis_common_v1_SchedulingPolicy(ref),
"github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJob": schema_pkg_apis_xgboost_v1_XGBoostJob(ref),
"github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJobList": schema_pkg_apis_xgboost_v1_XGBoostJobList(ref),
"github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJobSpec": schema_pkg_apis_xgboost_v1_XGBoostJobSpec(ref),
}
}
func schema_pkg_apis_common_v1_JobCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobCondition describes the state of the job at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type of job condition.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status of the condition, one of True, False, Unknown.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"reason": {
SchemaProps: spec.SchemaProps{
Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "A human readable message indicating details about the transition.",
Type: []string{"string"},
Format: "",
},
},
"lastUpdateTime": {
SchemaProps: spec.SchemaProps{
Description: "The last time this condition was updated.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastTransitionTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition transitioned from one status to another.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"type", "status"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_JobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobStatus represents the current observed state of the training Job.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"conditions": {
SchemaProps: spec.SchemaProps{
Description: "Conditions is an array of current observed job conditions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobCondition"),
},
},
},
},
},
"replicaStatuses": {
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatuses is map of ReplicaType and ReplicaStatus, specifies the status of each replica.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus"),
},
},
},
},
},
"startTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"completionTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastReconcileTime": {
SchemaProps: spec.SchemaProps{
Description: "Represents last time when the job was reconciled. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
},
Required: []string{"conditions", "replicaStatuses"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobCondition", "github.com/kubeflow/common/pkg/apis/common/v1.ReplicaStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_common_v1_ReplicaSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaSpec is a description of the replica",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "Replicas is the desired number of replicas of the given template. If unspecified, defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "Template is the object that describes the pod that will be created for this replica. RestartPolicy in PodTemplateSpec will be overide by RestartPolicy in ReplicaSpec",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"),
},
},
"restartPolicy": {
SchemaProps: spec.SchemaProps{
Description: "Restart policy for all replicas within the job. One of Always, OnFailure, Never and ExitCode. Default to Never.",
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/core/v1.PodTemplateSpec"},
}
}
func schema_pkg_apis_common_v1_ReplicaStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ReplicaStatus represents the current observed state of the replica.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "The number of actively running pods.",
Type: []string{"integer"},
Format: "int32",
},
},
"succeeded": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Succeeded.",
Type: []string{"integer"},
Format: "int32",
},
},
"failed": {
SchemaProps: spec.SchemaProps{
Description: "The number of pods which reached phase Failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"labelSelector": {
SchemaProps: spec.SchemaProps{
Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}
func schema_pkg_apis_common_v1_RunPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RunPolicy encapsulates various runtime policies of the distributed training job, for example how to clean up resources and how long the job can stay active.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"cleanPodPolicy": {
SchemaProps: spec.SchemaProps{
Description: "CleanPodPolicy defines the policy to kill pods after the job completes. Default to Running.",
Type: []string{"string"},
Format: "",
},
},
"ttlSecondsAfterFinished": {
SchemaProps: spec.SchemaProps{
Description: "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.",
Type: []string{"integer"},
Format: "int32",
},
},
"activeDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
Type: []string{"integer"},
Format: "int64",
},
},
"backoffLimit": {
SchemaProps: spec.SchemaProps{
Description: "Optional number of retries before marking this job failed.",
Type: []string{"integer"},
Format: "int32",
},
},
"schedulingPolicy": {
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy defines the policy related to scheduling, e.g. gang-scheduling",
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.SchedulingPolicy"},
}
}
func schema_pkg_apis_common_v1_SchedulingPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SchedulingPolicy encapsulates various scheduling policies of the distributed training job, for example `minAvailable` for gang-scheduling.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"minAvailable": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"queue": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"minResources": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
},
},
},
},
},
"priorityClass": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
func schema_pkg_apis_xgboost_v1_XGBoostJob(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "XGBoostJob is the Schema for the xgboostjobs API",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.JobStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.JobStatus", "github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJobSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_pkg_apis_xgboost_v1_XGBoostJobList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "XGBoostJobList contains a list of XGBoostJob",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/kubeflow/training-operator/pkg/apis/xgboost/v1.XGBoostJob", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_xgboost_v1_XGBoostJobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "XGBoostJobSpec defines the desired state of XGBoostJob",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"runPolicy": {
SchemaProps: spec.SchemaProps{
Description: "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file",
Default: map[string]interface{}{},
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"),
},
},
"xgbReplicaSpecs": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec"),
},
},
},
},
},
},
Required: []string{"runPolicy", "xgbReplicaSpecs"},
},
},
Dependencies: []string{
"github.com/kubeflow/common/pkg/apis/common/v1.ReplicaSpec", "github.com/kubeflow/common/pkg/apis/common/v1.RunPolicy"},
}
}
-25
View File
@@ -1,25 +0,0 @@
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
package v1
import "k8s.io/apimachinery/pkg/runtime/schema"
// SchemeGroupVersion is group version used to register these objects.
var SchemeGroupVersion = GroupVersion
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {
return GroupVersion.WithResource(resource).GroupResource()
}
@@ -1,115 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *XGBoostJob) DeepCopyInto(out *XGBoostJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XGBoostJob.
func (in *XGBoostJob) DeepCopy() *XGBoostJob {
if in == nil {
return nil
}
out := new(XGBoostJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *XGBoostJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *XGBoostJobList) DeepCopyInto(out *XGBoostJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]XGBoostJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XGBoostJobList.
func (in *XGBoostJobList) DeepCopy() *XGBoostJobList {
if in == nil {
return nil
}
out := new(XGBoostJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *XGBoostJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *XGBoostJobSpec) DeepCopyInto(out *XGBoostJobSpec) {
*out = *in
in.RunPolicy.DeepCopyInto(&out.RunPolicy)
if in.XGBReplicaSpecs != nil {
in, out := &in.XGBReplicaSpecs, &out.XGBReplicaSpecs
*out = make(map[commonv1.ReplicaType]*commonv1.ReplicaSpec, len(*in))
for key, val := range *in {
var outVal *commonv1.ReplicaSpec
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = new(commonv1.ReplicaSpec)
(*in).DeepCopyInto(*out)
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XGBoostJobSpec.
func (in *XGBoostJobSpec) DeepCopy() *XGBoostJobSpec {
if in == nil {
return nil
}
out := new(XGBoostJobSpec)
in.DeepCopyInto(out)
return out
}
@@ -1,44 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Copyright 2021 The Kubeflow Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&XGBoostJob{}, func(obj interface{}) { SetObjectDefaults_XGBoostJob(obj.(*XGBoostJob)) })
scheme.AddTypeDefaultingFunc(&XGBoostJobList{}, func(obj interface{}) { SetObjectDefaults_XGBoostJobList(obj.(*XGBoostJobList)) })
return nil
}
func SetObjectDefaults_XGBoostJob(in *XGBoostJob) {
SetDefaults_XGBoostJob(in)
}
func SetObjectDefaults_XGBoostJobList(in *XGBoostJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_XGBoostJob(a)
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"fmt"
"net/http"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/tensorflow/v1"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
@@ -18,8 +18,8 @@ package fake
import (
clientset "github.com/kubeflow/training-operator/pkg/client/clientset/versioned"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/tensorflow/v1"
fakekubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/tensorflow/v1/fake"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v1"
fakekubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
@@ -17,7 +17,7 @@
package fake
import (
kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@@ -17,7 +17,7 @@
package scheme
import (
kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/tensorflow/v1"
kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"

Some files were not shown because too many files have changed in this diff Show More