From de6c28b56b29f5c80d1e90c21cebaecafdf0509f Mon Sep 17 00:00:00 2001 From: Varsha Date: Thu, 10 Oct 2024 12:50:10 -0700 Subject: [PATCH] KEP-2170: Generate clientset, openapi spec for the V2 APIs (#2273) Generate clientset, informers, listers and open api spec for v2alpha1 APIs. Signed-off-by: Varsha Prasad Narsing --- hack/boilerplate/boilerplate.go.txt | 2 +- hack/update-codegen.sh | 13 +- ...ption.list => violation_exception_v1.list} | 0 hack/violation_exception_v2alpha1.list | 21 + pkg/apis/kubeflow.org/v1/doc.go | 1 + pkg/apis/kubeflow.org/v1/openapi_generated.go | 2 +- .../kubeflow.org/v1/zz_generated.deepcopy.go | 2 +- .../kubeflow.org/v1/zz_generated.defaults.go | 2 +- pkg/apis/kubeflow.org/v2alpha1/doc.go | 22 + .../v2alpha1/openapi_generated.go | 1278 +++++++++++++++++ pkg/apis/kubeflow.org/v2alpha1/register.go | 24 + .../v2alpha1/trainingruntime_types.go | 11 + .../kubeflow.org/v2alpha1/trainjob_types.go | 5 + .../v2alpha1/zz_generated.deepcopy.go | 2 +- pkg/client/clientset/versioned/clientset.go | 17 +- .../versioned/fake/clientset_generated.go | 9 +- pkg/client/clientset/versioned/fake/doc.go | 2 +- .../clientset/versioned/fake/register.go | 4 +- pkg/client/clientset/versioned/scheme/doc.go | 2 +- .../clientset/versioned/scheme/register.go | 4 +- .../versioned/typed/kubeflow.org/v1/doc.go | 2 +- .../typed/kubeflow.org/v1/fake/doc.go | 2 +- .../typed/kubeflow.org/v1/fake/fake_jaxjob.go | 2 +- .../v1/fake/fake_kubeflow.org_client.go | 2 +- .../typed/kubeflow.org/v1/fake/fake_mpijob.go | 2 +- .../kubeflow.org/v1/fake/fake_paddlejob.go | 2 +- .../kubeflow.org/v1/fake/fake_pytorchjob.go | 2 +- .../typed/kubeflow.org/v1/fake/fake_tfjob.go | 2 +- .../kubeflow.org/v1/fake/fake_xgboostjob.go | 2 +- .../kubeflow.org/v1/generated_expansion.go | 2 +- .../versioned/typed/kubeflow.org/v1/jaxjob.go | 2 +- .../kubeflow.org/v1/kubeflow.org_client.go | 2 +- .../versioned/typed/kubeflow.org/v1/mpijob.go | 2 +- .../typed/kubeflow.org/v1/paddlejob.go | 2 +- .../typed/kubeflow.org/v1/pytorchjob.go | 2 +- .../versioned/typed/kubeflow.org/v1/tfjob.go | 2 +- .../typed/kubeflow.org/v1/xgboostjob.go | 2 +- .../v2alpha1/clustertrainingruntime.go | 166 +++ .../typed/kubeflow.org/v2alpha1/doc.go | 18 + .../typed/kubeflow.org/v2alpha1/fake/doc.go | 18 + .../fake/fake_clustertrainingruntime.go | 119 ++ .../v2alpha1/fake/fake_kubeflow.org_client.go | 46 + .../v2alpha1/fake/fake_trainingruntime.go | 127 ++ .../v2alpha1/fake/fake_trainjob.go | 139 ++ .../v2alpha1/generated_expansion.go | 23 + .../v2alpha1/kubeflow.org_client.go | 115 ++ .../kubeflow.org/v2alpha1/trainingruntime.go | 176 +++ .../typed/kubeflow.org/v2alpha1/trainjob.go | 193 +++ .../informers/externalversions/factory.go | 2 +- .../informers/externalversions/generic.go | 11 +- .../internalinterfaces/factory_interfaces.go | 2 +- .../kubeflow.org/interface.go | 10 +- .../kubeflow.org/v1/interface.go | 2 +- .../kubeflow.org/v1/jaxjob.go | 2 +- .../kubeflow.org/v1/mpijob.go | 2 +- .../kubeflow.org/v1/paddlejob.go | 2 +- .../kubeflow.org/v1/pytorchjob.go | 2 +- .../externalversions/kubeflow.org/v1/tfjob.go | 2 +- .../kubeflow.org/v1/xgboostjob.go | 2 +- .../v2alpha1/clustertrainingruntime.go | 87 ++ .../kubeflow.org/v2alpha1/interface.go | 57 + .../kubeflow.org/v2alpha1/trainingruntime.go | 88 ++ .../kubeflow.org/v2alpha1/trainjob.go | 88 ++ .../kubeflow.org/v1/expansion_generated.go | 2 +- pkg/client/listers/kubeflow.org/v1/jaxjob.go | 2 +- pkg/client/listers/kubeflow.org/v1/mpijob.go | 2 +- .../listers/kubeflow.org/v1/paddlejob.go | 2 +- .../listers/kubeflow.org/v1/pytorchjob.go | 2 +- pkg/client/listers/kubeflow.org/v1/tfjob.go | 2 +- .../listers/kubeflow.org/v1/xgboostjob.go | 2 +- .../v2alpha1/clustertrainingruntime.go | 66 + .../v2alpha1/expansion_generated.go | 37 + .../kubeflow.org/v2alpha1/trainingruntime.go | 97 ++ .../listers/kubeflow.org/v2alpha1/trainjob.go | 97 ++ 74 files changed, 3217 insertions(+), 50 deletions(-) rename hack/{violation_exception.list => violation_exception_v1.list} (100%) create mode 100644 hack/violation_exception_v2alpha1.list create mode 100644 pkg/apis/kubeflow.org/v2alpha1/doc.go create mode 100644 pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go create mode 100644 pkg/apis/kubeflow.org/v2alpha1/register.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_clustertrainingruntime.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_kubeflow.org_client.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainingruntime.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainjob.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/kubeflow.org_client.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go create mode 100644 pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainjob.go create mode 100644 pkg/client/informers/externalversions/kubeflow.org/v2alpha1/clustertrainingruntime.go create mode 100644 pkg/client/informers/externalversions/kubeflow.org/v2alpha1/interface.go create mode 100644 pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainingruntime.go create mode 100644 pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainjob.go create mode 100644 pkg/client/listers/kubeflow.org/v2alpha1/clustertrainingruntime.go create mode 100644 pkg/client/listers/kubeflow.org/v2alpha1/expansion_generated.go create mode 100644 pkg/client/listers/kubeflow.org/v2alpha1/trainingruntime.go create mode 100644 pkg/client/listers/kubeflow.org/v2alpha1/trainjob.go diff --git a/hack/boilerplate/boilerplate.go.txt b/hack/boilerplate/boilerplate.go.txt index 7b2921b026..cd47562a1e 100644 --- a/hack/boilerplate/boilerplate.go.txt +++ b/hack/boilerplate/boilerplate.go.txt @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 3ff8b5e6d5..eadecc7414 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -72,10 +72,10 @@ chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. cd ${SCRIPT_ROOT} -echo "Generating client,lister,informer for kubeflow.org/v1" +echo "Generating client,lister,informer for kubeflow.org/v1 and kubeflow.org/v2alpha1" ${CODEGEN_PKG}/generate-groups.sh "client,lister,informer" \ github.com/kubeflow/training-operator/pkg/client github.com/kubeflow/training-operator/pkg/apis \ - kubeflow.org:v1 \ + kubeflow.org:v1,v2alpha1 \ --output-base "${TEMP_DIR}" \ --go-header-file hack/boilerplate/boilerplate.go.txt @@ -101,11 +101,18 @@ go build -o openapi-gen ${OPENAPI_PKG}/cmd/openapi-gen echo "Generating OpenAPI specification for kubeflow.org/v1" ./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \ - --report-filename=hack/violation_exception.list \ + --report-filename=hack/violation_exception_v1.list \ --output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \ --go-header-file hack/boilerplate/boilerplate.go.txt "$@" \ --output-base "${TEMP_DIR}" +echo "Generating OpenAPI specification for kubeflow.org/v2alpha1" +./openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1 \ + --report-filename=hack/violation_exception_v2alpha1.list \ + --output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1 \ + --go-header-file hack/boilerplate/boilerplate.go.txt "$@" \ + --output-base "${TEMP_DIR}" + cd - >/dev/null # Copy everything back. diff --git a/hack/violation_exception.list b/hack/violation_exception_v1.list similarity index 100% rename from hack/violation_exception.list rename to hack/violation_exception_v1.list diff --git a/hack/violation_exception_v2alpha1.list b/hack/violation_exception_v2alpha1.list new file mode 100644 index 0000000000..42ef0a81d8 --- /dev/null +++ b/hack/violation_exception_v2alpha1.list @@ -0,0 +1,21 @@ +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Args +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Command +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,Env +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,EnvFrom +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,ContainerOverride,VolumeMounts +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,DatasetConfig,Env +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,InputModel,Env +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,OutputModel,Env +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Containers +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,InitContainers +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,TargetReplicatedJobs +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Tolerations +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,PodSpecOverride,Volumes +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TorchElasticPolicy,Metrics +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobSpec,PodSpecOverrides +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobStatus,Conditions +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,TrainJobStatus,ReplicatedJobsStatus +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Args +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Command +API rule violation: list_type_missing,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,Trainer,Env +API rule violation: names_match,github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1,MPIMLPolicySource,SSHAuthMountPath diff --git a/pkg/apis/kubeflow.org/v1/doc.go b/pkg/apis/kubeflow.org/v1/doc.go index 4289943d81..ccbb3319ba 100644 --- a/pkg/apis/kubeflow.org/v1/doc.go +++ b/pkg/apis/kubeflow.org/v1/doc.go @@ -14,6 +14,7 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package // Package v1 is the v1 version of the API. // +groupName=kubeflow.org diff --git a/pkg/apis/kubeflow.org/v1/openapi_generated.go b/pkg/apis/kubeflow.org/v1/openapi_generated.go index 560f2b278a..c7e3547214 100644 --- a/pkg/apis/kubeflow.org/v1/openapi_generated.go +++ b/pkg/apis/kubeflow.org/v1/openapi_generated.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/apis/kubeflow.org/v1/zz_generated.deepcopy.go b/pkg/apis/kubeflow.org/v1/zz_generated.deepcopy.go index 52ce7b75e6..6fb63e4e6a 100644 --- a/pkg/apis/kubeflow.org/v1/zz_generated.deepcopy.go +++ b/pkg/apis/kubeflow.org/v1/zz_generated.deepcopy.go @@ -1,6 +1,6 @@ //go:build !ignore_autogenerated -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/apis/kubeflow.org/v1/zz_generated.defaults.go b/pkg/apis/kubeflow.org/v1/zz_generated.defaults.go index 564b5ba7e6..0f0c399ad8 100644 --- a/pkg/apis/kubeflow.org/v1/zz_generated.defaults.go +++ b/pkg/apis/kubeflow.org/v1/zz_generated.defaults.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/apis/kubeflow.org/v2alpha1/doc.go b/pkg/apis/kubeflow.org/v2alpha1/doc.go new file mode 100644 index 0000000000..f2bda23573 --- /dev/null +++ b/pkg/apis/kubeflow.org/v2alpha1/doc.go @@ -0,0 +1,22 @@ +// Copyright 2024 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 +// +k8s:deepcopy-gen=package + +// Package v2alpha1 is the v2alpha1 version of the API. +// +groupName=kubeflow.org + +package v2alpha1 diff --git a/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go b/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go new file mode 100644 index 0000000000..10a47600a9 --- /dev/null +++ b/pkg/apis/kubeflow.org/v2alpha1/openapi_generated.go @@ -0,0 +1,1278 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright 2024 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 v2alpha1 + +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/training-operator/pkg/apis/kubeflow.org/v2alpha1.ClusterTrainingRuntime": schema_pkg_apis_kubefloworg_v2alpha1_ClusterTrainingRuntime(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ClusterTrainingRuntimeList": schema_pkg_apis_kubefloworg_v2alpha1_ClusterTrainingRuntimeList(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ContainerOverride": schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.CoschedulingPodGroupPolicySource": schema_pkg_apis_kubefloworg_v2alpha1_CoschedulingPodGroupPolicySource(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.DatasetConfig": schema_pkg_apis_kubefloworg_v2alpha1_DatasetConfig(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.InputModel": schema_pkg_apis_kubefloworg_v2alpha1_InputModel(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.JobSetTemplateSpec": schema_pkg_apis_kubefloworg_v2alpha1_JobSetTemplateSpec(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MLPolicy": schema_pkg_apis_kubefloworg_v2alpha1_MLPolicy(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MLPolicySource": schema_pkg_apis_kubefloworg_v2alpha1_MLPolicySource(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MPIMLPolicySource": schema_pkg_apis_kubefloworg_v2alpha1_MPIMLPolicySource(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ModelConfig": schema_pkg_apis_kubefloworg_v2alpha1_ModelConfig(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.OutputModel": schema_pkg_apis_kubefloworg_v2alpha1_OutputModel(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.PodGroupPolicy": schema_pkg_apis_kubefloworg_v2alpha1_PodGroupPolicy(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.PodGroupPolicySource": schema_pkg_apis_kubefloworg_v2alpha1_PodGroupPolicySource(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.PodSpecOverride": schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchElasticPolicy": schema_pkg_apis_kubefloworg_v2alpha1_TorchElasticPolicy(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchMLPolicySource": schema_pkg_apis_kubefloworg_v2alpha1_TorchMLPolicySource(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJob": schema_pkg_apis_kubefloworg_v2alpha1_TrainJob(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobList": schema_pkg_apis_kubefloworg_v2alpha1_TrainJobList(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobSpec": schema_pkg_apis_kubefloworg_v2alpha1_TrainJobSpec(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobStatus": schema_pkg_apis_kubefloworg_v2alpha1_TrainJobStatus(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.Trainer": schema_pkg_apis_kubefloworg_v2alpha1_Trainer(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntime": schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntime(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeList": schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntimeList(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeRef": schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntimeRef(ref), + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeSpec": schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntimeSpec(ref), + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_ClusterTrainingRuntime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterTrainingRuntime represents a training runtime which can be referenced as part of `trainingRuntimeRef` API in TrainJob. This resource is a cluster-scoped and can be referenced by TrainJob that created in *any* namespace.", + 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 object's metadata.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired ClusterTrainingRuntime.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_ClusterTrainingRuntimeList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterTrainingRuntimeList is a collection of cluster training runtimes.", + 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 ClusterTrainingRuntimes.", + 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/kubeflow.org/v2alpha1.ClusterTrainingRuntime"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ClusterTrainingRuntime", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_ContainerOverride(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerOverrides represents parameters that can be overridden using PodSpecOverrides. Parameters from the Trainer, DatasetConfig, and ModelConfig will take precedence.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name for the container. TrainingRuntime must have this container.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "command": { + SchemaProps: spec.SchemaProps{ + Description: "Entrypoint commands for the training container.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "args": { + SchemaProps: spec.SchemaProps{ + Description: "Arguments to the entrypoint for the training container.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "env": { + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the container. These values will be merged with the TrainingRuntime's environments.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "envFrom": { + SchemaProps: spec.SchemaProps{ + Description: "List of sources to populate environment variables in the container. These values will be merged with the TrainingRuntime's environments.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvFromSource"), + }, + }, + }, + }, + }, + "volumeMounts": { + SchemaProps: spec.SchemaProps{ + Description: "Pod volumes to mount into the container's filesystem.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.VolumeMount"), + }, + }, + }, + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EnvFromSource", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.VolumeMount"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_CoschedulingPodGroupPolicySource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CoschedulingPodGroupPolicySource represents configuration for coscheduling plugin. The number of min members in the PodGroupSpec is always equal to the number of nodes.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "scheduleTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Time threshold to schedule PodGroup for gang-scheduling. If the scheduling timeout is equal to 0, the default value is used. Defaults to 60 seconds.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_DatasetConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DatasetConfig represents the desired dataset configuration. When this API is used, the training runtime must have the `dataset-initializer` container in the `Initializer` Job.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "storageUri": { + SchemaProps: spec.SchemaProps{ + Description: "Storage uri for the dataset provider.", + Type: []string{"string"}, + Format: "", + }, + }, + "env": { + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the dataset initializer container. These values will be merged with the TrainingRuntime's dataset initializer environments.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Reference to the TrainJob's secrets to download dataset.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_InputModel(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InputModel represents the desired pre-trained model configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "storageUri": { + SchemaProps: spec.SchemaProps{ + Description: "Storage uri for the model provider.", + Type: []string{"string"}, + Format: "", + }, + }, + "env": { + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the model initializer container. These values will be merged with the TrainingRuntime's model initializer environments.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Reference to the TrainJob's secrets to download model.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_JobSetTemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "JobSetTemplateSpec represents a template of the desired JobSet.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Metadata for custom JobSet's labels and annotations. JobSet name and namespace is equal to the TrainJob's name and namespace.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired JobSet which will be created from TrainJob.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/jobset/api/jobset/v1alpha2.JobSetSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "sigs.k8s.io/jobset/api/jobset/v1alpha2.JobSetSpec"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_MLPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MLPolicy represents configuration for the model trining with ML-specific parameters.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "numNodes": { + SchemaProps: spec.SchemaProps{ + Description: "Number of training nodes. Defaults to 1.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "torch": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration for the PyTorch runtime.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchMLPolicySource"), + }, + }, + "mpi": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration for the MPI Runtime.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MPIMLPolicySource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MPIMLPolicySource", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchMLPolicySource"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_MLPolicySource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MLPolicySource represents the runtime-specific configuration for various technologies. One of the following specs can be set.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "torch": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration for the PyTorch runtime.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchMLPolicySource"), + }, + }, + "mpi": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration for the MPI Runtime.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MPIMLPolicySource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MPIMLPolicySource", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchMLPolicySource"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_MPIMLPolicySource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MPIMLPolicySource represents a MPI runtime configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "numProcPerNode": { + SchemaProps: spec.SchemaProps{ + Description: "Number of processes per node. This value is equal to the number of slots for each node in the hostfile.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "mpiImplementation": { + SchemaProps: spec.SchemaProps{ + Description: "Implementation name for the MPI to create the appropriate hostfile. Defaults to OpenMPI.", + Type: []string{"string"}, + Format: "", + }, + }, + "SSHAuthMountPath": { + SchemaProps: spec.SchemaProps{ + Description: "Directory where SSH keys are mounted.", + Type: []string{"string"}, + Format: "", + }, + }, + "runLauncherAsNode": { + SchemaProps: spec.SchemaProps{ + Description: "Whether to run training process on the launcher Job. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_ModelConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModelConfig represents the desired model configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "input": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration of the pre-trained model. When this API is used, the training runtime must have the `model-initializer` container in the `Initializer` Job.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.InputModel"), + }, + }, + "output": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration of the trained model. When this API is used, the training runtime must have the `model-exporter` container in the `Exporter` Job.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.OutputModel"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.InputModel", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.OutputModel"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_OutputModel(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "OutputModel represents the desired trained model configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "storageUri": { + SchemaProps: spec.SchemaProps{ + Description: "Storage uri for the model exporter.", + Type: []string{"string"}, + Format: "", + }, + }, + "env": { + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the model exporter container. These values will be merged with the TrainingRuntime's model exporter environments.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Reference to the TrainJob's secrets to export model.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_PodGroupPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodGroupPolicy represents a PodGroup configuration for gang-scheduling.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "coscheduling": { + SchemaProps: spec.SchemaProps{ + Description: "Coscheduling plugin from the Kubernetes scheduler-plugins for gang-scheduling.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.CoschedulingPodGroupPolicySource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.CoschedulingPodGroupPolicySource"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_PodGroupPolicySource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodGroupPolicySource represents supported plugins for gang-scheduling. Only one of its members may be specified.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "coscheduling": { + SchemaProps: spec.SchemaProps{ + Description: "Coscheduling plugin from the Kubernetes scheduler-plugins for gang-scheduling.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.CoschedulingPodGroupPolicySource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.CoschedulingPodGroupPolicySource"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_PodSpecOverride(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodSpecOverride represents the custom overrides that will be applied for the TrainJob's resources.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetReplicatedJobs": { + SchemaProps: spec.SchemaProps{ + Description: "Names of the training job replicas in the training runtime template to apply the overrides.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "containers": { + SchemaProps: spec.SchemaProps{ + Description: "Overrides for the containers in the desired job templates.", + 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/kubeflow.org/v2alpha1.ContainerOverride"), + }, + }, + }, + }, + }, + "initContainers": { + SchemaProps: spec.SchemaProps{ + Description: "Overrides for the init container in the desired job templates.", + 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/kubeflow.org/v2alpha1.ContainerOverride"), + }, + }, + }, + }, + }, + "volumes": { + SchemaProps: spec.SchemaProps{ + Description: "Overrides for the Pod volume configuration.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.Volume"), + }, + }, + }, + }, + }, + "serviceAccountName": { + SchemaProps: spec.SchemaProps{ + Description: "Override for the service account.", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "Override for the node selector to place Pod on the specific mode.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "Override for the Pod's tolerations.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + }, + Required: []string{"targetReplicatedJobs"}, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ContainerOverride", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TorchElasticPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TorchElasticPolicy represents a configuration for the PyTorch elastic training. If this policy is set, the `.spec.numNodes` parameter must be omitted, since min and max node is used to configure the `torchrun` CLI argument: `--nnodes=minNodes:maxNodes`. Only `c10d` backend is supported for the Rendezvous communication.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "maxRestarts": { + SchemaProps: spec.SchemaProps{ + Description: "How many times the training job can be restarted. This value is inserted into the `--max-restarts` argument of the `torchrun` CLI and the `.spec.failurePolicy.maxRestarts` parameter of the training Job.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "minNodes": { + SchemaProps: spec.SchemaProps{ + Description: "Lower limit for the number of nodes to which training job can scale down.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "maxNodes": { + SchemaProps: spec.SchemaProps{ + Description: "Upper limit for the number of nodes to which training job can scale up.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "metrics": { + SchemaProps: spec.SchemaProps{ + Description: "Specification which are used to calculate the desired number of nodes. See the individual metric source types for more information about how each type of metric must respond. The HPA will be created to perform auto-scaling.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/autoscaling/v2.MetricSpec"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/autoscaling/v2.MetricSpec"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TorchMLPolicySource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TorchMLPolicySource represents a PyTorch runtime configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "numProcPerNode": { + SchemaProps: spec.SchemaProps{ + Description: "Number of processes per node. This value is inserted into the `--nproc-per-node` argument of the `torchrun` CLI. Supported values: `auto`, `cpu`, `gpu`, or int value. Defaults to `auto`.", + Type: []string{"string"}, + Format: "", + }, + }, + "elasticPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Elastic policy for the PyTorch training.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchElasticPolicy"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TorchElasticPolicy"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainJob(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainJob represents configuration of a training job.", + 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 object's metadata.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired TrainJob.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Current status of TrainJob.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobSpec", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJobStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainJobList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainJobList is a collection of training jobs.", + 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 TrainJobs.", + 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/kubeflow.org/v2alpha1.TrainJob"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainJob", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainJobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainJobSpec represents specification of the desired TrainJob.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "trainingRuntimeRef": { + SchemaProps: spec.SchemaProps{ + Description: "Reference to the training runtime.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeRef"), + }, + }, + "trainer": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration of the desired trainer.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.Trainer"), + }, + }, + "datasetConfig": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration of the training dataset.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.DatasetConfig"), + }, + }, + "modelConfig": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration of the pre-trained and trained model.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ModelConfig"), + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels to apply for the derivative JobSet and Jobs. They will be merged with the TrainingRuntime values.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations to apply for the derivative JobSet and Jobs. They will be merged with the TrainingRuntime values.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "podSpecOverrides": { + SchemaProps: spec.SchemaProps{ + Description: "Custom overrides for the training runtime.", + 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/kubeflow.org/v2alpha1.PodSpecOverride"), + }, + }, + }, + }, + }, + "suspend": { + SchemaProps: spec.SchemaProps{ + Description: "Whether the controller should suspend the running TrainJob. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "managedBy": { + SchemaProps: spec.SchemaProps{ + Description: "ManagedBy is used to indicate the controller or entity that manages a TrainJob. The value must be either an empty, `kubeflow.org/trainjob-controller` or `kueue.x-k8s.io/multikueue`. The built-in TrainJob controller reconciles TrainJob which don't have this field at all or the field value is the reserved string `kubeflow.org/trainjob-controller`, but delegates reconciling TrainJobs with a 'kueue.x-k8s.io/multikueue' to the Kueue. The field is immutable. Defaults to `kubeflow.org/trainjob-controller`", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"trainingRuntimeRef"}, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.DatasetConfig", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.ModelConfig", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.PodSpecOverride", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.Trainer", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeRef"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainJobStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainJobStatus represents the current status of TrainJob.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions for the TrainJob.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + "replicatedJobsStatus": { + SchemaProps: spec.SchemaProps{ + Description: "ReplicatedJobsStatus tracks the number of Jobs for each replicatedJob in TrainJob.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/jobset/api/jobset/v1alpha2.ReplicatedJobStatus"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition", "sigs.k8s.io/jobset/api/jobset/v1alpha2.ReplicatedJobStatus"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_Trainer(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Trainer represents the desired trainer configuration. Every training runtime contains `trainer` container which represents Trainer.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Description: "Docker image for the training container.", + Type: []string{"string"}, + Format: "", + }, + }, + "command": { + SchemaProps: spec.SchemaProps{ + Description: "Entrypoint commands for the training container.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "args": { + SchemaProps: spec.SchemaProps{ + Description: "Arguments to the entrypoint for the training container.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "env": { + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the training container. These values will be merged with the TrainingRuntime's trainer environments.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "numNodes": { + SchemaProps: spec.SchemaProps{ + Description: "Number of training nodes.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "resourcesPerNode": { + SchemaProps: spec.SchemaProps{ + Description: "Compute resources for each training node.", + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + }, + }, + "numProcPerNode": { + SchemaProps: spec.SchemaProps{ + Description: "Number of processes/workers/slots on every training node. For the Torch runtime: `auto`, `cpu`, `gpu`, or int value can be set. For the MPI runtime only int value can be set.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.ResourceRequirements"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainingRuntime represents a training runtime which can be referenced as part of `trainingRuntimeRef` API in TrainJob. This resource is a namespaced-scoped and can be referenced by TrainJob that created in the *same* namespace as the TrainingRuntime.", + 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 object's metadata.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired TrainingRuntime.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntimeSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntimeList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainingRuntimeList is a collection of training runtimes.", + 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 TrainingRuntimes.", + 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/kubeflow.org/v2alpha1.TrainingRuntime"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.TrainingRuntime", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntimeRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainingRuntimeRef represents the reference to the existing training runtime.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the runtime being referenced. When namespaced-scoped TrainingRuntime is used, the TrainJob must have the same namespace as the deployed runtime.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "apiGroup": { + SchemaProps: spec.SchemaProps{ + Description: "APIGroup of the runtime being referenced. Defaults to `kubeflow.org`.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the runtime being referenced. It must be one of TrainingRuntime or ClusterTrainingRuntime. Defaults to ClusterTrainingRuntime.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_pkg_apis_kubefloworg_v2alpha1_TrainingRuntimeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrainingRuntimeSpec represents a specification of the desired training runtime.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "mlPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration for the model training with ML-specific parameters.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MLPolicy"), + }, + }, + "podGroupPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Configuration for the PodGroup to enable gang-scheduling via supported plugins.", + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.PodGroupPolicy"), + }, + }, + "template": { + SchemaProps: spec.SchemaProps{ + Description: "JobSet template which will be used by TrainJob.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.JobSetTemplateSpec"), + }, + }, + }, + Required: []string{"template"}, + }, + }, + Dependencies: []string{ + "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.JobSetTemplateSpec", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.MLPolicy", "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1.PodGroupPolicy"}, + } +} diff --git a/pkg/apis/kubeflow.org/v2alpha1/register.go b/pkg/apis/kubeflow.org/v2alpha1/register.go new file mode 100644 index 0000000000..9d8659b757 --- /dev/null +++ b/pkg/apis/kubeflow.org/v2alpha1/register.go @@ -0,0 +1,24 @@ +// Copyright 2024 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 v2alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// Resource takes an unqualified resource and returns a Group-qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return GroupVersion.WithResource(resource).GroupResource() +} diff --git a/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go b/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go index 0a2917e68f..b63363be7b 100644 --- a/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go +++ b/pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go @@ -22,6 +22,10 @@ import ( jobsetv1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" ) +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=clustertrainingruntime // +kubebuilder:object:root=true // +kubebuilder:storageversion // +kubebuilder:resource:scope=Cluster @@ -39,6 +43,8 @@ type ClusterTrainingRuntime struct { Spec TrainingRuntimeSpec `json:"spec,omitempty"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=clustertrainingruntimes // +kubebuilder:object:root=true // ClusterTrainingRuntimeList is a collection of cluster training runtimes. @@ -52,6 +58,9 @@ type ClusterTrainingRuntimeList struct { Items []ClusterTrainingRuntime `json:"items"` } +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=trainingruntime // +kubebuilder:object:root=true // +kubebuilder:storageversion @@ -68,6 +77,8 @@ type TrainingRuntime struct { Spec TrainingRuntimeSpec `json:"spec,omitempty"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=trainingruntimes // +kubebuilder:object:root=true // TrainingRuntimeList is a collection of training runtimes. diff --git a/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go b/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go index 21a7271208..f77f50de95 100644 --- a/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go +++ b/pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go @@ -22,6 +22,8 @@ import ( jobsetv1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" ) +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:storageversion @@ -42,6 +44,9 @@ type TrainJob struct { Status TrainJobStatus `json:"status,omitempty"` } +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=trainjobs + // +kubebuilder:object:root=true // TrainJobList is a collection of training jobs. diff --git a/pkg/apis/kubeflow.org/v2alpha1/zz_generated.deepcopy.go b/pkg/apis/kubeflow.org/v2alpha1/zz_generated.deepcopy.go index ece81c5755..65773f998e 100644 --- a/pkg/apis/kubeflow.org/v2alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/kubeflow.org/v2alpha1/zz_generated.deepcopy.go @@ -1,6 +1,6 @@ //go:build !ignore_autogenerated -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 48976f19c8..891d9508a8 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. @@ -21,6 +21,7 @@ import ( "net/http" kubeflowv1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v1" + kubeflowv2alpha1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -29,12 +30,14 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface KubeflowV1() kubeflowv1.KubeflowV1Interface + KubeflowV2alpha1() kubeflowv2alpha1.KubeflowV2alpha1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - kubeflowV1 *kubeflowv1.KubeflowV1Client + kubeflowV1 *kubeflowv1.KubeflowV1Client + kubeflowV2alpha1 *kubeflowv2alpha1.KubeflowV2alpha1Client } // KubeflowV1 retrieves the KubeflowV1Client @@ -42,6 +45,11 @@ func (c *Clientset) KubeflowV1() kubeflowv1.KubeflowV1Interface { return c.kubeflowV1 } +// KubeflowV2alpha1 retrieves the KubeflowV2alpha1Client +func (c *Clientset) KubeflowV2alpha1() kubeflowv2alpha1.KubeflowV2alpha1Interface { + return c.kubeflowV2alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -90,6 +98,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.kubeflowV2alpha1, err = kubeflowv2alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -112,6 +124,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.kubeflowV1 = kubeflowv1.New(c) + cs.kubeflowV2alpha1 = kubeflowv2alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 9ed08506df..79099d552b 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. @@ -20,6 +20,8 @@ import ( clientset "github.com/kubeflow/training-operator/pkg/client/clientset/versioned" 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" + kubeflowv2alpha1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1" + fakekubeflowv2alpha1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -81,3 +83,8 @@ var ( func (c *Clientset) KubeflowV1() kubeflowv1.KubeflowV1Interface { return &fakekubeflowv1.FakeKubeflowV1{Fake: &c.Fake} } + +// KubeflowV2alpha1 retrieves the KubeflowV2alpha1Client +func (c *Clientset) KubeflowV2alpha1() kubeflowv2alpha1.KubeflowV2alpha1Interface { + return &fakekubeflowv2alpha1.FakeKubeflowV2alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go index aad8add991..061d108e56 100644 --- a/pkg/client/clientset/versioned/fake/doc.go +++ b/pkg/client/clientset/versioned/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index b104ea3d45..4a1bb11117 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. @@ -18,6 +18,7 @@ package fake import ( kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubeflowv2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,6 +31,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ kubeflowv1.AddToScheme, + kubeflowv2alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go index 64cf768531..103f11d7a7 100644 --- a/pkg/client/clientset/versioned/scheme/doc.go +++ b/pkg/client/clientset/versioned/scheme/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 790ecf93e5..efc66b1aaa 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. @@ -18,6 +18,7 @@ package scheme import ( kubeflowv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubeflowv2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,6 +31,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ kubeflowv1.AddToScheme, + kubeflowv2alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/doc.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/doc.go index 4f77d0b4f0..a40f7e875b 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/doc.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/doc.go index c2e3e6984a..424308ee3b 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/doc.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_jaxjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_jaxjob.go index ec2f6f7812..c3aab5610a 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_jaxjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_jaxjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_kubeflow.org_client.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_kubeflow.org_client.go index 07e08816dc..9b6a64203f 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_kubeflow.org_client.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_kubeflow.org_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_mpijob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_mpijob.go index c66463ab5c..283a5502ff 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_mpijob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_mpijob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_paddlejob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_paddlejob.go index 51215dc46c..6a9d3f1098 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_paddlejob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_paddlejob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_pytorchjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_pytorchjob.go index 9623605f9b..0bfcc58333 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_pytorchjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_pytorchjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_tfjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_tfjob.go index 0343f882a1..82205a1cca 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_tfjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_tfjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_xgboostjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_xgboostjob.go index b33ffc21b8..388566eaf2 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_xgboostjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/fake/fake_xgboostjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/generated_expansion.go index ff7ac08a40..5cd0ff8041 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/jaxjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/jaxjob.go index 5c624a059a..1794671601 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/jaxjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/jaxjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/kubeflow.org_client.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/kubeflow.org_client.go index 2ccda5ec28..10ab62757e 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/kubeflow.org_client.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/kubeflow.org_client.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/mpijob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/mpijob.go index 21de33f9ec..bbbbf44aad 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/mpijob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/mpijob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/paddlejob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/paddlejob.go index e8ab11ec67..8d3ebafafb 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/paddlejob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/paddlejob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/pytorchjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/pytorchjob.go index 9a69be4132..a778dce52e 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/pytorchjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/pytorchjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/tfjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/tfjob.go index 28e0f2d784..f0a6ea679b 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/tfjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/tfjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/xgboostjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/xgboostjob.go index 5877888a1c..665eb38b63 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/xgboostjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/xgboostjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go new file mode 100644 index 0000000000..c3be9e3613 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go @@ -0,0 +1,166 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "context" + "time" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterTrainingRuntimesGetter has a method to return a ClusterTrainingRuntimeInterface. +// A group's client should implement this interface. +type ClusterTrainingRuntimesGetter interface { + ClusterTrainingRuntimes() ClusterTrainingRuntimeInterface +} + +// ClusterTrainingRuntimeInterface has methods to work with ClusterTrainingRuntime resources. +type ClusterTrainingRuntimeInterface interface { + Create(ctx context.Context, clusterTrainingRuntime *v2alpha1.ClusterTrainingRuntime, opts v1.CreateOptions) (*v2alpha1.ClusterTrainingRuntime, error) + Update(ctx context.Context, clusterTrainingRuntime *v2alpha1.ClusterTrainingRuntime, opts v1.UpdateOptions) (*v2alpha1.ClusterTrainingRuntime, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.ClusterTrainingRuntime, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.ClusterTrainingRuntimeList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ClusterTrainingRuntime, err error) + ClusterTrainingRuntimeExpansion +} + +// clusterTrainingRuntimes implements ClusterTrainingRuntimeInterface +type clusterTrainingRuntimes struct { + client rest.Interface +} + +// newClusterTrainingRuntimes returns a ClusterTrainingRuntimes +func newClusterTrainingRuntimes(c *KubeflowV2alpha1Client) *clusterTrainingRuntimes { + return &clusterTrainingRuntimes{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterTrainingRuntime, and returns the corresponding clusterTrainingRuntime object, and an error if there is any. +func (c *clusterTrainingRuntimes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + result = &v2alpha1.ClusterTrainingRuntime{} + err = c.client.Get(). + Resource("clustertrainingruntimes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterTrainingRuntimes that match those selectors. +func (c *clusterTrainingRuntimes) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ClusterTrainingRuntimeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2alpha1.ClusterTrainingRuntimeList{} + err = c.client.Get(). + Resource("clustertrainingruntimes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterTrainingRuntimes. +func (c *clusterTrainingRuntimes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("clustertrainingruntimes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterTrainingRuntime and creates it. Returns the server's representation of the clusterTrainingRuntime, and an error, if there is any. +func (c *clusterTrainingRuntimes) Create(ctx context.Context, clusterTrainingRuntime *v2alpha1.ClusterTrainingRuntime, opts v1.CreateOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + result = &v2alpha1.ClusterTrainingRuntime{} + err = c.client.Post(). + Resource("clustertrainingruntimes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterTrainingRuntime). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterTrainingRuntime and updates it. Returns the server's representation of the clusterTrainingRuntime, and an error, if there is any. +func (c *clusterTrainingRuntimes) Update(ctx context.Context, clusterTrainingRuntime *v2alpha1.ClusterTrainingRuntime, opts v1.UpdateOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + result = &v2alpha1.ClusterTrainingRuntime{} + err = c.client.Put(). + Resource("clustertrainingruntimes"). + Name(clusterTrainingRuntime.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterTrainingRuntime). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterTrainingRuntime and deletes it. Returns an error if one occurs. +func (c *clusterTrainingRuntimes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clustertrainingruntimes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterTrainingRuntimes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("clustertrainingruntimes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterTrainingRuntime. +func (c *clusterTrainingRuntimes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ClusterTrainingRuntime, err error) { + result = &v2alpha1.ClusterTrainingRuntime{} + err = c.client.Patch(pt). + Resource("clustertrainingruntimes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/doc.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/doc.go new file mode 100644 index 0000000000..d9f0dab497 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v2alpha1 diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/doc.go new file mode 100644 index 0000000000..424308ee3b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_clustertrainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_clustertrainingruntime.go new file mode 100644 index 0000000000..1dbb7395db --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_clustertrainingruntime.go @@ -0,0 +1,119 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterTrainingRuntimes implements ClusterTrainingRuntimeInterface +type FakeClusterTrainingRuntimes struct { + Fake *FakeKubeflowV2alpha1 +} + +var clustertrainingruntimesResource = v2alpha1.SchemeGroupVersion.WithResource("clustertrainingruntimes") + +var clustertrainingruntimesKind = v2alpha1.SchemeGroupVersion.WithKind("ClusterTrainingRuntime") + +// Get takes name of the clusterTrainingRuntime, and returns the corresponding clusterTrainingRuntime object, and an error if there is any. +func (c *FakeClusterTrainingRuntimes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clustertrainingruntimesResource, name), &v2alpha1.ClusterTrainingRuntime{}) + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ClusterTrainingRuntime), err +} + +// List takes label and field selectors, and returns the list of ClusterTrainingRuntimes that match those selectors. +func (c *FakeClusterTrainingRuntimes) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ClusterTrainingRuntimeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clustertrainingruntimesResource, clustertrainingruntimesKind, opts), &v2alpha1.ClusterTrainingRuntimeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2alpha1.ClusterTrainingRuntimeList{ListMeta: obj.(*v2alpha1.ClusterTrainingRuntimeList).ListMeta} + for _, item := range obj.(*v2alpha1.ClusterTrainingRuntimeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterTrainingRuntimes. +func (c *FakeClusterTrainingRuntimes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clustertrainingruntimesResource, opts)) +} + +// Create takes the representation of a clusterTrainingRuntime and creates it. Returns the server's representation of the clusterTrainingRuntime, and an error, if there is any. +func (c *FakeClusterTrainingRuntimes) Create(ctx context.Context, clusterTrainingRuntime *v2alpha1.ClusterTrainingRuntime, opts v1.CreateOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clustertrainingruntimesResource, clusterTrainingRuntime), &v2alpha1.ClusterTrainingRuntime{}) + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ClusterTrainingRuntime), err +} + +// Update takes the representation of a clusterTrainingRuntime and updates it. Returns the server's representation of the clusterTrainingRuntime, and an error, if there is any. +func (c *FakeClusterTrainingRuntimes) Update(ctx context.Context, clusterTrainingRuntime *v2alpha1.ClusterTrainingRuntime, opts v1.UpdateOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clustertrainingruntimesResource, clusterTrainingRuntime), &v2alpha1.ClusterTrainingRuntime{}) + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ClusterTrainingRuntime), err +} + +// Delete takes name of the clusterTrainingRuntime and deletes it. Returns an error if one occurs. +func (c *FakeClusterTrainingRuntimes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(clustertrainingruntimesResource, name, opts), &v2alpha1.ClusterTrainingRuntime{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterTrainingRuntimes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clustertrainingruntimesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2alpha1.ClusterTrainingRuntimeList{}) + return err +} + +// Patch applies the patch and returns the patched clusterTrainingRuntime. +func (c *FakeClusterTrainingRuntimes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ClusterTrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clustertrainingruntimesResource, name, pt, data, subresources...), &v2alpha1.ClusterTrainingRuntime{}) + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ClusterTrainingRuntime), err +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_kubeflow.org_client.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_kubeflow.org_client.go new file mode 100644 index 0000000000..5d9628e75e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_kubeflow.org_client.go @@ -0,0 +1,46 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package fake + +import ( + v2alpha1 "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeKubeflowV2alpha1 struct { + *testing.Fake +} + +func (c *FakeKubeflowV2alpha1) ClusterTrainingRuntimes() v2alpha1.ClusterTrainingRuntimeInterface { + return &FakeClusterTrainingRuntimes{c} +} + +func (c *FakeKubeflowV2alpha1) TrainJobs(namespace string) v2alpha1.TrainJobInterface { + return &FakeTrainJobs{c, namespace} +} + +func (c *FakeKubeflowV2alpha1) TrainingRuntimes(namespace string) v2alpha1.TrainingRuntimeInterface { + return &FakeTrainingRuntimes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeKubeflowV2alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainingruntime.go new file mode 100644 index 0000000000..244782183e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainingruntime.go @@ -0,0 +1,127 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTrainingRuntimes implements TrainingRuntimeInterface +type FakeTrainingRuntimes struct { + Fake *FakeKubeflowV2alpha1 + ns string +} + +var trainingruntimesResource = v2alpha1.SchemeGroupVersion.WithResource("trainingruntimes") + +var trainingruntimesKind = v2alpha1.SchemeGroupVersion.WithKind("TrainingRuntime") + +// Get takes name of the trainingRuntime, and returns the corresponding trainingRuntime object, and an error if there is any. +func (c *FakeTrainingRuntimes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.TrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(trainingruntimesResource, c.ns, name), &v2alpha1.TrainingRuntime{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainingRuntime), err +} + +// List takes label and field selectors, and returns the list of TrainingRuntimes that match those selectors. +func (c *FakeTrainingRuntimes) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.TrainingRuntimeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(trainingruntimesResource, trainingruntimesKind, c.ns, opts), &v2alpha1.TrainingRuntimeList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2alpha1.TrainingRuntimeList{ListMeta: obj.(*v2alpha1.TrainingRuntimeList).ListMeta} + for _, item := range obj.(*v2alpha1.TrainingRuntimeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested trainingRuntimes. +func (c *FakeTrainingRuntimes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(trainingruntimesResource, c.ns, opts)) + +} + +// Create takes the representation of a trainingRuntime and creates it. Returns the server's representation of the trainingRuntime, and an error, if there is any. +func (c *FakeTrainingRuntimes) Create(ctx context.Context, trainingRuntime *v2alpha1.TrainingRuntime, opts v1.CreateOptions) (result *v2alpha1.TrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(trainingruntimesResource, c.ns, trainingRuntime), &v2alpha1.TrainingRuntime{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainingRuntime), err +} + +// Update takes the representation of a trainingRuntime and updates it. Returns the server's representation of the trainingRuntime, and an error, if there is any. +func (c *FakeTrainingRuntimes) Update(ctx context.Context, trainingRuntime *v2alpha1.TrainingRuntime, opts v1.UpdateOptions) (result *v2alpha1.TrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(trainingruntimesResource, c.ns, trainingRuntime), &v2alpha1.TrainingRuntime{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainingRuntime), err +} + +// Delete takes name of the trainingRuntime and deletes it. Returns an error if one occurs. +func (c *FakeTrainingRuntimes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(trainingruntimesResource, c.ns, name, opts), &v2alpha1.TrainingRuntime{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTrainingRuntimes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(trainingruntimesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2alpha1.TrainingRuntimeList{}) + return err +} + +// Patch applies the patch and returns the patched trainingRuntime. +func (c *FakeTrainingRuntimes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.TrainingRuntime, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trainingruntimesResource, c.ns, name, pt, data, subresources...), &v2alpha1.TrainingRuntime{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainingRuntime), err +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainjob.go new file mode 100644 index 0000000000..2a88d35de5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainjob.go @@ -0,0 +1,139 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTrainJobs implements TrainJobInterface +type FakeTrainJobs struct { + Fake *FakeKubeflowV2alpha1 + ns string +} + +var trainjobsResource = v2alpha1.SchemeGroupVersion.WithResource("trainjobs") + +var trainjobsKind = v2alpha1.SchemeGroupVersion.WithKind("TrainJob") + +// Get takes name of the trainJob, and returns the corresponding trainJob object, and an error if there is any. +func (c *FakeTrainJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.TrainJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(trainjobsResource, c.ns, name), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} + +// List takes label and field selectors, and returns the list of TrainJobs that match those selectors. +func (c *FakeTrainJobs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.TrainJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(trainjobsResource, trainjobsKind, c.ns, opts), &v2alpha1.TrainJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2alpha1.TrainJobList{ListMeta: obj.(*v2alpha1.TrainJobList).ListMeta} + for _, item := range obj.(*v2alpha1.TrainJobList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested trainJobs. +func (c *FakeTrainJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(trainjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a trainJob and creates it. Returns the server's representation of the trainJob, and an error, if there is any. +func (c *FakeTrainJobs) Create(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.CreateOptions) (result *v2alpha1.TrainJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(trainjobsResource, c.ns, trainJob), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} + +// Update takes the representation of a trainJob and updates it. Returns the server's representation of the trainJob, and an error, if there is any. +func (c *FakeTrainJobs) Update(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.UpdateOptions) (result *v2alpha1.TrainJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(trainjobsResource, c.ns, trainJob), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeTrainJobs) UpdateStatus(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.UpdateOptions) (*v2alpha1.TrainJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(trainjobsResource, "status", c.ns, trainJob), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} + +// Delete takes name of the trainJob and deletes it. Returns an error if one occurs. +func (c *FakeTrainJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(trainjobsResource, c.ns, name, opts), &v2alpha1.TrainJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTrainJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(trainjobsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2alpha1.TrainJobList{}) + return err +} + +// Patch applies the patch and returns the patched trainJob. +func (c *FakeTrainJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.TrainJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trainjobsResource, c.ns, name, pt, data, subresources...), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/generated_expansion.go new file mode 100644 index 0000000000..786f112374 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/generated_expansion.go @@ -0,0 +1,23 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package v2alpha1 + +type ClusterTrainingRuntimeExpansion interface{} + +type TrainJobExpansion interface{} + +type TrainingRuntimeExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/kubeflow.org_client.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/kubeflow.org_client.go new file mode 100644 index 0000000000..fb7bd01dd7 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/kubeflow.org_client.go @@ -0,0 +1,115 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "net/http" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type KubeflowV2alpha1Interface interface { + RESTClient() rest.Interface + ClusterTrainingRuntimesGetter + TrainJobsGetter + TrainingRuntimesGetter +} + +// KubeflowV2alpha1Client is used to interact with features provided by the kubeflow.org group. +type KubeflowV2alpha1Client struct { + restClient rest.Interface +} + +func (c *KubeflowV2alpha1Client) ClusterTrainingRuntimes() ClusterTrainingRuntimeInterface { + return newClusterTrainingRuntimes(c) +} + +func (c *KubeflowV2alpha1Client) TrainJobs(namespace string) TrainJobInterface { + return newTrainJobs(c, namespace) +} + +func (c *KubeflowV2alpha1Client) TrainingRuntimes(namespace string) TrainingRuntimeInterface { + return newTrainingRuntimes(c, namespace) +} + +// NewForConfig creates a new KubeflowV2alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*KubeflowV2alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new KubeflowV2alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KubeflowV2alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &KubeflowV2alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new KubeflowV2alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *KubeflowV2alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new KubeflowV2alpha1Client for the given RESTClient. +func New(c rest.Interface) *KubeflowV2alpha1Client { + return &KubeflowV2alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v2alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *KubeflowV2alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go new file mode 100644 index 0000000000..fb491259f3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go @@ -0,0 +1,176 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "context" + "time" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TrainingRuntimesGetter has a method to return a TrainingRuntimeInterface. +// A group's client should implement this interface. +type TrainingRuntimesGetter interface { + TrainingRuntimes(namespace string) TrainingRuntimeInterface +} + +// TrainingRuntimeInterface has methods to work with TrainingRuntime resources. +type TrainingRuntimeInterface interface { + Create(ctx context.Context, trainingRuntime *v2alpha1.TrainingRuntime, opts v1.CreateOptions) (*v2alpha1.TrainingRuntime, error) + Update(ctx context.Context, trainingRuntime *v2alpha1.TrainingRuntime, opts v1.UpdateOptions) (*v2alpha1.TrainingRuntime, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.TrainingRuntime, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.TrainingRuntimeList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.TrainingRuntime, err error) + TrainingRuntimeExpansion +} + +// trainingRuntimes implements TrainingRuntimeInterface +type trainingRuntimes struct { + client rest.Interface + ns string +} + +// newTrainingRuntimes returns a TrainingRuntimes +func newTrainingRuntimes(c *KubeflowV2alpha1Client, namespace string) *trainingRuntimes { + return &trainingRuntimes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the trainingRuntime, and returns the corresponding trainingRuntime object, and an error if there is any. +func (c *trainingRuntimes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.TrainingRuntime, err error) { + result = &v2alpha1.TrainingRuntime{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trainingruntimes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TrainingRuntimes that match those selectors. +func (c *trainingRuntimes) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.TrainingRuntimeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2alpha1.TrainingRuntimeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trainingruntimes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested trainingRuntimes. +func (c *trainingRuntimes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("trainingruntimes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a trainingRuntime and creates it. Returns the server's representation of the trainingRuntime, and an error, if there is any. +func (c *trainingRuntimes) Create(ctx context.Context, trainingRuntime *v2alpha1.TrainingRuntime, opts v1.CreateOptions) (result *v2alpha1.TrainingRuntime, err error) { + result = &v2alpha1.TrainingRuntime{} + err = c.client.Post(). + Namespace(c.ns). + Resource("trainingruntimes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trainingRuntime). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a trainingRuntime and updates it. Returns the server's representation of the trainingRuntime, and an error, if there is any. +func (c *trainingRuntimes) Update(ctx context.Context, trainingRuntime *v2alpha1.TrainingRuntime, opts v1.UpdateOptions) (result *v2alpha1.TrainingRuntime, err error) { + result = &v2alpha1.TrainingRuntime{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trainingruntimes"). + Name(trainingRuntime.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trainingRuntime). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the trainingRuntime and deletes it. Returns an error if one occurs. +func (c *trainingRuntimes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("trainingruntimes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *trainingRuntimes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("trainingruntimes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched trainingRuntime. +func (c *trainingRuntimes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.TrainingRuntime, err error) { + result = &v2alpha1.TrainingRuntime{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("trainingruntimes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainjob.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainjob.go new file mode 100644 index 0000000000..d3e4d5a355 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainjob.go @@ -0,0 +1,193 @@ +// Copyright 2024 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 client-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "context" + "time" + + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TrainJobsGetter has a method to return a TrainJobInterface. +// A group's client should implement this interface. +type TrainJobsGetter interface { + TrainJobs(namespace string) TrainJobInterface +} + +// TrainJobInterface has methods to work with TrainJob resources. +type TrainJobInterface interface { + Create(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.CreateOptions) (*v2alpha1.TrainJob, error) + Update(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.UpdateOptions) (*v2alpha1.TrainJob, error) + UpdateStatus(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.UpdateOptions) (*v2alpha1.TrainJob, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.TrainJob, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.TrainJobList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.TrainJob, err error) + TrainJobExpansion +} + +// trainJobs implements TrainJobInterface +type trainJobs struct { + client rest.Interface + ns string +} + +// newTrainJobs returns a TrainJobs +func newTrainJobs(c *KubeflowV2alpha1Client, namespace string) *trainJobs { + return &trainJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the trainJob, and returns the corresponding trainJob object, and an error if there is any. +func (c *trainJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.TrainJob, err error) { + result = &v2alpha1.TrainJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trainjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TrainJobs that match those selectors. +func (c *trainJobs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.TrainJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2alpha1.TrainJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trainjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested trainJobs. +func (c *trainJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("trainjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a trainJob and creates it. Returns the server's representation of the trainJob, and an error, if there is any. +func (c *trainJobs) Create(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.CreateOptions) (result *v2alpha1.TrainJob, err error) { + result = &v2alpha1.TrainJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("trainjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trainJob). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a trainJob and updates it. Returns the server's representation of the trainJob, and an error, if there is any. +func (c *trainJobs) Update(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.UpdateOptions) (result *v2alpha1.TrainJob, err error) { + result = &v2alpha1.TrainJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trainjobs"). + Name(trainJob.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trainJob). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *trainJobs) UpdateStatus(ctx context.Context, trainJob *v2alpha1.TrainJob, opts v1.UpdateOptions) (result *v2alpha1.TrainJob, err error) { + result = &v2alpha1.TrainJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trainjobs"). + Name(trainJob.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trainJob). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the trainJob and deletes it. Returns an error if one occurs. +func (c *trainJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("trainjobs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *trainJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("trainjobs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched trainJob. +func (c *trainJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.TrainJob, err error) { + result = &v2alpha1.TrainJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("trainjobs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 608cd3582d..58bf3c3866 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 92883b1f9e..76f3d9452f 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. @@ -20,6 +20,7 @@ import ( "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -64,6 +65,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1.SchemeGroupVersion.WithResource("xgboostjobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeflow().V1().XGBoostJobs().Informer()}, nil + // Group=kubeflow.org, Version=v2alpha1 + case v2alpha1.SchemeGroupVersion.WithResource("clustertrainingruntimes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeflow().V2alpha1().ClusterTrainingRuntimes().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("trainjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeflow().V2alpha1().TrainJobs().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("trainingruntimes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeflow().V2alpha1().TrainingRuntimes().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 15ff8895b4..91cb0256ac 100644 --- a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/interface.go b/pkg/client/informers/externalversions/kubeflow.org/interface.go index 6a7a2eb2ec..7bdf46abd8 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/interface.go +++ b/pkg/client/informers/externalversions/kubeflow.org/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. @@ -19,12 +19,15 @@ package kubeflow import ( internalinterfaces "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/internalinterfaces" v1 "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/kubeflow.org/v1" + v2alpha1 "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/kubeflow.org/v2alpha1" ) // Interface provides access to each of this group's versions. type Interface interface { // V1 provides access to shared informers for resources in V1. V1() v1.Interface + // V2alpha1 provides access to shared informers for resources in V2alpha1. + V2alpha1() v2alpha1.Interface } type group struct { @@ -42,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V2alpha1 returns a new v2alpha1.Interface. +func (g *group) V2alpha1() v2alpha1.Interface { + return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/interface.go b/pkg/client/informers/externalversions/kubeflow.org/v1/interface.go index f0c6a36fed..c0e80ebcb8 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/interface.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/interface.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/jaxjob.go b/pkg/client/informers/externalversions/kubeflow.org/v1/jaxjob.go index b259f0b38d..91504f6351 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/jaxjob.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/jaxjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/mpijob.go b/pkg/client/informers/externalversions/kubeflow.org/v1/mpijob.go index 51adfb00a0..35291b6ae8 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/mpijob.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/mpijob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/paddlejob.go b/pkg/client/informers/externalversions/kubeflow.org/v1/paddlejob.go index 2cadffaefa..fcef538446 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/paddlejob.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/paddlejob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/pytorchjob.go b/pkg/client/informers/externalversions/kubeflow.org/v1/pytorchjob.go index baaa691204..7e94876e7b 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/pytorchjob.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/pytorchjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/tfjob.go b/pkg/client/informers/externalversions/kubeflow.org/v1/tfjob.go index 2398fba6dc..b97554f91b 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/tfjob.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/tfjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v1/xgboostjob.go b/pkg/client/informers/externalversions/kubeflow.org/v1/xgboostjob.go index 948244d524..a0344d59ec 100644 --- a/pkg/client/informers/externalversions/kubeflow.org/v1/xgboostjob.go +++ b/pkg/client/informers/externalversions/kubeflow.org/v1/xgboostjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/clustertrainingruntime.go b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/clustertrainingruntime.go new file mode 100644 index 0000000000..c024e30a29 --- /dev/null +++ b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/clustertrainingruntime.go @@ -0,0 +1,87 @@ +// Copyright 2024 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 informer-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "context" + time "time" + + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + versioned "github.com/kubeflow/training-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/internalinterfaces" + v2alpha1 "github.com/kubeflow/training-operator/pkg/client/listers/kubeflow.org/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterTrainingRuntimeInformer provides access to a shared informer and lister for +// ClusterTrainingRuntimes. +type ClusterTrainingRuntimeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2alpha1.ClusterTrainingRuntimeLister +} + +type clusterTrainingRuntimeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterTrainingRuntimeInformer constructs a new informer for ClusterTrainingRuntime type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterTrainingRuntimeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterTrainingRuntimeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterTrainingRuntimeInformer constructs a new informer for ClusterTrainingRuntime type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterTrainingRuntimeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeflowV2alpha1().ClusterTrainingRuntimes().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeflowV2alpha1().ClusterTrainingRuntimes().Watch(context.TODO(), options) + }, + }, + &kubefloworgv2alpha1.ClusterTrainingRuntime{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterTrainingRuntimeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterTrainingRuntimeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterTrainingRuntimeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubefloworgv2alpha1.ClusterTrainingRuntime{}, f.defaultInformer) +} + +func (f *clusterTrainingRuntimeInformer) Lister() v2alpha1.ClusterTrainingRuntimeLister { + return v2alpha1.NewClusterTrainingRuntimeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/interface.go b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/interface.go new file mode 100644 index 0000000000..f65f45864a --- /dev/null +++ b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/interface.go @@ -0,0 +1,57 @@ +// Copyright 2024 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 informer-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + internalinterfaces "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterTrainingRuntimes returns a ClusterTrainingRuntimeInformer. + ClusterTrainingRuntimes() ClusterTrainingRuntimeInformer + // TrainJobs returns a TrainJobInformer. + TrainJobs() TrainJobInformer + // TrainingRuntimes returns a TrainingRuntimeInformer. + TrainingRuntimes() TrainingRuntimeInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterTrainingRuntimes returns a ClusterTrainingRuntimeInformer. +func (v *version) ClusterTrainingRuntimes() ClusterTrainingRuntimeInformer { + return &clusterTrainingRuntimeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// TrainJobs returns a TrainJobInformer. +func (v *version) TrainJobs() TrainJobInformer { + return &trainJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// TrainingRuntimes returns a TrainingRuntimeInformer. +func (v *version) TrainingRuntimes() TrainingRuntimeInformer { + return &trainingRuntimeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainingruntime.go b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainingruntime.go new file mode 100644 index 0000000000..b605a037d2 --- /dev/null +++ b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainingruntime.go @@ -0,0 +1,88 @@ +// Copyright 2024 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 informer-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "context" + time "time" + + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + versioned "github.com/kubeflow/training-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/internalinterfaces" + v2alpha1 "github.com/kubeflow/training-operator/pkg/client/listers/kubeflow.org/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TrainingRuntimeInformer provides access to a shared informer and lister for +// TrainingRuntimes. +type TrainingRuntimeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2alpha1.TrainingRuntimeLister +} + +type trainingRuntimeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTrainingRuntimeInformer constructs a new informer for TrainingRuntime type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTrainingRuntimeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTrainingRuntimeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTrainingRuntimeInformer constructs a new informer for TrainingRuntime type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTrainingRuntimeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeflowV2alpha1().TrainingRuntimes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeflowV2alpha1().TrainingRuntimes(namespace).Watch(context.TODO(), options) + }, + }, + &kubefloworgv2alpha1.TrainingRuntime{}, + resyncPeriod, + indexers, + ) +} + +func (f *trainingRuntimeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTrainingRuntimeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *trainingRuntimeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubefloworgv2alpha1.TrainingRuntime{}, f.defaultInformer) +} + +func (f *trainingRuntimeInformer) Lister() v2alpha1.TrainingRuntimeLister { + return v2alpha1.NewTrainingRuntimeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainjob.go b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainjob.go new file mode 100644 index 0000000000..0df650744a --- /dev/null +++ b/pkg/client/informers/externalversions/kubeflow.org/v2alpha1/trainjob.go @@ -0,0 +1,88 @@ +// Copyright 2024 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 informer-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "context" + time "time" + + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + versioned "github.com/kubeflow/training-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/kubeflow/training-operator/pkg/client/informers/externalversions/internalinterfaces" + v2alpha1 "github.com/kubeflow/training-operator/pkg/client/listers/kubeflow.org/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TrainJobInformer provides access to a shared informer and lister for +// TrainJobs. +type TrainJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2alpha1.TrainJobLister +} + +type trainJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTrainJobInformer constructs a new informer for TrainJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTrainJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTrainJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTrainJobInformer constructs a new informer for TrainJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTrainJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeflowV2alpha1().TrainJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubeflowV2alpha1().TrainJobs(namespace).Watch(context.TODO(), options) + }, + }, + &kubefloworgv2alpha1.TrainJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *trainJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTrainJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *trainJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubefloworgv2alpha1.TrainJob{}, f.defaultInformer) +} + +func (f *trainJobInformer) Lister() v2alpha1.TrainJobLister { + return v2alpha1.NewTrainJobLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/kubeflow.org/v1/expansion_generated.go b/pkg/client/listers/kubeflow.org/v1/expansion_generated.go index c47ffad3d9..24a842ad5f 100644 --- a/pkg/client/listers/kubeflow.org/v1/expansion_generated.go +++ b/pkg/client/listers/kubeflow.org/v1/expansion_generated.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v1/jaxjob.go b/pkg/client/listers/kubeflow.org/v1/jaxjob.go index 8beaa92f9b..ccc1a65a99 100644 --- a/pkg/client/listers/kubeflow.org/v1/jaxjob.go +++ b/pkg/client/listers/kubeflow.org/v1/jaxjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v1/mpijob.go b/pkg/client/listers/kubeflow.org/v1/mpijob.go index acc593356a..d648fed944 100644 --- a/pkg/client/listers/kubeflow.org/v1/mpijob.go +++ b/pkg/client/listers/kubeflow.org/v1/mpijob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v1/paddlejob.go b/pkg/client/listers/kubeflow.org/v1/paddlejob.go index 42484e2862..45751a680e 100644 --- a/pkg/client/listers/kubeflow.org/v1/paddlejob.go +++ b/pkg/client/listers/kubeflow.org/v1/paddlejob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v1/pytorchjob.go b/pkg/client/listers/kubeflow.org/v1/pytorchjob.go index ef67f9da74..66278941b7 100644 --- a/pkg/client/listers/kubeflow.org/v1/pytorchjob.go +++ b/pkg/client/listers/kubeflow.org/v1/pytorchjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v1/tfjob.go b/pkg/client/listers/kubeflow.org/v1/tfjob.go index 9e74214319..c3444b2a30 100644 --- a/pkg/client/listers/kubeflow.org/v1/tfjob.go +++ b/pkg/client/listers/kubeflow.org/v1/tfjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v1/xgboostjob.go b/pkg/client/listers/kubeflow.org/v1/xgboostjob.go index 74e9097869..8455bb2e8f 100644 --- a/pkg/client/listers/kubeflow.org/v1/xgboostjob.go +++ b/pkg/client/listers/kubeflow.org/v1/xgboostjob.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Kubeflow Authors +// Copyright 2024 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. diff --git a/pkg/client/listers/kubeflow.org/v2alpha1/clustertrainingruntime.go b/pkg/client/listers/kubeflow.org/v2alpha1/clustertrainingruntime.go new file mode 100644 index 0000000000..fdbbb970da --- /dev/null +++ b/pkg/client/listers/kubeflow.org/v2alpha1/clustertrainingruntime.go @@ -0,0 +1,66 @@ +// Copyright 2024 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 lister-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterTrainingRuntimeLister helps list ClusterTrainingRuntimes. +// All objects returned here must be treated as read-only. +type ClusterTrainingRuntimeLister interface { + // List lists all ClusterTrainingRuntimes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2alpha1.ClusterTrainingRuntime, err error) + // Get retrieves the ClusterTrainingRuntime from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2alpha1.ClusterTrainingRuntime, error) + ClusterTrainingRuntimeListerExpansion +} + +// clusterTrainingRuntimeLister implements the ClusterTrainingRuntimeLister interface. +type clusterTrainingRuntimeLister struct { + indexer cache.Indexer +} + +// NewClusterTrainingRuntimeLister returns a new ClusterTrainingRuntimeLister. +func NewClusterTrainingRuntimeLister(indexer cache.Indexer) ClusterTrainingRuntimeLister { + return &clusterTrainingRuntimeLister{indexer: indexer} +} + +// List lists all ClusterTrainingRuntimes in the indexer. +func (s *clusterTrainingRuntimeLister) List(selector labels.Selector) (ret []*v2alpha1.ClusterTrainingRuntime, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.ClusterTrainingRuntime)) + }) + return ret, err +} + +// Get retrieves the ClusterTrainingRuntime from the index for a given name. +func (s *clusterTrainingRuntimeLister) Get(name string) (*v2alpha1.ClusterTrainingRuntime, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2alpha1.Resource("clustertrainingruntime"), name) + } + return obj.(*v2alpha1.ClusterTrainingRuntime), nil +} diff --git a/pkg/client/listers/kubeflow.org/v2alpha1/expansion_generated.go b/pkg/client/listers/kubeflow.org/v2alpha1/expansion_generated.go new file mode 100644 index 0000000000..b12d96f66b --- /dev/null +++ b/pkg/client/listers/kubeflow.org/v2alpha1/expansion_generated.go @@ -0,0 +1,37 @@ +// Copyright 2024 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 lister-gen. DO NOT EDIT. + +package v2alpha1 + +// ClusterTrainingRuntimeListerExpansion allows custom methods to be added to +// ClusterTrainingRuntimeLister. +type ClusterTrainingRuntimeListerExpansion interface{} + +// TrainJobListerExpansion allows custom methods to be added to +// TrainJobLister. +type TrainJobListerExpansion interface{} + +// TrainJobNamespaceListerExpansion allows custom methods to be added to +// TrainJobNamespaceLister. +type TrainJobNamespaceListerExpansion interface{} + +// TrainingRuntimeListerExpansion allows custom methods to be added to +// TrainingRuntimeLister. +type TrainingRuntimeListerExpansion interface{} + +// TrainingRuntimeNamespaceListerExpansion allows custom methods to be added to +// TrainingRuntimeNamespaceLister. +type TrainingRuntimeNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/kubeflow.org/v2alpha1/trainingruntime.go b/pkg/client/listers/kubeflow.org/v2alpha1/trainingruntime.go new file mode 100644 index 0000000000..28c6688984 --- /dev/null +++ b/pkg/client/listers/kubeflow.org/v2alpha1/trainingruntime.go @@ -0,0 +1,97 @@ +// Copyright 2024 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 lister-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TrainingRuntimeLister helps list TrainingRuntimes. +// All objects returned here must be treated as read-only. +type TrainingRuntimeLister interface { + // List lists all TrainingRuntimes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2alpha1.TrainingRuntime, err error) + // TrainingRuntimes returns an object that can list and get TrainingRuntimes. + TrainingRuntimes(namespace string) TrainingRuntimeNamespaceLister + TrainingRuntimeListerExpansion +} + +// trainingRuntimeLister implements the TrainingRuntimeLister interface. +type trainingRuntimeLister struct { + indexer cache.Indexer +} + +// NewTrainingRuntimeLister returns a new TrainingRuntimeLister. +func NewTrainingRuntimeLister(indexer cache.Indexer) TrainingRuntimeLister { + return &trainingRuntimeLister{indexer: indexer} +} + +// List lists all TrainingRuntimes in the indexer. +func (s *trainingRuntimeLister) List(selector labels.Selector) (ret []*v2alpha1.TrainingRuntime, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.TrainingRuntime)) + }) + return ret, err +} + +// TrainingRuntimes returns an object that can list and get TrainingRuntimes. +func (s *trainingRuntimeLister) TrainingRuntimes(namespace string) TrainingRuntimeNamespaceLister { + return trainingRuntimeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TrainingRuntimeNamespaceLister helps list and get TrainingRuntimes. +// All objects returned here must be treated as read-only. +type TrainingRuntimeNamespaceLister interface { + // List lists all TrainingRuntimes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2alpha1.TrainingRuntime, err error) + // Get retrieves the TrainingRuntime from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2alpha1.TrainingRuntime, error) + TrainingRuntimeNamespaceListerExpansion +} + +// trainingRuntimeNamespaceLister implements the TrainingRuntimeNamespaceLister +// interface. +type trainingRuntimeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TrainingRuntimes in the indexer for a given namespace. +func (s trainingRuntimeNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.TrainingRuntime, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.TrainingRuntime)) + }) + return ret, err +} + +// Get retrieves the TrainingRuntime from the indexer for a given namespace and name. +func (s trainingRuntimeNamespaceLister) Get(name string) (*v2alpha1.TrainingRuntime, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2alpha1.Resource("trainingruntime"), name) + } + return obj.(*v2alpha1.TrainingRuntime), nil +} diff --git a/pkg/client/listers/kubeflow.org/v2alpha1/trainjob.go b/pkg/client/listers/kubeflow.org/v2alpha1/trainjob.go new file mode 100644 index 0000000000..76d12c73ba --- /dev/null +++ b/pkg/client/listers/kubeflow.org/v2alpha1/trainjob.go @@ -0,0 +1,97 @@ +// Copyright 2024 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 lister-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TrainJobLister helps list TrainJobs. +// All objects returned here must be treated as read-only. +type TrainJobLister interface { + // List lists all TrainJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2alpha1.TrainJob, err error) + // TrainJobs returns an object that can list and get TrainJobs. + TrainJobs(namespace string) TrainJobNamespaceLister + TrainJobListerExpansion +} + +// trainJobLister implements the TrainJobLister interface. +type trainJobLister struct { + indexer cache.Indexer +} + +// NewTrainJobLister returns a new TrainJobLister. +func NewTrainJobLister(indexer cache.Indexer) TrainJobLister { + return &trainJobLister{indexer: indexer} +} + +// List lists all TrainJobs in the indexer. +func (s *trainJobLister) List(selector labels.Selector) (ret []*v2alpha1.TrainJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.TrainJob)) + }) + return ret, err +} + +// TrainJobs returns an object that can list and get TrainJobs. +func (s *trainJobLister) TrainJobs(namespace string) TrainJobNamespaceLister { + return trainJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TrainJobNamespaceLister helps list and get TrainJobs. +// All objects returned here must be treated as read-only. +type TrainJobNamespaceLister interface { + // List lists all TrainJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2alpha1.TrainJob, err error) + // Get retrieves the TrainJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2alpha1.TrainJob, error) + TrainJobNamespaceListerExpansion +} + +// trainJobNamespaceLister implements the TrainJobNamespaceLister +// interface. +type trainJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TrainJobs in the indexer for a given namespace. +func (s trainJobNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.TrainJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.TrainJob)) + }) + return ret, err +} + +// Get retrieves the TrainJob from the indexer for a given namespace and name. +func (s trainJobNamespaceLister) Get(name string) (*v2alpha1.TrainJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2alpha1.Resource("trainjob"), name) + } + return obj.(*v2alpha1.TrainJob), nil +}