From d3bb08edd0f2ae7f2b8c8b911545387a49617c48 Mon Sep 17 00:00:00 2001 From: Varsha Prasad Narsing Date: Fri, 25 Oct 2024 17:38:24 -0700 Subject: [PATCH] use SSA in trainjob controller --- go.mod | 2 +- hack/update-codegen.sh | 2 +- .../applyconfiguration/internal/internal.go | 60 +++++ .../kubeflow.org/v1/elasticpolicy.go | 139 +++++++++++ .../kubeflow.org/v1/jaxjob.go | 217 ++++++++++++++++++ .../kubeflow.org/v1/jaxjobspec.go | 56 +++++ .../kubeflow.org/v1/jobcondition.go | 88 +++++++ .../kubeflow.org/v1/jobstatus.go | 89 +++++++ .../kubeflow.org/v1/mpijob.go | 217 ++++++++++++++++++ .../kubeflow.org/v1/mpijobspec.go | 83 +++++++ .../kubeflow.org/v1/paddleelasticpolicy.go | 70 ++++++ .../kubeflow.org/v1/paddlejob.go | 217 ++++++++++++++++++ .../kubeflow.org/v1/paddlejobspec.go | 65 ++++++ .../kubeflow.org/v1/pytorchjob.go | 217 ++++++++++++++++++ .../kubeflow.org/v1/pytorchjobspec.go | 74 ++++++ .../kubeflow.org/v1/rdzvconf.go | 46 ++++ .../kubeflow.org/v1/replicaspec.go | 60 +++++ .../kubeflow.org/v1/replicastatus.go | 77 +++++++ .../kubeflow.org/v1/runpolicy.go | 95 ++++++++ .../kubeflow.org/v1/schedulingpolicy.go | 78 +++++++ .../kubeflow.org/v1/tfjob.go | 217 ++++++++++++++++++ .../kubeflow.org/v1/tfjobspec.go | 74 ++++++ .../kubeflow.org/v1/xgboostjob.go | 217 ++++++++++++++++++ .../kubeflow.org/v1/xgboostjobspec.go | 56 +++++ .../v2alpha1/clustertrainingruntime.go | 207 +++++++++++++++++ .../v2alpha1/containeroverride.go | 96 ++++++++ .../coschedulingpodgrouppolicysource.go | 37 +++ .../kubeflow.org/v2alpha1/datasetconfig.go | 61 +++++ .../kubeflow.org/v2alpha1/inputmodel.go | 61 +++++ .../v2alpha1/jobsettemplatespec.go | 187 +++++++++++++++ .../kubeflow.org/v2alpha1/jobstatus.go | 82 +++++++ .../kubeflow.org/v2alpha1/mlpolicy.go | 54 +++++ .../kubeflow.org/v2alpha1/mlpolicysource.go | 46 ++++ .../kubeflow.org/v2alpha1/modelconfig.go | 46 ++++ .../v2alpha1/mpimlpolicysource.go | 68 ++++++ .../kubeflow.org/v2alpha1/outputmodel.go | 61 +++++ .../kubeflow.org/v2alpha1/podgrouppolicy.go | 37 +++ .../v2alpha1/podgrouppolicysource.go | 37 +++ .../kubeflow.org/v2alpha1/podspecoverride.go | 120 ++++++++++ .../v2alpha1/podspecoverridetargetjob.go | 37 +++ .../kubeflow.org/v2alpha1/runtimeref.go | 55 +++++ .../v2alpha1/torchelasticpolicy.go | 70 ++++++ .../v2alpha1/torchmlpolicysource.go | 46 ++++ .../kubeflow.org/v2alpha1/trainer.go | 101 ++++++++ .../kubeflow.org/v2alpha1/trainingruntime.go | 208 +++++++++++++++++ .../v2alpha1/trainingruntimespec.go | 55 +++++ .../kubeflow.org/v2alpha1/trainjob.go | 217 ++++++++++++++++++ .../kubeflow.org/v2alpha1/trainjobspec.go | 126 ++++++++++ .../kubeflow.org/v2alpha1/trainjobstatus.go | 57 +++++ pkg/client/applyconfiguration/utils.go | 129 +++++++++++ .../typed/kubeflow.org/v1/fake/fake_jaxjob.go | 48 ++++ .../typed/kubeflow.org/v1/fake/fake_mpijob.go | 48 ++++ .../kubeflow.org/v1/fake/fake_paddlejob.go | 48 ++++ .../kubeflow.org/v1/fake/fake_pytorchjob.go | 48 ++++ .../typed/kubeflow.org/v1/fake/fake_tfjob.go | 48 ++++ .../kubeflow.org/v1/fake/fake_xgboostjob.go | 48 ++++ .../versioned/typed/kubeflow.org/v1/jaxjob.go | 61 +++++ .../versioned/typed/kubeflow.org/v1/mpijob.go | 61 +++++ .../typed/kubeflow.org/v1/paddlejob.go | 61 +++++ .../typed/kubeflow.org/v1/pytorchjob.go | 61 +++++ .../versioned/typed/kubeflow.org/v1/tfjob.go | 61 +++++ .../typed/kubeflow.org/v1/xgboostjob.go | 61 +++++ .../v2alpha1/clustertrainingruntime.go | 29 +++ .../fake/fake_clustertrainingruntime.go | 24 ++ .../v2alpha1/fake/fake_trainingruntime.go | 25 ++ .../v2alpha1/fake/fake_trainjob.go | 48 ++++ .../kubeflow.org/v2alpha1/trainingruntime.go | 30 +++ .../typed/kubeflow.org/v2alpha1/trainjob.go | 61 +++++ pkg/controller.v2/trainjob_controller.go | 40 +--- 69 files changed, 5697 insertions(+), 31 deletions(-) create mode 100644 pkg/client/applyconfiguration/internal/internal.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/elasticpolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/jaxjob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/jaxjobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/jobcondition.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/jobstatus.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/mpijob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/mpijobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/paddleelasticpolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/paddlejob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/paddlejobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/rdzvconf.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/replicaspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/replicastatus.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/runpolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/schedulingpolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/tfjob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/tfjobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/clustertrainingruntime.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/containeroverride.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/coschedulingpodgrouppolicysource.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/datasetconfig.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/inputmodel.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobsettemplatespec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobstatus.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicysource.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/modelconfig.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mpimlpolicysource.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/outputmodel.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicysource.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverride.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverridetargetjob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/runtimeref.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchelasticpolicy.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchmlpolicysource.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainer.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntime.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntimespec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjob.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobspec.go create mode 100644 pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobstatus.go create mode 100644 pkg/client/applyconfiguration/utils.go diff --git a/go.mod b/go.mod index f55eda8536..ec70890546 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( sigs.k8s.io/jobset v0.5.2 sigs.k8s.io/kueue v0.6.3 sigs.k8s.io/scheduler-plugins v0.28.9 + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sigs.k8s.io/yaml v1.4.0 volcano.sh/apis v1.9.0 ) @@ -81,5 +82,4 @@ require ( k8s.io/component-base v0.29.5 // indirect k8s.io/gengo v0.0.0-20240404160639-a0386bf69313 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index eadecc7414..4d82ad5ff9 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -73,7 +73,7 @@ chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh # instead of the $GOPATH directly. For normal projects this can be dropped. cd ${SCRIPT_ROOT} echo "Generating client,lister,informer for kubeflow.org/v1 and kubeflow.org/v2alpha1" -${CODEGEN_PKG}/generate-groups.sh "client,lister,informer" \ +${CODEGEN_PKG}/generate-groups.sh "client,lister,informer,applyconfiguration" \ github.com/kubeflow/training-operator/pkg/client github.com/kubeflow/training-operator/pkg/apis \ kubeflow.org:v1,v2alpha1 \ --output-base "${TEMP_DIR}" \ diff --git a/pkg/client/applyconfiguration/internal/internal.go b/pkg/client/applyconfiguration/internal/internal.go new file mode 100644 index 0000000000..29ef011452 --- /dev/null +++ b/pkg/client/applyconfiguration/internal/internal.go @@ -0,0 +1,60 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package internal + +import ( + "fmt" + "sync" + + typed "sigs.k8s.io/structured-merge-diff/v4/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/elasticpolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v1/elasticpolicy.go new file mode 100644 index 0000000000..0c7627cf3b --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/elasticpolicy.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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + v2 "k8s.io/api/autoscaling/v2" +) + +// ElasticPolicyApplyConfiguration represents an declarative configuration of the ElasticPolicy type for use +// with apply. +type ElasticPolicyApplyConfiguration struct { + MinReplicas *int32 `json:"minReplicas,omitempty"` + MaxReplicas *int32 `json:"maxReplicas,omitempty"` + RDZVBackend *v1.RDZVBackend `json:"rdzvBackend,omitempty"` + RDZVPort *int32 `json:"rdzvPort,omitempty"` + RDZVHost *string `json:"rdzvHost,omitempty"` + RDZVID *string `json:"rdzvId,omitempty"` + RDZVConf []RDZVConfApplyConfiguration `json:"rdzvConf,omitempty"` + Standalone *bool `json:"standalone,omitempty"` + NProcPerNode *int32 `json:"nProcPerNode,omitempty"` + MaxRestarts *int32 `json:"maxRestarts,omitempty"` + Metrics []v2.MetricSpec `json:"metrics,omitempty"` +} + +// ElasticPolicyApplyConfiguration constructs an declarative configuration of the ElasticPolicy type for use with +// apply. +func ElasticPolicy() *ElasticPolicyApplyConfiguration { + return &ElasticPolicyApplyConfiguration{} +} + +// WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReplicas field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithMinReplicas(value int32) *ElasticPolicyApplyConfiguration { + b.MinReplicas = &value + return b +} + +// WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxReplicas field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithMaxReplicas(value int32) *ElasticPolicyApplyConfiguration { + b.MaxReplicas = &value + return b +} + +// WithRDZVBackend sets the RDZVBackend field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RDZVBackend field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithRDZVBackend(value v1.RDZVBackend) *ElasticPolicyApplyConfiguration { + b.RDZVBackend = &value + return b +} + +// WithRDZVPort sets the RDZVPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RDZVPort field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithRDZVPort(value int32) *ElasticPolicyApplyConfiguration { + b.RDZVPort = &value + return b +} + +// WithRDZVHost sets the RDZVHost field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RDZVHost field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithRDZVHost(value string) *ElasticPolicyApplyConfiguration { + b.RDZVHost = &value + return b +} + +// WithRDZVID sets the RDZVID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RDZVID field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithRDZVID(value string) *ElasticPolicyApplyConfiguration { + b.RDZVID = &value + return b +} + +// WithRDZVConf adds the given value to the RDZVConf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RDZVConf field. +func (b *ElasticPolicyApplyConfiguration) WithRDZVConf(values ...*RDZVConfApplyConfiguration) *ElasticPolicyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRDZVConf") + } + b.RDZVConf = append(b.RDZVConf, *values[i]) + } + return b +} + +// WithStandalone sets the Standalone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Standalone field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithStandalone(value bool) *ElasticPolicyApplyConfiguration { + b.Standalone = &value + return b +} + +// WithNProcPerNode sets the NProcPerNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NProcPerNode field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithNProcPerNode(value int32) *ElasticPolicyApplyConfiguration { + b.NProcPerNode = &value + return b +} + +// WithMaxRestarts sets the MaxRestarts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxRestarts field is set to the value of the last call. +func (b *ElasticPolicyApplyConfiguration) WithMaxRestarts(value int32) *ElasticPolicyApplyConfiguration { + b.MaxRestarts = &value + return b +} + +// WithMetrics adds the given value to the Metrics field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Metrics field. +func (b *ElasticPolicyApplyConfiguration) WithMetrics(values ...v2.MetricSpec) *ElasticPolicyApplyConfiguration { + for i := range values { + b.Metrics = append(b.Metrics, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/jaxjob.go b/pkg/client/applyconfiguration/kubeflow.org/v1/jaxjob.go new file mode 100644 index 0000000000..b5c6963fae --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/jaxjob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// JAXJobApplyConfiguration represents an declarative configuration of the JAXJob type for use +// with apply. +type JAXJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *JAXJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// JAXJob constructs an declarative configuration of the JAXJob type for use with +// apply. +func JAXJob(name, namespace string) *JAXJobApplyConfiguration { + b := &JAXJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("JAXJob") + b.WithAPIVersion("kubeflow.org/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithKind(value string) *JAXJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithAPIVersion(value string) *JAXJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithName(value string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithGenerateName(value string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithNamespace(value string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithUID(value types.UID) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithResourceVersion(value string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithGeneration(value int64) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *JAXJobApplyConfiguration) WithLabels(entries map[string]string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *JAXJobApplyConfiguration) WithAnnotations(entries map[string]string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *JAXJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *JAXJobApplyConfiguration) WithFinalizers(values ...string) *JAXJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *JAXJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithSpec(value *JAXJobSpecApplyConfiguration) *JAXJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *JAXJobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *JAXJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/jaxjobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/jaxjobspec.go new file mode 100644 index 0000000000..e61fa91b77 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/jaxjobspec.go @@ -0,0 +1,56 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// JAXJobSpecApplyConfiguration represents an declarative configuration of the JAXJobSpec type for use +// with apply. +type JAXJobSpecApplyConfiguration struct { + RunPolicy *RunPolicyApplyConfiguration `json:"runPolicy,omitempty"` + JAXReplicaSpecs map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec `json:"jaxReplicaSpecs,omitempty"` +} + +// JAXJobSpecApplyConfiguration constructs an declarative configuration of the JAXJobSpec type for use with +// apply. +func JAXJobSpec() *JAXJobSpecApplyConfiguration { + return &JAXJobSpecApplyConfiguration{} +} + +// WithRunPolicy sets the RunPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunPolicy field is set to the value of the last call. +func (b *JAXJobSpecApplyConfiguration) WithRunPolicy(value *RunPolicyApplyConfiguration) *JAXJobSpecApplyConfiguration { + b.RunPolicy = value + return b +} + +// WithJAXReplicaSpecs puts the entries into the JAXReplicaSpecs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the JAXReplicaSpecs field, +// overwriting an existing map entries in JAXReplicaSpecs field with the same key. +func (b *JAXJobSpecApplyConfiguration) WithJAXReplicaSpecs(entries map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec) *JAXJobSpecApplyConfiguration { + if b.JAXReplicaSpecs == nil && len(entries) > 0 { + b.JAXReplicaSpecs = make(map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec, len(entries)) + } + for k, v := range entries { + b.JAXReplicaSpecs[k] = v + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/jobcondition.go b/pkg/client/applyconfiguration/kubeflow.org/v1/jobcondition.go new file mode 100644 index 0000000000..f3b6a15328 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/jobcondition.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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// JobConditionApplyConfiguration represents an declarative configuration of the JobCondition type for use +// with apply. +type JobConditionApplyConfiguration struct { + Type *v1.JobConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// JobConditionApplyConfiguration constructs an declarative configuration of the JobCondition type for use with +// apply. +func JobCondition() *JobConditionApplyConfiguration { + return &JobConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithType(value v1.JobConditionType) *JobConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *JobConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithReason(value string) *JobConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithMessage(value string) *JobConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithLastUpdateTime sets the LastUpdateTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastUpdateTime field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *JobConditionApplyConfiguration { + b.LastUpdateTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *JobConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/jobstatus.go b/pkg/client/applyconfiguration/kubeflow.org/v1/jobstatus.go new file mode 100644 index 0000000000..3dfbcfb4b4 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/jobstatus.go @@ -0,0 +1,89 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// JobStatusApplyConfiguration represents an declarative configuration of the JobStatus type for use +// with apply. +type JobStatusApplyConfiguration struct { + Conditions []JobConditionApplyConfiguration `json:"conditions,omitempty"` + ReplicaStatuses map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaStatus `json:"replicaStatuses,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"` +} + +// JobStatusApplyConfiguration constructs an declarative configuration of the JobStatus type for use with +// apply. +func JobStatus() *JobStatusApplyConfiguration { + return &JobStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *JobStatusApplyConfiguration) WithConditions(values ...*JobConditionApplyConfiguration) *JobStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithReplicaStatuses puts the entries into the ReplicaStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the ReplicaStatuses field, +// overwriting an existing map entries in ReplicaStatuses field with the same key. +func (b *JobStatusApplyConfiguration) WithReplicaStatuses(entries map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaStatus) *JobStatusApplyConfiguration { + if b.ReplicaStatuses == nil && len(entries) > 0 { + b.ReplicaStatuses = make(map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaStatus, len(entries)) + } + for k, v := range entries { + b.ReplicaStatuses[k] = v + } + return b +} + +// WithStartTime sets the StartTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartTime field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithStartTime(value metav1.Time) *JobStatusApplyConfiguration { + b.StartTime = &value + return b +} + +// WithCompletionTime sets the CompletionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CompletionTime field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithCompletionTime(value metav1.Time) *JobStatusApplyConfiguration { + b.CompletionTime = &value + return b +} + +// WithLastReconcileTime sets the LastReconcileTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastReconcileTime field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithLastReconcileTime(value metav1.Time) *JobStatusApplyConfiguration { + b.LastReconcileTime = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/mpijob.go b/pkg/client/applyconfiguration/kubeflow.org/v1/mpijob.go new file mode 100644 index 0000000000..4cd16250fc --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/mpijob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MPIJobApplyConfiguration represents an declarative configuration of the MPIJob type for use +// with apply. +type MPIJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *MPIJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// MPIJob constructs an declarative configuration of the MPIJob type for use with +// apply. +func MPIJob(name, namespace string) *MPIJobApplyConfiguration { + b := &MPIJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MPIJob") + b.WithAPIVersion("kubeflow.org/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithKind(value string) *MPIJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithAPIVersion(value string) *MPIJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithName(value string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithGenerateName(value string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithNamespace(value string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithUID(value types.UID) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithResourceVersion(value string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithGeneration(value int64) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MPIJobApplyConfiguration) WithLabels(entries map[string]string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MPIJobApplyConfiguration) WithAnnotations(entries map[string]string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MPIJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MPIJobApplyConfiguration) WithFinalizers(values ...string) *MPIJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *MPIJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithSpec(value *MPIJobSpecApplyConfiguration) *MPIJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MPIJobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *MPIJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/mpijobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/mpijobspec.go new file mode 100644 index 0000000000..10e0053564 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/mpijobspec.go @@ -0,0 +1,83 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// MPIJobSpecApplyConfiguration represents an declarative configuration of the MPIJobSpec type for use +// with apply. +type MPIJobSpecApplyConfiguration struct { + SlotsPerWorker *int32 `json:"slotsPerWorker,omitempty"` + CleanPodPolicy *v1.CleanPodPolicy `json:"cleanPodPolicy,omitempty"` + MPIReplicaSpecs map[v1.ReplicaType]*v1.ReplicaSpec `json:"mpiReplicaSpecs,omitempty"` + MainContainer *string `json:"mainContainer,omitempty"` + RunPolicy *RunPolicyApplyConfiguration `json:"runPolicy,omitempty"` +} + +// MPIJobSpecApplyConfiguration constructs an declarative configuration of the MPIJobSpec type for use with +// apply. +func MPIJobSpec() *MPIJobSpecApplyConfiguration { + return &MPIJobSpecApplyConfiguration{} +} + +// WithSlotsPerWorker sets the SlotsPerWorker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SlotsPerWorker field is set to the value of the last call. +func (b *MPIJobSpecApplyConfiguration) WithSlotsPerWorker(value int32) *MPIJobSpecApplyConfiguration { + b.SlotsPerWorker = &value + return b +} + +// WithCleanPodPolicy sets the CleanPodPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CleanPodPolicy field is set to the value of the last call. +func (b *MPIJobSpecApplyConfiguration) WithCleanPodPolicy(value v1.CleanPodPolicy) *MPIJobSpecApplyConfiguration { + b.CleanPodPolicy = &value + return b +} + +// WithMPIReplicaSpecs puts the entries into the MPIReplicaSpecs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the MPIReplicaSpecs field, +// overwriting an existing map entries in MPIReplicaSpecs field with the same key. +func (b *MPIJobSpecApplyConfiguration) WithMPIReplicaSpecs(entries map[v1.ReplicaType]*v1.ReplicaSpec) *MPIJobSpecApplyConfiguration { + if b.MPIReplicaSpecs == nil && len(entries) > 0 { + b.MPIReplicaSpecs = make(map[v1.ReplicaType]*v1.ReplicaSpec, len(entries)) + } + for k, v := range entries { + b.MPIReplicaSpecs[k] = v + } + return b +} + +// WithMainContainer sets the MainContainer field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MainContainer field is set to the value of the last call. +func (b *MPIJobSpecApplyConfiguration) WithMainContainer(value string) *MPIJobSpecApplyConfiguration { + b.MainContainer = &value + return b +} + +// WithRunPolicy sets the RunPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunPolicy field is set to the value of the last call. +func (b *MPIJobSpecApplyConfiguration) WithRunPolicy(value *RunPolicyApplyConfiguration) *MPIJobSpecApplyConfiguration { + b.RunPolicy = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/paddleelasticpolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v1/paddleelasticpolicy.go new file mode 100644 index 0000000000..1bb523734b --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/paddleelasticpolicy.go @@ -0,0 +1,70 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v2 "k8s.io/api/autoscaling/v2" +) + +// PaddleElasticPolicyApplyConfiguration represents an declarative configuration of the PaddleElasticPolicy type for use +// with apply. +type PaddleElasticPolicyApplyConfiguration struct { + MinReplicas *int32 `json:"minReplicas,omitempty"` + MaxReplicas *int32 `json:"maxReplicas,omitempty"` + MaxRestarts *int32 `json:"maxRestarts,omitempty"` + Metrics []v2.MetricSpec `json:"metrics,omitempty"` +} + +// PaddleElasticPolicyApplyConfiguration constructs an declarative configuration of the PaddleElasticPolicy type for use with +// apply. +func PaddleElasticPolicy() *PaddleElasticPolicyApplyConfiguration { + return &PaddleElasticPolicyApplyConfiguration{} +} + +// WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReplicas field is set to the value of the last call. +func (b *PaddleElasticPolicyApplyConfiguration) WithMinReplicas(value int32) *PaddleElasticPolicyApplyConfiguration { + b.MinReplicas = &value + return b +} + +// WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxReplicas field is set to the value of the last call. +func (b *PaddleElasticPolicyApplyConfiguration) WithMaxReplicas(value int32) *PaddleElasticPolicyApplyConfiguration { + b.MaxReplicas = &value + return b +} + +// WithMaxRestarts sets the MaxRestarts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxRestarts field is set to the value of the last call. +func (b *PaddleElasticPolicyApplyConfiguration) WithMaxRestarts(value int32) *PaddleElasticPolicyApplyConfiguration { + b.MaxRestarts = &value + return b +} + +// WithMetrics adds the given value to the Metrics field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Metrics field. +func (b *PaddleElasticPolicyApplyConfiguration) WithMetrics(values ...v2.MetricSpec) *PaddleElasticPolicyApplyConfiguration { + for i := range values { + b.Metrics = append(b.Metrics, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/paddlejob.go b/pkg/client/applyconfiguration/kubeflow.org/v1/paddlejob.go new file mode 100644 index 0000000000..d19ed1dfcd --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/paddlejob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PaddleJobApplyConfiguration represents an declarative configuration of the PaddleJob type for use +// with apply. +type PaddleJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PaddleJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// PaddleJob constructs an declarative configuration of the PaddleJob type for use with +// apply. +func PaddleJob(name, namespace string) *PaddleJobApplyConfiguration { + b := &PaddleJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PaddleJob") + b.WithAPIVersion("kubeflow.org/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithKind(value string) *PaddleJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithAPIVersion(value string) *PaddleJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithName(value string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithGenerateName(value string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithNamespace(value string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithUID(value types.UID) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithResourceVersion(value string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithGeneration(value int64) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PaddleJobApplyConfiguration) WithLabels(entries map[string]string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PaddleJobApplyConfiguration) WithAnnotations(entries map[string]string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PaddleJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PaddleJobApplyConfiguration) WithFinalizers(values ...string) *PaddleJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PaddleJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithSpec(value *PaddleJobSpecApplyConfiguration) *PaddleJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PaddleJobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *PaddleJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/paddlejobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/paddlejobspec.go new file mode 100644 index 0000000000..d00496c069 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/paddlejobspec.go @@ -0,0 +1,65 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// PaddleJobSpecApplyConfiguration represents an declarative configuration of the PaddleJobSpec type for use +// with apply. +type PaddleJobSpecApplyConfiguration struct { + RunPolicy *RunPolicyApplyConfiguration `json:"runPolicy,omitempty"` + ElasticPolicy *PaddleElasticPolicyApplyConfiguration `json:"elasticPolicy,omitempty"` + PaddleReplicaSpecs map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec `json:"paddleReplicaSpecs,omitempty"` +} + +// PaddleJobSpecApplyConfiguration constructs an declarative configuration of the PaddleJobSpec type for use with +// apply. +func PaddleJobSpec() *PaddleJobSpecApplyConfiguration { + return &PaddleJobSpecApplyConfiguration{} +} + +// WithRunPolicy sets the RunPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunPolicy field is set to the value of the last call. +func (b *PaddleJobSpecApplyConfiguration) WithRunPolicy(value *RunPolicyApplyConfiguration) *PaddleJobSpecApplyConfiguration { + b.RunPolicy = value + return b +} + +// WithElasticPolicy sets the ElasticPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ElasticPolicy field is set to the value of the last call. +func (b *PaddleJobSpecApplyConfiguration) WithElasticPolicy(value *PaddleElasticPolicyApplyConfiguration) *PaddleJobSpecApplyConfiguration { + b.ElasticPolicy = value + return b +} + +// WithPaddleReplicaSpecs puts the entries into the PaddleReplicaSpecs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the PaddleReplicaSpecs field, +// overwriting an existing map entries in PaddleReplicaSpecs field with the same key. +func (b *PaddleJobSpecApplyConfiguration) WithPaddleReplicaSpecs(entries map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec) *PaddleJobSpecApplyConfiguration { + if b.PaddleReplicaSpecs == nil && len(entries) > 0 { + b.PaddleReplicaSpecs = make(map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec, len(entries)) + } + for k, v := range entries { + b.PaddleReplicaSpecs[k] = v + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjob.go b/pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjob.go new file mode 100644 index 0000000000..9c9ed84150 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PyTorchJobApplyConfiguration represents an declarative configuration of the PyTorchJob type for use +// with apply. +type PyTorchJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PyTorchJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// PyTorchJob constructs an declarative configuration of the PyTorchJob type for use with +// apply. +func PyTorchJob(name, namespace string) *PyTorchJobApplyConfiguration { + b := &PyTorchJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PyTorchJob") + b.WithAPIVersion("kubeflow.org/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithKind(value string) *PyTorchJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithAPIVersion(value string) *PyTorchJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithName(value string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithGenerateName(value string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithNamespace(value string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithUID(value types.UID) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithResourceVersion(value string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithGeneration(value int64) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PyTorchJobApplyConfiguration) WithLabels(entries map[string]string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PyTorchJobApplyConfiguration) WithAnnotations(entries map[string]string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PyTorchJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PyTorchJobApplyConfiguration) WithFinalizers(values ...string) *PyTorchJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PyTorchJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithSpec(value *PyTorchJobSpecApplyConfiguration) *PyTorchJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PyTorchJobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *PyTorchJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjobspec.go new file mode 100644 index 0000000000..f5a921701d --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/pytorchjobspec.go @@ -0,0 +1,74 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// PyTorchJobSpecApplyConfiguration represents an declarative configuration of the PyTorchJobSpec type for use +// with apply. +type PyTorchJobSpecApplyConfiguration struct { + RunPolicy *RunPolicyApplyConfiguration `json:"runPolicy,omitempty"` + ElasticPolicy *ElasticPolicyApplyConfiguration `json:"elasticPolicy,omitempty"` + PyTorchReplicaSpecs map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec `json:"pytorchReplicaSpecs,omitempty"` + NprocPerNode *string `json:"nprocPerNode,omitempty"` +} + +// PyTorchJobSpecApplyConfiguration constructs an declarative configuration of the PyTorchJobSpec type for use with +// apply. +func PyTorchJobSpec() *PyTorchJobSpecApplyConfiguration { + return &PyTorchJobSpecApplyConfiguration{} +} + +// WithRunPolicy sets the RunPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunPolicy field is set to the value of the last call. +func (b *PyTorchJobSpecApplyConfiguration) WithRunPolicy(value *RunPolicyApplyConfiguration) *PyTorchJobSpecApplyConfiguration { + b.RunPolicy = value + return b +} + +// WithElasticPolicy sets the ElasticPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ElasticPolicy field is set to the value of the last call. +func (b *PyTorchJobSpecApplyConfiguration) WithElasticPolicy(value *ElasticPolicyApplyConfiguration) *PyTorchJobSpecApplyConfiguration { + b.ElasticPolicy = value + return b +} + +// WithPyTorchReplicaSpecs puts the entries into the PyTorchReplicaSpecs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the PyTorchReplicaSpecs field, +// overwriting an existing map entries in PyTorchReplicaSpecs field with the same key. +func (b *PyTorchJobSpecApplyConfiguration) WithPyTorchReplicaSpecs(entries map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec) *PyTorchJobSpecApplyConfiguration { + if b.PyTorchReplicaSpecs == nil && len(entries) > 0 { + b.PyTorchReplicaSpecs = make(map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec, len(entries)) + } + for k, v := range entries { + b.PyTorchReplicaSpecs[k] = v + } + return b +} + +// WithNprocPerNode sets the NprocPerNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NprocPerNode field is set to the value of the last call. +func (b *PyTorchJobSpecApplyConfiguration) WithNprocPerNode(value string) *PyTorchJobSpecApplyConfiguration { + b.NprocPerNode = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/rdzvconf.go b/pkg/client/applyconfiguration/kubeflow.org/v1/rdzvconf.go new file mode 100644 index 0000000000..dbf35fb938 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/rdzvconf.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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RDZVConfApplyConfiguration represents an declarative configuration of the RDZVConf type for use +// with apply. +type RDZVConfApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` +} + +// RDZVConfApplyConfiguration constructs an declarative configuration of the RDZVConf type for use with +// apply. +func RDZVConf() *RDZVConfApplyConfiguration { + return &RDZVConfApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *RDZVConfApplyConfiguration) WithKey(value string) *RDZVConfApplyConfiguration { + b.Key = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *RDZVConfApplyConfiguration) WithValue(value string) *RDZVConfApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/replicaspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/replicaspec.go new file mode 100644 index 0000000000..27a54c4510 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/replicaspec.go @@ -0,0 +1,60 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + v1 "k8s.io/api/core/v1" +) + +// ReplicaSpecApplyConfiguration represents an declarative configuration of the ReplicaSpec type for use +// with apply. +type ReplicaSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + Template *v1.PodTemplateSpec `json:"template,omitempty"` + RestartPolicy *kubefloworgv1.RestartPolicy `json:"restartPolicy,omitempty"` +} + +// ReplicaSpecApplyConfiguration constructs an declarative configuration of the ReplicaSpec type for use with +// apply. +func ReplicaSpec() *ReplicaSpecApplyConfiguration { + return &ReplicaSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ReplicaSpecApplyConfiguration) WithReplicas(value int32) *ReplicaSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *ReplicaSpecApplyConfiguration) WithTemplate(value v1.PodTemplateSpec) *ReplicaSpecApplyConfiguration { + b.Template = &value + return b +} + +// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartPolicy field is set to the value of the last call. +func (b *ReplicaSpecApplyConfiguration) WithRestartPolicy(value kubefloworgv1.RestartPolicy) *ReplicaSpecApplyConfiguration { + b.RestartPolicy = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/replicastatus.go b/pkg/client/applyconfiguration/kubeflow.org/v1/replicastatus.go new file mode 100644 index 0000000000..3e041a8268 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/replicastatus.go @@ -0,0 +1,77 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ReplicaStatusApplyConfiguration represents an declarative configuration of the ReplicaStatus type for use +// with apply. +type ReplicaStatusApplyConfiguration struct { + Active *int32 `json:"active,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` + LabelSelector *v1.LabelSelector `json:"labelSelector,omitempty"` + Selector *string `json:"selector,omitempty"` +} + +// ReplicaStatusApplyConfiguration constructs an declarative configuration of the ReplicaStatus type for use with +// apply. +func ReplicaStatus() *ReplicaStatusApplyConfiguration { + return &ReplicaStatusApplyConfiguration{} +} + +// WithActive sets the Active field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Active field is set to the value of the last call. +func (b *ReplicaStatusApplyConfiguration) WithActive(value int32) *ReplicaStatusApplyConfiguration { + b.Active = &value + return b +} + +// WithSucceeded sets the Succeeded field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Succeeded field is set to the value of the last call. +func (b *ReplicaStatusApplyConfiguration) WithSucceeded(value int32) *ReplicaStatusApplyConfiguration { + b.Succeeded = &value + return b +} + +// WithFailed sets the Failed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Failed field is set to the value of the last call. +func (b *ReplicaStatusApplyConfiguration) WithFailed(value int32) *ReplicaStatusApplyConfiguration { + b.Failed = &value + return b +} + +// WithLabelSelector sets the LabelSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelector field is set to the value of the last call. +func (b *ReplicaStatusApplyConfiguration) WithLabelSelector(value v1.LabelSelector) *ReplicaStatusApplyConfiguration { + b.LabelSelector = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *ReplicaStatusApplyConfiguration) WithSelector(value string) *ReplicaStatusApplyConfiguration { + b.Selector = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/runpolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v1/runpolicy.go new file mode 100644 index 0000000000..df3f53b36e --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/runpolicy.go @@ -0,0 +1,95 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// RunPolicyApplyConfiguration represents an declarative configuration of the RunPolicy type for use +// with apply. +type RunPolicyApplyConfiguration struct { + CleanPodPolicy *v1.CleanPodPolicy `json:"cleanPodPolicy,omitempty"` + TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"` + ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"` + BackoffLimit *int32 `json:"backoffLimit,omitempty"` + SchedulingPolicy *SchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + Suspend *bool `json:"suspend,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` +} + +// RunPolicyApplyConfiguration constructs an declarative configuration of the RunPolicy type for use with +// apply. +func RunPolicy() *RunPolicyApplyConfiguration { + return &RunPolicyApplyConfiguration{} +} + +// WithCleanPodPolicy sets the CleanPodPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CleanPodPolicy field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithCleanPodPolicy(value v1.CleanPodPolicy) *RunPolicyApplyConfiguration { + b.CleanPodPolicy = &value + return b +} + +// WithTTLSecondsAfterFinished sets the TTLSecondsAfterFinished field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TTLSecondsAfterFinished field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithTTLSecondsAfterFinished(value int32) *RunPolicyApplyConfiguration { + b.TTLSecondsAfterFinished = &value + return b +} + +// WithActiveDeadlineSeconds sets the ActiveDeadlineSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ActiveDeadlineSeconds field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithActiveDeadlineSeconds(value int64) *RunPolicyApplyConfiguration { + b.ActiveDeadlineSeconds = &value + return b +} + +// WithBackoffLimit sets the BackoffLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BackoffLimit field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithBackoffLimit(value int32) *RunPolicyApplyConfiguration { + b.BackoffLimit = &value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SchedulingPolicy field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithSchedulingPolicy(value *SchedulingPolicyApplyConfiguration) *RunPolicyApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSuspend sets the Suspend field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Suspend field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithSuspend(value bool) *RunPolicyApplyConfiguration { + b.Suspend = &value + return b +} + +// WithManagedBy sets the ManagedBy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ManagedBy field is set to the value of the last call. +func (b *RunPolicyApplyConfiguration) WithManagedBy(value string) *RunPolicyApplyConfiguration { + b.ManagedBy = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/schedulingpolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v1/schedulingpolicy.go new file mode 100644 index 0000000000..cd2c5c59eb --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/schedulingpolicy.go @@ -0,0 +1,78 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// SchedulingPolicyApplyConfiguration represents an declarative configuration of the SchedulingPolicy type for use +// with apply. +type SchedulingPolicyApplyConfiguration struct { + MinAvailable *int32 `json:"minAvailable,omitempty"` + Queue *string `json:"queue,omitempty"` + MinResources *map[v1.ResourceName]resource.Quantity `json:"minResources,omitempty"` + PriorityClass *string `json:"priorityClass,omitempty"` + ScheduleTimeoutSeconds *int32 `json:"scheduleTimeoutSeconds,omitempty"` +} + +// SchedulingPolicyApplyConfiguration constructs an declarative configuration of the SchedulingPolicy type for use with +// apply. +func SchedulingPolicy() *SchedulingPolicyApplyConfiguration { + return &SchedulingPolicyApplyConfiguration{} +} + +// WithMinAvailable sets the MinAvailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinAvailable field is set to the value of the last call. +func (b *SchedulingPolicyApplyConfiguration) WithMinAvailable(value int32) *SchedulingPolicyApplyConfiguration { + b.MinAvailable = &value + return b +} + +// WithQueue sets the Queue field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Queue field is set to the value of the last call. +func (b *SchedulingPolicyApplyConfiguration) WithQueue(value string) *SchedulingPolicyApplyConfiguration { + b.Queue = &value + return b +} + +// WithMinResources sets the MinResources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinResources field is set to the value of the last call. +func (b *SchedulingPolicyApplyConfiguration) WithMinResources(value map[v1.ResourceName]resource.Quantity) *SchedulingPolicyApplyConfiguration { + b.MinResources = &value + return b +} + +// WithPriorityClass sets the PriorityClass field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PriorityClass field is set to the value of the last call. +func (b *SchedulingPolicyApplyConfiguration) WithPriorityClass(value string) *SchedulingPolicyApplyConfiguration { + b.PriorityClass = &value + return b +} + +// WithScheduleTimeoutSeconds sets the ScheduleTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScheduleTimeoutSeconds field is set to the value of the last call. +func (b *SchedulingPolicyApplyConfiguration) WithScheduleTimeoutSeconds(value int32) *SchedulingPolicyApplyConfiguration { + b.ScheduleTimeoutSeconds = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/tfjob.go b/pkg/client/applyconfiguration/kubeflow.org/v1/tfjob.go new file mode 100644 index 0000000000..56b41f000c --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/tfjob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TFJobApplyConfiguration represents an declarative configuration of the TFJob type for use +// with apply. +type TFJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TFJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// TFJob constructs an declarative configuration of the TFJob type for use with +// apply. +func TFJob(name, namespace string) *TFJobApplyConfiguration { + b := &TFJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TFJob") + b.WithAPIVersion("kubeflow.org/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithKind(value string) *TFJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithAPIVersion(value string) *TFJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithName(value string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithGenerateName(value string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithNamespace(value string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithUID(value types.UID) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithResourceVersion(value string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithGeneration(value int64) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TFJobApplyConfiguration) WithLabels(entries map[string]string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TFJobApplyConfiguration) WithAnnotations(entries map[string]string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TFJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TFJobApplyConfiguration) WithFinalizers(values ...string) *TFJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *TFJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithSpec(value *TFJobSpecApplyConfiguration) *TFJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *TFJobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *TFJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/tfjobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/tfjobspec.go new file mode 100644 index 0000000000..a40305011c --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/tfjobspec.go @@ -0,0 +1,74 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// TFJobSpecApplyConfiguration represents an declarative configuration of the TFJobSpec type for use +// with apply. +type TFJobSpecApplyConfiguration struct { + RunPolicy *RunPolicyApplyConfiguration `json:"runPolicy,omitempty"` + SuccessPolicy *kubefloworgv1.SuccessPolicy `json:"successPolicy,omitempty"` + TFReplicaSpecs map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec `json:"tfReplicaSpecs,omitempty"` + EnableDynamicWorker *bool `json:"enableDynamicWorker,omitempty"` +} + +// TFJobSpecApplyConfiguration constructs an declarative configuration of the TFJobSpec type for use with +// apply. +func TFJobSpec() *TFJobSpecApplyConfiguration { + return &TFJobSpecApplyConfiguration{} +} + +// WithRunPolicy sets the RunPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunPolicy field is set to the value of the last call. +func (b *TFJobSpecApplyConfiguration) WithRunPolicy(value *RunPolicyApplyConfiguration) *TFJobSpecApplyConfiguration { + b.RunPolicy = value + return b +} + +// WithSuccessPolicy sets the SuccessPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SuccessPolicy field is set to the value of the last call. +func (b *TFJobSpecApplyConfiguration) WithSuccessPolicy(value kubefloworgv1.SuccessPolicy) *TFJobSpecApplyConfiguration { + b.SuccessPolicy = &value + return b +} + +// WithTFReplicaSpecs puts the entries into the TFReplicaSpecs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the TFReplicaSpecs field, +// overwriting an existing map entries in TFReplicaSpecs field with the same key. +func (b *TFJobSpecApplyConfiguration) WithTFReplicaSpecs(entries map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec) *TFJobSpecApplyConfiguration { + if b.TFReplicaSpecs == nil && len(entries) > 0 { + b.TFReplicaSpecs = make(map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec, len(entries)) + } + for k, v := range entries { + b.TFReplicaSpecs[k] = v + } + return b +} + +// WithEnableDynamicWorker sets the EnableDynamicWorker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EnableDynamicWorker field is set to the value of the last call. +func (b *TFJobSpecApplyConfiguration) WithEnableDynamicWorker(value bool) *TFJobSpecApplyConfiguration { + b.EnableDynamicWorker = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjob.go b/pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjob.go new file mode 100644 index 0000000000..9aeacb0089 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// XGBoostJobApplyConfiguration represents an declarative configuration of the XGBoostJob type for use +// with apply. +type XGBoostJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *XGBoostJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// XGBoostJob constructs an declarative configuration of the XGBoostJob type for use with +// apply. +func XGBoostJob(name, namespace string) *XGBoostJobApplyConfiguration { + b := &XGBoostJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("XGBoostJob") + b.WithAPIVersion("kubeflow.org/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithKind(value string) *XGBoostJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithAPIVersion(value string) *XGBoostJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithName(value string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithGenerateName(value string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithNamespace(value string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithUID(value types.UID) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithResourceVersion(value string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithGeneration(value int64) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *XGBoostJobApplyConfiguration) WithLabels(entries map[string]string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *XGBoostJobApplyConfiguration) WithAnnotations(entries map[string]string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *XGBoostJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *XGBoostJobApplyConfiguration) WithFinalizers(values ...string) *XGBoostJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *XGBoostJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithSpec(value *XGBoostJobSpecApplyConfiguration) *XGBoostJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *XGBoostJobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *XGBoostJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjobspec.go new file mode 100644 index 0000000000..63451f570f --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v1/xgboostjobspec.go @@ -0,0 +1,56 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" +) + +// XGBoostJobSpecApplyConfiguration represents an declarative configuration of the XGBoostJobSpec type for use +// with apply. +type XGBoostJobSpecApplyConfiguration struct { + RunPolicy *RunPolicyApplyConfiguration `json:"runPolicy,omitempty"` + XGBReplicaSpecs map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec `json:"xgbReplicaSpecs,omitempty"` +} + +// XGBoostJobSpecApplyConfiguration constructs an declarative configuration of the XGBoostJobSpec type for use with +// apply. +func XGBoostJobSpec() *XGBoostJobSpecApplyConfiguration { + return &XGBoostJobSpecApplyConfiguration{} +} + +// WithRunPolicy sets the RunPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunPolicy field is set to the value of the last call. +func (b *XGBoostJobSpecApplyConfiguration) WithRunPolicy(value *RunPolicyApplyConfiguration) *XGBoostJobSpecApplyConfiguration { + b.RunPolicy = value + return b +} + +// WithXGBReplicaSpecs puts the entries into the XGBReplicaSpecs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the XGBReplicaSpecs field, +// overwriting an existing map entries in XGBReplicaSpecs field with the same key. +func (b *XGBoostJobSpecApplyConfiguration) WithXGBReplicaSpecs(entries map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec) *XGBoostJobSpecApplyConfiguration { + if b.XGBReplicaSpecs == nil && len(entries) > 0 { + b.XGBReplicaSpecs = make(map[kubefloworgv1.ReplicaType]*kubefloworgv1.ReplicaSpec, len(entries)) + } + for k, v := range entries { + b.XGBReplicaSpecs[k] = v + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/clustertrainingruntime.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/clustertrainingruntime.go new file mode 100644 index 0000000000..cb0b8f6d3b --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/clustertrainingruntime.go @@ -0,0 +1,207 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterTrainingRuntimeApplyConfiguration represents an declarative configuration of the ClusterTrainingRuntime type for use +// with apply. +type ClusterTrainingRuntimeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TrainingRuntimeSpecApplyConfiguration `json:"spec,omitempty"` +} + +// ClusterTrainingRuntime constructs an declarative configuration of the ClusterTrainingRuntime type for use with +// apply. +func ClusterTrainingRuntime(name string) *ClusterTrainingRuntimeApplyConfiguration { + b := &ClusterTrainingRuntimeApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterTrainingRuntime") + b.WithAPIVersion("kubeflow.org/v2alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithKind(value string) *ClusterTrainingRuntimeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithAPIVersion(value string) *ClusterTrainingRuntimeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithName(value string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithGenerateName(value string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithNamespace(value string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithUID(value types.UID) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithResourceVersion(value string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithGeneration(value int64) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithLabels(entries map[string]string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithFinalizers(values ...string) *ClusterTrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ClusterTrainingRuntimeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ClusterTrainingRuntimeApplyConfiguration) WithSpec(value *TrainingRuntimeSpecApplyConfiguration) *ClusterTrainingRuntimeApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/containeroverride.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/containeroverride.go new file mode 100644 index 0000000000..569a4418d4 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/containeroverride.go @@ -0,0 +1,96 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ContainerOverrideApplyConfiguration represents an declarative configuration of the ContainerOverride type for use +// with apply. +type ContainerOverrideApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Command []string `json:"command,omitempty"` + Args []string `json:"args,omitempty"` + Env []v1.EnvVar `json:"env,omitempty"` + EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty"` + VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"` +} + +// ContainerOverrideApplyConfiguration constructs an declarative configuration of the ContainerOverride type for use with +// apply. +func ContainerOverride() *ContainerOverrideApplyConfiguration { + return &ContainerOverrideApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContainerOverrideApplyConfiguration) WithName(value string) *ContainerOverrideApplyConfiguration { + b.Name = &value + return b +} + +// WithCommand adds the given value to the Command field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Command field. +func (b *ContainerOverrideApplyConfiguration) WithCommand(values ...string) *ContainerOverrideApplyConfiguration { + for i := range values { + b.Command = append(b.Command, values[i]) + } + return b +} + +// WithArgs adds the given value to the Args field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Args field. +func (b *ContainerOverrideApplyConfiguration) WithArgs(values ...string) *ContainerOverrideApplyConfiguration { + for i := range values { + b.Args = append(b.Args, values[i]) + } + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *ContainerOverrideApplyConfiguration) WithEnv(values ...v1.EnvVar) *ContainerOverrideApplyConfiguration { + for i := range values { + b.Env = append(b.Env, values[i]) + } + return b +} + +// WithEnvFrom adds the given value to the EnvFrom field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EnvFrom field. +func (b *ContainerOverrideApplyConfiguration) WithEnvFrom(values ...v1.EnvFromSource) *ContainerOverrideApplyConfiguration { + for i := range values { + b.EnvFrom = append(b.EnvFrom, values[i]) + } + return b +} + +// WithVolumeMounts adds the given value to the VolumeMounts field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeMounts field. +func (b *ContainerOverrideApplyConfiguration) WithVolumeMounts(values ...v1.VolumeMount) *ContainerOverrideApplyConfiguration { + for i := range values { + b.VolumeMounts = append(b.VolumeMounts, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/coschedulingpodgrouppolicysource.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/coschedulingpodgrouppolicysource.go new file mode 100644 index 0000000000..6ed03dcc80 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/coschedulingpodgrouppolicysource.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// CoschedulingPodGroupPolicySourceApplyConfiguration represents an declarative configuration of the CoschedulingPodGroupPolicySource type for use +// with apply. +type CoschedulingPodGroupPolicySourceApplyConfiguration struct { + ScheduleTimeoutSeconds *int32 `json:"scheduleTimeoutSeconds,omitempty"` +} + +// CoschedulingPodGroupPolicySourceApplyConfiguration constructs an declarative configuration of the CoschedulingPodGroupPolicySource type for use with +// apply. +func CoschedulingPodGroupPolicySource() *CoschedulingPodGroupPolicySourceApplyConfiguration { + return &CoschedulingPodGroupPolicySourceApplyConfiguration{} +} + +// WithScheduleTimeoutSeconds sets the ScheduleTimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScheduleTimeoutSeconds field is set to the value of the last call. +func (b *CoschedulingPodGroupPolicySourceApplyConfiguration) WithScheduleTimeoutSeconds(value int32) *CoschedulingPodGroupPolicySourceApplyConfiguration { + b.ScheduleTimeoutSeconds = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/datasetconfig.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/datasetconfig.go new file mode 100644 index 0000000000..94fb6b2490 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/datasetconfig.go @@ -0,0 +1,61 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// DatasetConfigApplyConfiguration represents an declarative configuration of the DatasetConfig type for use +// with apply. +type DatasetConfigApplyConfiguration struct { + StorageUri *string `json:"storageUri,omitempty"` + Env []v1.EnvVar `json:"env,omitempty"` + SecretRef *v1.SecretReference `json:"secretRef,omitempty"` +} + +// DatasetConfigApplyConfiguration constructs an declarative configuration of the DatasetConfig type for use with +// apply. +func DatasetConfig() *DatasetConfigApplyConfiguration { + return &DatasetConfigApplyConfiguration{} +} + +// WithStorageUri sets the StorageUri field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageUri field is set to the value of the last call. +func (b *DatasetConfigApplyConfiguration) WithStorageUri(value string) *DatasetConfigApplyConfiguration { + b.StorageUri = &value + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *DatasetConfigApplyConfiguration) WithEnv(values ...v1.EnvVar) *DatasetConfigApplyConfiguration { + for i := range values { + b.Env = append(b.Env, values[i]) + } + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *DatasetConfigApplyConfiguration) WithSecretRef(value v1.SecretReference) *DatasetConfigApplyConfiguration { + b.SecretRef = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/inputmodel.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/inputmodel.go new file mode 100644 index 0000000000..d1582a763b --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/inputmodel.go @@ -0,0 +1,61 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// InputModelApplyConfiguration represents an declarative configuration of the InputModel type for use +// with apply. +type InputModelApplyConfiguration struct { + StorageUri *string `json:"storageUri,omitempty"` + Env []v1.EnvVar `json:"env,omitempty"` + SecretRef *v1.SecretReference `json:"secretRef,omitempty"` +} + +// InputModelApplyConfiguration constructs an declarative configuration of the InputModel type for use with +// apply. +func InputModel() *InputModelApplyConfiguration { + return &InputModelApplyConfiguration{} +} + +// WithStorageUri sets the StorageUri field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageUri field is set to the value of the last call. +func (b *InputModelApplyConfiguration) WithStorageUri(value string) *InputModelApplyConfiguration { + b.StorageUri = &value + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *InputModelApplyConfiguration) WithEnv(values ...v1.EnvVar) *InputModelApplyConfiguration { + for i := range values { + b.Env = append(b.Env, values[i]) + } + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *InputModelApplyConfiguration) WithSecretRef(value v1.SecretReference) *InputModelApplyConfiguration { + b.SecretRef = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobsettemplatespec.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobsettemplatespec.go new file mode 100644 index 0000000000..95ab3f565c --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobsettemplatespec.go @@ -0,0 +1,187 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" + v1alpha2 "sigs.k8s.io/jobset/api/jobset/v1alpha2" +) + +// JobSetTemplateSpecApplyConfiguration represents an declarative configuration of the JobSetTemplateSpec type for use +// with apply. +type JobSetTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *v1alpha2.JobSetSpec `json:"spec,omitempty"` +} + +// JobSetTemplateSpecApplyConfiguration constructs an declarative configuration of the JobSetTemplateSpec type for use with +// apply. +func JobSetTemplateSpec() *JobSetTemplateSpecApplyConfiguration { + return &JobSetTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithName(value string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithGenerateName(value string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithNamespace(value string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithUID(value types.UID) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithResourceVersion(value string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithGeneration(value int64) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *JobSetTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *JobSetTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *JobSetTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *JobSetTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *JobSetTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *JobSetTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *JobSetTemplateSpecApplyConfiguration) WithSpec(value v1alpha2.JobSetSpec) *JobSetTemplateSpecApplyConfiguration { + b.Spec = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobstatus.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobstatus.go new file mode 100644 index 0000000000..301e3577d4 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/jobstatus.go @@ -0,0 +1,82 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// JobStatusApplyConfiguration represents an declarative configuration of the JobStatus type for use +// with apply. +type JobStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Ready *int32 `json:"ready,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` + Active *int32 `json:"active,omitempty"` + Suspended *int32 `json:"suspended,omitempty"` +} + +// JobStatusApplyConfiguration constructs an declarative configuration of the JobStatus type for use with +// apply. +func JobStatus() *JobStatusApplyConfiguration { + return &JobStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithName(value string) *JobStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithReady sets the Ready field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ready field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithReady(value int32) *JobStatusApplyConfiguration { + b.Ready = &value + return b +} + +// WithSucceeded sets the Succeeded field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Succeeded field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithSucceeded(value int32) *JobStatusApplyConfiguration { + b.Succeeded = &value + return b +} + +// WithFailed sets the Failed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Failed field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithFailed(value int32) *JobStatusApplyConfiguration { + b.Failed = &value + return b +} + +// WithActive sets the Active field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Active field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithActive(value int32) *JobStatusApplyConfiguration { + b.Active = &value + return b +} + +// WithSuspended sets the Suspended field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Suspended field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithSuspended(value int32) *JobStatusApplyConfiguration { + b.Suspended = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicy.go new file mode 100644 index 0000000000..77a372b881 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicy.go @@ -0,0 +1,54 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// MLPolicyApplyConfiguration represents an declarative configuration of the MLPolicy type for use +// with apply. +type MLPolicyApplyConfiguration struct { + NumNodes *int32 `json:"numNodes,omitempty"` + MLPolicySourceApplyConfiguration `json:",inline"` +} + +// MLPolicyApplyConfiguration constructs an declarative configuration of the MLPolicy type for use with +// apply. +func MLPolicy() *MLPolicyApplyConfiguration { + return &MLPolicyApplyConfiguration{} +} + +// WithNumNodes sets the NumNodes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumNodes field is set to the value of the last call. +func (b *MLPolicyApplyConfiguration) WithNumNodes(value int32) *MLPolicyApplyConfiguration { + b.NumNodes = &value + return b +} + +// WithTorch sets the Torch field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Torch field is set to the value of the last call. +func (b *MLPolicyApplyConfiguration) WithTorch(value *TorchMLPolicySourceApplyConfiguration) *MLPolicyApplyConfiguration { + b.Torch = value + return b +} + +// WithMPI sets the MPI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MPI field is set to the value of the last call. +func (b *MLPolicyApplyConfiguration) WithMPI(value *MPIMLPolicySourceApplyConfiguration) *MLPolicyApplyConfiguration { + b.MPI = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicysource.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicysource.go new file mode 100644 index 0000000000..429395e576 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mlpolicysource.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// MLPolicySourceApplyConfiguration represents an declarative configuration of the MLPolicySource type for use +// with apply. +type MLPolicySourceApplyConfiguration struct { + Torch *TorchMLPolicySourceApplyConfiguration `json:"torch,omitempty"` + MPI *MPIMLPolicySourceApplyConfiguration `json:"mpi,omitempty"` +} + +// MLPolicySourceApplyConfiguration constructs an declarative configuration of the MLPolicySource type for use with +// apply. +func MLPolicySource() *MLPolicySourceApplyConfiguration { + return &MLPolicySourceApplyConfiguration{} +} + +// WithTorch sets the Torch field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Torch field is set to the value of the last call. +func (b *MLPolicySourceApplyConfiguration) WithTorch(value *TorchMLPolicySourceApplyConfiguration) *MLPolicySourceApplyConfiguration { + b.Torch = value + return b +} + +// WithMPI sets the MPI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MPI field is set to the value of the last call. +func (b *MLPolicySourceApplyConfiguration) WithMPI(value *MPIMLPolicySourceApplyConfiguration) *MLPolicySourceApplyConfiguration { + b.MPI = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/modelconfig.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/modelconfig.go new file mode 100644 index 0000000000..e178a55311 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/modelconfig.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// ModelConfigApplyConfiguration represents an declarative configuration of the ModelConfig type for use +// with apply. +type ModelConfigApplyConfiguration struct { + Input *InputModelApplyConfiguration `json:"input,omitempty"` + Output *OutputModelApplyConfiguration `json:"output,omitempty"` +} + +// ModelConfigApplyConfiguration constructs an declarative configuration of the ModelConfig type for use with +// apply. +func ModelConfig() *ModelConfigApplyConfiguration { + return &ModelConfigApplyConfiguration{} +} + +// WithInput sets the Input field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Input field is set to the value of the last call. +func (b *ModelConfigApplyConfiguration) WithInput(value *InputModelApplyConfiguration) *ModelConfigApplyConfiguration { + b.Input = value + return b +} + +// WithOutput sets the Output field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Output field is set to the value of the last call. +func (b *ModelConfigApplyConfiguration) WithOutput(value *OutputModelApplyConfiguration) *ModelConfigApplyConfiguration { + b.Output = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mpimlpolicysource.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mpimlpolicysource.go new file mode 100644 index 0000000000..8d3240ec86 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/mpimlpolicysource.go @@ -0,0 +1,68 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" +) + +// MPIMLPolicySourceApplyConfiguration represents an declarative configuration of the MPIMLPolicySource type for use +// with apply. +type MPIMLPolicySourceApplyConfiguration struct { + NumProcPerNode *int32 `json:"numProcPerNode,omitempty"` + MPIImplementation *v2alpha1.MPIImplementation `json:"mpiImplementation,omitempty"` + SSHAuthMountPath *string `json:"SSHAuthMountPath,omitempty"` + RunLauncherAsNode *bool `json:"runLauncherAsNode,omitempty"` +} + +// MPIMLPolicySourceApplyConfiguration constructs an declarative configuration of the MPIMLPolicySource type for use with +// apply. +func MPIMLPolicySource() *MPIMLPolicySourceApplyConfiguration { + return &MPIMLPolicySourceApplyConfiguration{} +} + +// WithNumProcPerNode sets the NumProcPerNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumProcPerNode field is set to the value of the last call. +func (b *MPIMLPolicySourceApplyConfiguration) WithNumProcPerNode(value int32) *MPIMLPolicySourceApplyConfiguration { + b.NumProcPerNode = &value + return b +} + +// WithMPIImplementation sets the MPIImplementation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MPIImplementation field is set to the value of the last call. +func (b *MPIMLPolicySourceApplyConfiguration) WithMPIImplementation(value v2alpha1.MPIImplementation) *MPIMLPolicySourceApplyConfiguration { + b.MPIImplementation = &value + return b +} + +// WithSSHAuthMountPath sets the SSHAuthMountPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SSHAuthMountPath field is set to the value of the last call. +func (b *MPIMLPolicySourceApplyConfiguration) WithSSHAuthMountPath(value string) *MPIMLPolicySourceApplyConfiguration { + b.SSHAuthMountPath = &value + return b +} + +// WithRunLauncherAsNode sets the RunLauncherAsNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunLauncherAsNode field is set to the value of the last call. +func (b *MPIMLPolicySourceApplyConfiguration) WithRunLauncherAsNode(value bool) *MPIMLPolicySourceApplyConfiguration { + b.RunLauncherAsNode = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/outputmodel.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/outputmodel.go new file mode 100644 index 0000000000..f6f8058365 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/outputmodel.go @@ -0,0 +1,61 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// OutputModelApplyConfiguration represents an declarative configuration of the OutputModel type for use +// with apply. +type OutputModelApplyConfiguration struct { + StorageUri *string `json:"storageUri,omitempty"` + Env []v1.EnvVar `json:"env,omitempty"` + SecretRef *v1.SecretReference `json:"secretRef,omitempty"` +} + +// OutputModelApplyConfiguration constructs an declarative configuration of the OutputModel type for use with +// apply. +func OutputModel() *OutputModelApplyConfiguration { + return &OutputModelApplyConfiguration{} +} + +// WithStorageUri sets the StorageUri field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageUri field is set to the value of the last call. +func (b *OutputModelApplyConfiguration) WithStorageUri(value string) *OutputModelApplyConfiguration { + b.StorageUri = &value + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *OutputModelApplyConfiguration) WithEnv(values ...v1.EnvVar) *OutputModelApplyConfiguration { + for i := range values { + b.Env = append(b.Env, values[i]) + } + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *OutputModelApplyConfiguration) WithSecretRef(value v1.SecretReference) *OutputModelApplyConfiguration { + b.SecretRef = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicy.go new file mode 100644 index 0000000000..4c8323ab34 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicy.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// PodGroupPolicyApplyConfiguration represents an declarative configuration of the PodGroupPolicy type for use +// with apply. +type PodGroupPolicyApplyConfiguration struct { + PodGroupPolicySourceApplyConfiguration `json:",inline"` +} + +// PodGroupPolicyApplyConfiguration constructs an declarative configuration of the PodGroupPolicy type for use with +// apply. +func PodGroupPolicy() *PodGroupPolicyApplyConfiguration { + return &PodGroupPolicyApplyConfiguration{} +} + +// WithCoscheduling sets the Coscheduling field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Coscheduling field is set to the value of the last call. +func (b *PodGroupPolicyApplyConfiguration) WithCoscheduling(value *CoschedulingPodGroupPolicySourceApplyConfiguration) *PodGroupPolicyApplyConfiguration { + b.Coscheduling = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicysource.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicysource.go new file mode 100644 index 0000000000..bd96139e52 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podgrouppolicysource.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// PodGroupPolicySourceApplyConfiguration represents an declarative configuration of the PodGroupPolicySource type for use +// with apply. +type PodGroupPolicySourceApplyConfiguration struct { + Coscheduling *CoschedulingPodGroupPolicySourceApplyConfiguration `json:"coscheduling,omitempty"` +} + +// PodGroupPolicySourceApplyConfiguration constructs an declarative configuration of the PodGroupPolicySource type for use with +// apply. +func PodGroupPolicySource() *PodGroupPolicySourceApplyConfiguration { + return &PodGroupPolicySourceApplyConfiguration{} +} + +// WithCoscheduling sets the Coscheduling field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Coscheduling field is set to the value of the last call. +func (b *PodGroupPolicySourceApplyConfiguration) WithCoscheduling(value *CoschedulingPodGroupPolicySourceApplyConfiguration) *PodGroupPolicySourceApplyConfiguration { + b.Coscheduling = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverride.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverride.go new file mode 100644 index 0000000000..d9becfd7bd --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverride.go @@ -0,0 +1,120 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PodSpecOverrideApplyConfiguration represents an declarative configuration of the PodSpecOverride type for use +// with apply. +type PodSpecOverrideApplyConfiguration struct { + TargetJobs []PodSpecOverrideTargetJobApplyConfiguration `json:"targetJobs,omitempty"` + Containers []ContainerOverrideApplyConfiguration `json:"containers,omitempty"` + InitContainers []ContainerOverrideApplyConfiguration `json:"initContainers,omitempty"` + Volumes []v1.Volume `json:"volumes,omitempty"` + ServiceAccountName *string `json:"serviceAccountName,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + Tolerations []v1.Toleration `json:"tolerations,omitempty"` +} + +// PodSpecOverrideApplyConfiguration constructs an declarative configuration of the PodSpecOverride type for use with +// apply. +func PodSpecOverride() *PodSpecOverrideApplyConfiguration { + return &PodSpecOverrideApplyConfiguration{} +} + +// WithTargetJobs adds the given value to the TargetJobs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TargetJobs field. +func (b *PodSpecOverrideApplyConfiguration) WithTargetJobs(values ...*PodSpecOverrideTargetJobApplyConfiguration) *PodSpecOverrideApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTargetJobs") + } + b.TargetJobs = append(b.TargetJobs, *values[i]) + } + return b +} + +// WithContainers adds the given value to the Containers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Containers field. +func (b *PodSpecOverrideApplyConfiguration) WithContainers(values ...*ContainerOverrideApplyConfiguration) *PodSpecOverrideApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithContainers") + } + b.Containers = append(b.Containers, *values[i]) + } + return b +} + +// WithInitContainers adds the given value to the InitContainers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the InitContainers field. +func (b *PodSpecOverrideApplyConfiguration) WithInitContainers(values ...*ContainerOverrideApplyConfiguration) *PodSpecOverrideApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithInitContainers") + } + b.InitContainers = append(b.InitContainers, *values[i]) + } + return b +} + +// WithVolumes adds the given value to the Volumes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Volumes field. +func (b *PodSpecOverrideApplyConfiguration) WithVolumes(values ...v1.Volume) *PodSpecOverrideApplyConfiguration { + for i := range values { + b.Volumes = append(b.Volumes, values[i]) + } + return b +} + +// WithServiceAccountName sets the ServiceAccountName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceAccountName field is set to the value of the last call. +func (b *PodSpecOverrideApplyConfiguration) WithServiceAccountName(value string) *PodSpecOverrideApplyConfiguration { + b.ServiceAccountName = &value + return b +} + +// WithNodeSelector puts the entries into the NodeSelector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the NodeSelector field, +// overwriting an existing map entries in NodeSelector field with the same key. +func (b *PodSpecOverrideApplyConfiguration) WithNodeSelector(entries map[string]string) *PodSpecOverrideApplyConfiguration { + if b.NodeSelector == nil && len(entries) > 0 { + b.NodeSelector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.NodeSelector[k] = v + } + return b +} + +// WithTolerations adds the given value to the Tolerations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Tolerations field. +func (b *PodSpecOverrideApplyConfiguration) WithTolerations(values ...v1.Toleration) *PodSpecOverrideApplyConfiguration { + for i := range values { + b.Tolerations = append(b.Tolerations, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverridetargetjob.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverridetargetjob.go new file mode 100644 index 0000000000..41d5f4fc69 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/podspecoverridetargetjob.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// PodSpecOverrideTargetJobApplyConfiguration represents an declarative configuration of the PodSpecOverrideTargetJob type for use +// with apply. +type PodSpecOverrideTargetJobApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// PodSpecOverrideTargetJobApplyConfiguration constructs an declarative configuration of the PodSpecOverrideTargetJob type for use with +// apply. +func PodSpecOverrideTargetJob() *PodSpecOverrideTargetJobApplyConfiguration { + return &PodSpecOverrideTargetJobApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodSpecOverrideTargetJobApplyConfiguration) WithName(value string) *PodSpecOverrideTargetJobApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/runtimeref.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/runtimeref.go new file mode 100644 index 0000000000..420890bce2 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/runtimeref.go @@ -0,0 +1,55 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// RuntimeRefApplyConfiguration represents an declarative configuration of the RuntimeRef type for use +// with apply. +type RuntimeRefApplyConfiguration struct { + Name *string `json:"name,omitempty"` + APIGroup *string `json:"apiGroup,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// RuntimeRefApplyConfiguration constructs an declarative configuration of the RuntimeRef type for use with +// apply. +func RuntimeRef() *RuntimeRefApplyConfiguration { + return &RuntimeRefApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RuntimeRefApplyConfiguration) WithName(value string) *RuntimeRefApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *RuntimeRefApplyConfiguration) WithAPIGroup(value string) *RuntimeRefApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RuntimeRefApplyConfiguration) WithKind(value string) *RuntimeRefApplyConfiguration { + b.Kind = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchelasticpolicy.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchelasticpolicy.go new file mode 100644 index 0000000000..17f7ceff98 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchelasticpolicy.go @@ -0,0 +1,70 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v2 "k8s.io/api/autoscaling/v2" +) + +// TorchElasticPolicyApplyConfiguration represents an declarative configuration of the TorchElasticPolicy type for use +// with apply. +type TorchElasticPolicyApplyConfiguration struct { + MaxRestarts *int32 `json:"maxRestarts,omitempty"` + MinNodes *int32 `json:"minNodes,omitempty"` + MaxNodes *int32 `json:"maxNodes,omitempty"` + Metrics []v2.MetricSpec `json:"metrics,omitempty"` +} + +// TorchElasticPolicyApplyConfiguration constructs an declarative configuration of the TorchElasticPolicy type for use with +// apply. +func TorchElasticPolicy() *TorchElasticPolicyApplyConfiguration { + return &TorchElasticPolicyApplyConfiguration{} +} + +// WithMaxRestarts sets the MaxRestarts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxRestarts field is set to the value of the last call. +func (b *TorchElasticPolicyApplyConfiguration) WithMaxRestarts(value int32) *TorchElasticPolicyApplyConfiguration { + b.MaxRestarts = &value + return b +} + +// WithMinNodes sets the MinNodes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinNodes field is set to the value of the last call. +func (b *TorchElasticPolicyApplyConfiguration) WithMinNodes(value int32) *TorchElasticPolicyApplyConfiguration { + b.MinNodes = &value + return b +} + +// WithMaxNodes sets the MaxNodes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxNodes field is set to the value of the last call. +func (b *TorchElasticPolicyApplyConfiguration) WithMaxNodes(value int32) *TorchElasticPolicyApplyConfiguration { + b.MaxNodes = &value + return b +} + +// WithMetrics adds the given value to the Metrics field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Metrics field. +func (b *TorchElasticPolicyApplyConfiguration) WithMetrics(values ...v2.MetricSpec) *TorchElasticPolicyApplyConfiguration { + for i := range values { + b.Metrics = append(b.Metrics, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchmlpolicysource.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchmlpolicysource.go new file mode 100644 index 0000000000..03a8a58b56 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/torchmlpolicysource.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// TorchMLPolicySourceApplyConfiguration represents an declarative configuration of the TorchMLPolicySource type for use +// with apply. +type TorchMLPolicySourceApplyConfiguration struct { + NumProcPerNode *string `json:"numProcPerNode,omitempty"` + ElasticPolicy *TorchElasticPolicyApplyConfiguration `json:"elasticPolicy,omitempty"` +} + +// TorchMLPolicySourceApplyConfiguration constructs an declarative configuration of the TorchMLPolicySource type for use with +// apply. +func TorchMLPolicySource() *TorchMLPolicySourceApplyConfiguration { + return &TorchMLPolicySourceApplyConfiguration{} +} + +// WithNumProcPerNode sets the NumProcPerNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumProcPerNode field is set to the value of the last call. +func (b *TorchMLPolicySourceApplyConfiguration) WithNumProcPerNode(value string) *TorchMLPolicySourceApplyConfiguration { + b.NumProcPerNode = &value + return b +} + +// WithElasticPolicy sets the ElasticPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ElasticPolicy field is set to the value of the last call. +func (b *TorchMLPolicySourceApplyConfiguration) WithElasticPolicy(value *TorchElasticPolicyApplyConfiguration) *TorchMLPolicySourceApplyConfiguration { + b.ElasticPolicy = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainer.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainer.go new file mode 100644 index 0000000000..dee8841c7b --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainer.go @@ -0,0 +1,101 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// TrainerApplyConfiguration represents an declarative configuration of the Trainer type for use +// with apply. +type TrainerApplyConfiguration struct { + Image *string `json:"image,omitempty"` + Command []string `json:"command,omitempty"` + Args []string `json:"args,omitempty"` + Env []v1.EnvVar `json:"env,omitempty"` + NumNodes *int32 `json:"numNodes,omitempty"` + ResourcesPerNode *v1.ResourceRequirements `json:"resourcesPerNode,omitempty"` + NumProcPerNode *string `json:"numProcPerNode,omitempty"` +} + +// TrainerApplyConfiguration constructs an declarative configuration of the Trainer type for use with +// apply. +func Trainer() *TrainerApplyConfiguration { + return &TrainerApplyConfiguration{} +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *TrainerApplyConfiguration) WithImage(value string) *TrainerApplyConfiguration { + b.Image = &value + return b +} + +// WithCommand adds the given value to the Command field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Command field. +func (b *TrainerApplyConfiguration) WithCommand(values ...string) *TrainerApplyConfiguration { + for i := range values { + b.Command = append(b.Command, values[i]) + } + return b +} + +// WithArgs adds the given value to the Args field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Args field. +func (b *TrainerApplyConfiguration) WithArgs(values ...string) *TrainerApplyConfiguration { + for i := range values { + b.Args = append(b.Args, values[i]) + } + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *TrainerApplyConfiguration) WithEnv(values ...v1.EnvVar) *TrainerApplyConfiguration { + for i := range values { + b.Env = append(b.Env, values[i]) + } + return b +} + +// WithNumNodes sets the NumNodes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumNodes field is set to the value of the last call. +func (b *TrainerApplyConfiguration) WithNumNodes(value int32) *TrainerApplyConfiguration { + b.NumNodes = &value + return b +} + +// WithResourcesPerNode sets the ResourcesPerNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourcesPerNode field is set to the value of the last call. +func (b *TrainerApplyConfiguration) WithResourcesPerNode(value v1.ResourceRequirements) *TrainerApplyConfiguration { + b.ResourcesPerNode = &value + return b +} + +// WithNumProcPerNode sets the NumProcPerNode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumProcPerNode field is set to the value of the last call. +func (b *TrainerApplyConfiguration) WithNumProcPerNode(value string) *TrainerApplyConfiguration { + b.NumProcPerNode = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntime.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntime.go new file mode 100644 index 0000000000..9d918c3e83 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntime.go @@ -0,0 +1,208 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TrainingRuntimeApplyConfiguration represents an declarative configuration of the TrainingRuntime type for use +// with apply. +type TrainingRuntimeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TrainingRuntimeSpecApplyConfiguration `json:"spec,omitempty"` +} + +// TrainingRuntime constructs an declarative configuration of the TrainingRuntime type for use with +// apply. +func TrainingRuntime(name, namespace string) *TrainingRuntimeApplyConfiguration { + b := &TrainingRuntimeApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TrainingRuntime") + b.WithAPIVersion("kubeflow.org/v2alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithKind(value string) *TrainingRuntimeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithAPIVersion(value string) *TrainingRuntimeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithName(value string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithGenerateName(value string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithNamespace(value string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithUID(value types.UID) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithResourceVersion(value string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithGeneration(value int64) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TrainingRuntimeApplyConfiguration) WithLabels(entries map[string]string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TrainingRuntimeApplyConfiguration) WithAnnotations(entries map[string]string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TrainingRuntimeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TrainingRuntimeApplyConfiguration) WithFinalizers(values ...string) *TrainingRuntimeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *TrainingRuntimeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TrainingRuntimeApplyConfiguration) WithSpec(value *TrainingRuntimeSpecApplyConfiguration) *TrainingRuntimeApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntimespec.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntimespec.go new file mode 100644 index 0000000000..ed9133d6bf --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainingruntimespec.go @@ -0,0 +1,55 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// TrainingRuntimeSpecApplyConfiguration represents an declarative configuration of the TrainingRuntimeSpec type for use +// with apply. +type TrainingRuntimeSpecApplyConfiguration struct { + MLPolicy *MLPolicyApplyConfiguration `json:"mlPolicy,omitempty"` + PodGroupPolicy *PodGroupPolicyApplyConfiguration `json:"podGroupPolicy,omitempty"` + Template *JobSetTemplateSpecApplyConfiguration `json:"template,omitempty"` +} + +// TrainingRuntimeSpecApplyConfiguration constructs an declarative configuration of the TrainingRuntimeSpec type for use with +// apply. +func TrainingRuntimeSpec() *TrainingRuntimeSpecApplyConfiguration { + return &TrainingRuntimeSpecApplyConfiguration{} +} + +// WithMLPolicy sets the MLPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MLPolicy field is set to the value of the last call. +func (b *TrainingRuntimeSpecApplyConfiguration) WithMLPolicy(value *MLPolicyApplyConfiguration) *TrainingRuntimeSpecApplyConfiguration { + b.MLPolicy = value + return b +} + +// WithPodGroupPolicy sets the PodGroupPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodGroupPolicy field is set to the value of the last call. +func (b *TrainingRuntimeSpecApplyConfiguration) WithPodGroupPolicy(value *PodGroupPolicyApplyConfiguration) *TrainingRuntimeSpecApplyConfiguration { + b.PodGroupPolicy = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *TrainingRuntimeSpecApplyConfiguration) WithTemplate(value *JobSetTemplateSpecApplyConfiguration) *TrainingRuntimeSpecApplyConfiguration { + b.Template = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjob.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjob.go new file mode 100644 index 0000000000..cc1a983ca5 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjob.go @@ -0,0 +1,217 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TrainJobApplyConfiguration represents an declarative configuration of the TrainJob type for use +// with apply. +type TrainJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TrainJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *TrainJobStatusApplyConfiguration `json:"status,omitempty"` +} + +// TrainJob constructs an declarative configuration of the TrainJob type for use with +// apply. +func TrainJob(name, namespace string) *TrainJobApplyConfiguration { + b := &TrainJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TrainJob") + b.WithAPIVersion("kubeflow.org/v2alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithKind(value string) *TrainJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithAPIVersion(value string) *TrainJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithName(value string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithGenerateName(value string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithNamespace(value string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithUID(value types.UID) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithResourceVersion(value string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithGeneration(value int64) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TrainJobApplyConfiguration) WithLabels(entries map[string]string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TrainJobApplyConfiguration) WithAnnotations(entries map[string]string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TrainJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TrainJobApplyConfiguration) WithFinalizers(values ...string) *TrainJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *TrainJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithSpec(value *TrainJobSpecApplyConfiguration) *TrainJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *TrainJobApplyConfiguration) WithStatus(value *TrainJobStatusApplyConfiguration) *TrainJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobspec.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobspec.go new file mode 100644 index 0000000000..bd58729353 --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobspec.go @@ -0,0 +1,126 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +// TrainJobSpecApplyConfiguration represents an declarative configuration of the TrainJobSpec type for use +// with apply. +type TrainJobSpecApplyConfiguration struct { + RuntimeRef *RuntimeRefApplyConfiguration `json:"runtimeRef,omitempty"` + Trainer *TrainerApplyConfiguration `json:"trainer,omitempty"` + DatasetConfig *DatasetConfigApplyConfiguration `json:"datasetConfig,omitempty"` + ModelConfig *ModelConfigApplyConfiguration `json:"modelConfig,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` + PodSpecOverrides []PodSpecOverrideApplyConfiguration `json:"podSpecOverrides,omitempty"` + Suspend *bool `json:"suspend,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` +} + +// TrainJobSpecApplyConfiguration constructs an declarative configuration of the TrainJobSpec type for use with +// apply. +func TrainJobSpec() *TrainJobSpecApplyConfiguration { + return &TrainJobSpecApplyConfiguration{} +} + +// WithRuntimeRef sets the RuntimeRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RuntimeRef field is set to the value of the last call. +func (b *TrainJobSpecApplyConfiguration) WithRuntimeRef(value *RuntimeRefApplyConfiguration) *TrainJobSpecApplyConfiguration { + b.RuntimeRef = value + return b +} + +// WithTrainer sets the Trainer field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Trainer field is set to the value of the last call. +func (b *TrainJobSpecApplyConfiguration) WithTrainer(value *TrainerApplyConfiguration) *TrainJobSpecApplyConfiguration { + b.Trainer = value + return b +} + +// WithDatasetConfig sets the DatasetConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DatasetConfig field is set to the value of the last call. +func (b *TrainJobSpecApplyConfiguration) WithDatasetConfig(value *DatasetConfigApplyConfiguration) *TrainJobSpecApplyConfiguration { + b.DatasetConfig = value + return b +} + +// WithModelConfig sets the ModelConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ModelConfig field is set to the value of the last call. +func (b *TrainJobSpecApplyConfiguration) WithModelConfig(value *ModelConfigApplyConfiguration) *TrainJobSpecApplyConfiguration { + b.ModelConfig = value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TrainJobSpecApplyConfiguration) WithLabels(entries map[string]string) *TrainJobSpecApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TrainJobSpecApplyConfiguration) WithAnnotations(entries map[string]string) *TrainJobSpecApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithPodSpecOverrides adds the given value to the PodSpecOverrides field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PodSpecOverrides field. +func (b *TrainJobSpecApplyConfiguration) WithPodSpecOverrides(values ...*PodSpecOverrideApplyConfiguration) *TrainJobSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodSpecOverrides") + } + b.PodSpecOverrides = append(b.PodSpecOverrides, *values[i]) + } + return b +} + +// WithSuspend sets the Suspend field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Suspend field is set to the value of the last call. +func (b *TrainJobSpecApplyConfiguration) WithSuspend(value bool) *TrainJobSpecApplyConfiguration { + b.Suspend = &value + return b +} + +// WithManagedBy sets the ManagedBy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ManagedBy field is set to the value of the last call. +func (b *TrainJobSpecApplyConfiguration) WithManagedBy(value string) *TrainJobSpecApplyConfiguration { + b.ManagedBy = &value + return b +} diff --git a/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobstatus.go b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobstatus.go new file mode 100644 index 0000000000..2db3bc8ebe --- /dev/null +++ b/pkg/client/applyconfiguration/kubeflow.org/v2alpha1/trainjobstatus.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 applyconfiguration-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TrainJobStatusApplyConfiguration represents an declarative configuration of the TrainJobStatus type for use +// with apply. +type TrainJobStatusApplyConfiguration struct { + Conditions []v1.Condition `json:"conditions,omitempty"` + JobsStatus []JobStatusApplyConfiguration `json:"jobsStatus,omitempty"` +} + +// TrainJobStatusApplyConfiguration constructs an declarative configuration of the TrainJobStatus type for use with +// apply. +func TrainJobStatus() *TrainJobStatusApplyConfiguration { + return &TrainJobStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *TrainJobStatusApplyConfiguration) WithConditions(values ...v1.Condition) *TrainJobStatusApplyConfiguration { + for i := range values { + b.Conditions = append(b.Conditions, values[i]) + } + return b +} + +// WithJobsStatus adds the given value to the JobsStatus field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the JobsStatus field. +func (b *TrainJobStatusApplyConfiguration) WithJobsStatus(values ...*JobStatusApplyConfiguration) *TrainJobStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithJobsStatus") + } + b.JobsStatus = append(b.JobsStatus, *values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/utils.go b/pkg/client/applyconfiguration/utils.go new file mode 100644 index 0000000000..0dd820f1e6 --- /dev/null +++ b/pkg/client/applyconfiguration/utils.go @@ -0,0 +1,129 @@ +// 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 applyconfiguration-gen. DO NOT EDIT. + +package applyconfiguration + +import ( + v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v2alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=kubeflow.org, Version=v1 + case v1.SchemeGroupVersion.WithKind("ElasticPolicy"): + return &kubefloworgv1.ElasticPolicyApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("JAXJob"): + return &kubefloworgv1.JAXJobApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("JAXJobSpec"): + return &kubefloworgv1.JAXJobSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("JobCondition"): + return &kubefloworgv1.JobConditionApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("JobStatus"): + return &kubefloworgv1.JobStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MPIJob"): + return &kubefloworgv1.MPIJobApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MPIJobSpec"): + return &kubefloworgv1.MPIJobSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("PaddleElasticPolicy"): + return &kubefloworgv1.PaddleElasticPolicyApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("PaddleJob"): + return &kubefloworgv1.PaddleJobApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("PaddleJobSpec"): + return &kubefloworgv1.PaddleJobSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("PyTorchJob"): + return &kubefloworgv1.PyTorchJobApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("PyTorchJobSpec"): + return &kubefloworgv1.PyTorchJobSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RDZVConf"): + return &kubefloworgv1.RDZVConfApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ReplicaSpec"): + return &kubefloworgv1.ReplicaSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ReplicaStatus"): + return &kubefloworgv1.ReplicaStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RunPolicy"): + return &kubefloworgv1.RunPolicyApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("SchedulingPolicy"): + return &kubefloworgv1.SchedulingPolicyApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("TFJob"): + return &kubefloworgv1.TFJobApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("TFJobSpec"): + return &kubefloworgv1.TFJobSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("XGBoostJob"): + return &kubefloworgv1.XGBoostJobApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("XGBoostJobSpec"): + return &kubefloworgv1.XGBoostJobSpecApplyConfiguration{} + + // Group=kubeflow.org, Version=v2alpha1 + case v2alpha1.SchemeGroupVersion.WithKind("ClusterTrainingRuntime"): + return &kubefloworgv2alpha1.ClusterTrainingRuntimeApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("ContainerOverride"): + return &kubefloworgv2alpha1.ContainerOverrideApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("CoschedulingPodGroupPolicySource"): + return &kubefloworgv2alpha1.CoschedulingPodGroupPolicySourceApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("DatasetConfig"): + return &kubefloworgv2alpha1.DatasetConfigApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("InputModel"): + return &kubefloworgv2alpha1.InputModelApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("JobSetTemplateSpec"): + return &kubefloworgv2alpha1.JobSetTemplateSpecApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("JobStatus"): + return &kubefloworgv2alpha1.JobStatusApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("MLPolicy"): + return &kubefloworgv2alpha1.MLPolicyApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("MLPolicySource"): + return &kubefloworgv2alpha1.MLPolicySourceApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("ModelConfig"): + return &kubefloworgv2alpha1.ModelConfigApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("MPIMLPolicySource"): + return &kubefloworgv2alpha1.MPIMLPolicySourceApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("OutputModel"): + return &kubefloworgv2alpha1.OutputModelApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("PodGroupPolicy"): + return &kubefloworgv2alpha1.PodGroupPolicyApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("PodGroupPolicySource"): + return &kubefloworgv2alpha1.PodGroupPolicySourceApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("PodSpecOverride"): + return &kubefloworgv2alpha1.PodSpecOverrideApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("PodSpecOverrideTargetJob"): + return &kubefloworgv2alpha1.PodSpecOverrideTargetJobApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("RuntimeRef"): + return &kubefloworgv2alpha1.RuntimeRefApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TorchElasticPolicy"): + return &kubefloworgv2alpha1.TorchElasticPolicyApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TorchMLPolicySource"): + return &kubefloworgv2alpha1.TorchMLPolicySourceApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("Trainer"): + return &kubefloworgv2alpha1.TrainerApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TrainingRuntime"): + return &kubefloworgv2alpha1.TrainingRuntimeApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TrainingRuntimeSpec"): + return &kubefloworgv2alpha1.TrainingRuntimeSpecApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TrainJob"): + return &kubefloworgv2alpha1.TrainJobApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TrainJobSpec"): + return &kubefloworgv2alpha1.TrainJobSpecApplyConfiguration{} + case v2alpha1.SchemeGroupVersion.WithKind("TrainJobStatus"): + return &kubefloworgv2alpha1.TrainJobStatusApplyConfiguration{} + + } + return nil +} 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 c3aab5610a..c0e6d3594a 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakeJAXJobs) Patch(ctx context.Context, name string, pt types.PatchType } return obj.(*v1.JAXJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied jAXJob. +func (c *FakeJAXJobs) Apply(ctx context.Context, jAXJob *kubefloworgv1.JAXJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.JAXJob, err error) { + if jAXJob == nil { + return nil, fmt.Errorf("jAXJob provided to Apply must not be nil") + } + data, err := json.Marshal(jAXJob) + if err != nil { + return nil, err + } + name := jAXJob.Name + if name == nil { + return nil, fmt.Errorf("jAXJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(jaxjobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.JAXJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.JAXJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeJAXJobs) ApplyStatus(ctx context.Context, jAXJob *kubefloworgv1.JAXJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.JAXJob, err error) { + if jAXJob == nil { + return nil, fmt.Errorf("jAXJob provided to Apply must not be nil") + } + data, err := json.Marshal(jAXJob) + if err != nil { + return nil, err + } + name := jAXJob.Name + if name == nil { + return nil, fmt.Errorf("jAXJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(jaxjobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.JAXJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.JAXJob), err +} 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 283a5502ff..9f0c9f8c4b 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakeMPIJobs) Patch(ctx context.Context, name string, pt types.PatchType } return obj.(*v1.MPIJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied mPIJob. +func (c *FakeMPIJobs) Apply(ctx context.Context, mPIJob *kubefloworgv1.MPIJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MPIJob, err error) { + if mPIJob == nil { + return nil, fmt.Errorf("mPIJob provided to Apply must not be nil") + } + data, err := json.Marshal(mPIJob) + if err != nil { + return nil, err + } + name := mPIJob.Name + if name == nil { + return nil, fmt.Errorf("mPIJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(mpijobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.MPIJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.MPIJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeMPIJobs) ApplyStatus(ctx context.Context, mPIJob *kubefloworgv1.MPIJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MPIJob, err error) { + if mPIJob == nil { + return nil, fmt.Errorf("mPIJob provided to Apply must not be nil") + } + data, err := json.Marshal(mPIJob) + if err != nil { + return nil, err + } + name := mPIJob.Name + if name == nil { + return nil, fmt.Errorf("mPIJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(mpijobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.MPIJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.MPIJob), err +} 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 6a9d3f1098..33378022c9 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakePaddleJobs) Patch(ctx context.Context, name string, pt types.PatchT } return obj.(*v1.PaddleJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied paddleJob. +func (c *FakePaddleJobs) Apply(ctx context.Context, paddleJob *kubefloworgv1.PaddleJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PaddleJob, err error) { + if paddleJob == nil { + return nil, fmt.Errorf("paddleJob provided to Apply must not be nil") + } + data, err := json.Marshal(paddleJob) + if err != nil { + return nil, err + } + name := paddleJob.Name + if name == nil { + return nil, fmt.Errorf("paddleJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(paddlejobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.PaddleJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PaddleJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePaddleJobs) ApplyStatus(ctx context.Context, paddleJob *kubefloworgv1.PaddleJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PaddleJob, err error) { + if paddleJob == nil { + return nil, fmt.Errorf("paddleJob provided to Apply must not be nil") + } + data, err := json.Marshal(paddleJob) + if err != nil { + return nil, err + } + name := paddleJob.Name + if name == nil { + return nil, fmt.Errorf("paddleJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(paddlejobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.PaddleJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PaddleJob), err +} 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 0bfcc58333..b40917f68b 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakePyTorchJobs) Patch(ctx context.Context, name string, pt types.Patch } return obj.(*v1.PyTorchJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied pyTorchJob. +func (c *FakePyTorchJobs) Apply(ctx context.Context, pyTorchJob *kubefloworgv1.PyTorchJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PyTorchJob, err error) { + if pyTorchJob == nil { + return nil, fmt.Errorf("pyTorchJob provided to Apply must not be nil") + } + data, err := json.Marshal(pyTorchJob) + if err != nil { + return nil, err + } + name := pyTorchJob.Name + if name == nil { + return nil, fmt.Errorf("pyTorchJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(pytorchjobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.PyTorchJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PyTorchJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePyTorchJobs) ApplyStatus(ctx context.Context, pyTorchJob *kubefloworgv1.PyTorchJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PyTorchJob, err error) { + if pyTorchJob == nil { + return nil, fmt.Errorf("pyTorchJob provided to Apply must not be nil") + } + data, err := json.Marshal(pyTorchJob) + if err != nil { + return nil, err + } + name := pyTorchJob.Name + if name == nil { + return nil, fmt.Errorf("pyTorchJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(pytorchjobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.PyTorchJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PyTorchJob), err +} 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 82205a1cca..6dcf267189 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakeTFJobs) Patch(ctx context.Context, name string, pt types.PatchType, } return obj.(*v1.TFJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied tFJob. +func (c *FakeTFJobs) Apply(ctx context.Context, tFJob *kubefloworgv1.TFJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TFJob, err error) { + if tFJob == nil { + return nil, fmt.Errorf("tFJob provided to Apply must not be nil") + } + data, err := json.Marshal(tFJob) + if err != nil { + return nil, err + } + name := tFJob.Name + if name == nil { + return nil, fmt.Errorf("tFJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(tfjobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.TFJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TFJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeTFJobs) ApplyStatus(ctx context.Context, tFJob *kubefloworgv1.TFJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TFJob, err error) { + if tFJob == nil { + return nil, fmt.Errorf("tFJob provided to Apply must not be nil") + } + data, err := json.Marshal(tFJob) + if err != nil { + return nil, err + } + name := tFJob.Name + if name == nil { + return nil, fmt.Errorf("tFJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(tfjobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.TFJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.TFJob), err +} 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 388566eaf2..640cf84f4a 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakeXGBoostJobs) Patch(ctx context.Context, name string, pt types.Patch } return obj.(*v1.XGBoostJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied xGBoostJob. +func (c *FakeXGBoostJobs) Apply(ctx context.Context, xGBoostJob *kubefloworgv1.XGBoostJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.XGBoostJob, err error) { + if xGBoostJob == nil { + return nil, fmt.Errorf("xGBoostJob provided to Apply must not be nil") + } + data, err := json.Marshal(xGBoostJob) + if err != nil { + return nil, err + } + name := xGBoostJob.Name + if name == nil { + return nil, fmt.Errorf("xGBoostJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(xgboostjobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.XGBoostJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.XGBoostJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeXGBoostJobs) ApplyStatus(ctx context.Context, xGBoostJob *kubefloworgv1.XGBoostJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.XGBoostJob, err error) { + if xGBoostJob == nil { + return nil, fmt.Errorf("xGBoostJob provided to Apply must not be nil") + } + data, err := json.Marshal(xGBoostJob) + if err != nil { + return nil, err + } + name := xGBoostJob.Name + if name == nil { + return nil, fmt.Errorf("xGBoostJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(xgboostjobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.XGBoostJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.XGBoostJob), err +} 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 1794671601..fe28bcec88 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/jaxjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/jaxjob.go @@ -18,9 +18,12 @@ package v1 import ( "context" + json "encoding/json" + "fmt" "time" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,8 @@ type JAXJobInterface interface { List(ctx context.Context, opts metav1.ListOptions) (*v1.JAXJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.JAXJob, err error) + Apply(ctx context.Context, jAXJob *kubefloworgv1.JAXJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.JAXJob, err error) + ApplyStatus(ctx context.Context, jAXJob *kubefloworgv1.JAXJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.JAXJob, err error) JAXJobExpansion } @@ -191,3 +196,59 @@ func (c *jAXJobs) Patch(ctx context.Context, name string, pt types.PatchType, da Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied jAXJob. +func (c *jAXJobs) Apply(ctx context.Context, jAXJob *kubefloworgv1.JAXJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.JAXJob, err error) { + if jAXJob == nil { + return nil, fmt.Errorf("jAXJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(jAXJob) + if err != nil { + return nil, err + } + name := jAXJob.Name + if name == nil { + return nil, fmt.Errorf("jAXJob.Name must be provided to Apply") + } + result = &v1.JAXJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("jaxjobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *jAXJobs) ApplyStatus(ctx context.Context, jAXJob *kubefloworgv1.JAXJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.JAXJob, err error) { + if jAXJob == nil { + return nil, fmt.Errorf("jAXJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(jAXJob) + if err != nil { + return nil, err + } + + name := jAXJob.Name + if name == nil { + return nil, fmt.Errorf("jAXJob.Name must be provided to Apply") + } + + result = &v1.JAXJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("jaxjobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 bbbbf44aad..694b9b9619 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/mpijob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/mpijob.go @@ -18,9 +18,12 @@ package v1 import ( "context" + json "encoding/json" + "fmt" "time" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,8 @@ type MPIJobInterface interface { List(ctx context.Context, opts metav1.ListOptions) (*v1.MPIJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MPIJob, err error) + Apply(ctx context.Context, mPIJob *kubefloworgv1.MPIJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MPIJob, err error) + ApplyStatus(ctx context.Context, mPIJob *kubefloworgv1.MPIJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MPIJob, err error) MPIJobExpansion } @@ -191,3 +196,59 @@ func (c *mPIJobs) Patch(ctx context.Context, name string, pt types.PatchType, da Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied mPIJob. +func (c *mPIJobs) Apply(ctx context.Context, mPIJob *kubefloworgv1.MPIJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MPIJob, err error) { + if mPIJob == nil { + return nil, fmt.Errorf("mPIJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(mPIJob) + if err != nil { + return nil, err + } + name := mPIJob.Name + if name == nil { + return nil, fmt.Errorf("mPIJob.Name must be provided to Apply") + } + result = &v1.MPIJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("mpijobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *mPIJobs) ApplyStatus(ctx context.Context, mPIJob *kubefloworgv1.MPIJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MPIJob, err error) { + if mPIJob == nil { + return nil, fmt.Errorf("mPIJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(mPIJob) + if err != nil { + return nil, err + } + + name := mPIJob.Name + if name == nil { + return nil, fmt.Errorf("mPIJob.Name must be provided to Apply") + } + + result = &v1.MPIJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("mpijobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 8d3ebafafb..4be46c0682 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/paddlejob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/paddlejob.go @@ -18,9 +18,12 @@ package v1 import ( "context" + json "encoding/json" + "fmt" "time" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,8 @@ type PaddleJobInterface interface { List(ctx context.Context, opts metav1.ListOptions) (*v1.PaddleJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PaddleJob, err error) + Apply(ctx context.Context, paddleJob *kubefloworgv1.PaddleJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PaddleJob, err error) + ApplyStatus(ctx context.Context, paddleJob *kubefloworgv1.PaddleJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PaddleJob, err error) PaddleJobExpansion } @@ -191,3 +196,59 @@ func (c *paddleJobs) Patch(ctx context.Context, name string, pt types.PatchType, Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied paddleJob. +func (c *paddleJobs) Apply(ctx context.Context, paddleJob *kubefloworgv1.PaddleJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PaddleJob, err error) { + if paddleJob == nil { + return nil, fmt.Errorf("paddleJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(paddleJob) + if err != nil { + return nil, err + } + name := paddleJob.Name + if name == nil { + return nil, fmt.Errorf("paddleJob.Name must be provided to Apply") + } + result = &v1.PaddleJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("paddlejobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *paddleJobs) ApplyStatus(ctx context.Context, paddleJob *kubefloworgv1.PaddleJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PaddleJob, err error) { + if paddleJob == nil { + return nil, fmt.Errorf("paddleJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(paddleJob) + if err != nil { + return nil, err + } + + name := paddleJob.Name + if name == nil { + return nil, fmt.Errorf("paddleJob.Name must be provided to Apply") + } + + result = &v1.PaddleJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("paddlejobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 a778dce52e..ea9a991135 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/pytorchjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/pytorchjob.go @@ -18,9 +18,12 @@ package v1 import ( "context" + json "encoding/json" + "fmt" "time" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,8 @@ type PyTorchJobInterface interface { List(ctx context.Context, opts metav1.ListOptions) (*v1.PyTorchJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PyTorchJob, err error) + Apply(ctx context.Context, pyTorchJob *kubefloworgv1.PyTorchJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PyTorchJob, err error) + ApplyStatus(ctx context.Context, pyTorchJob *kubefloworgv1.PyTorchJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PyTorchJob, err error) PyTorchJobExpansion } @@ -191,3 +196,59 @@ func (c *pyTorchJobs) Patch(ctx context.Context, name string, pt types.PatchType Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied pyTorchJob. +func (c *pyTorchJobs) Apply(ctx context.Context, pyTorchJob *kubefloworgv1.PyTorchJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PyTorchJob, err error) { + if pyTorchJob == nil { + return nil, fmt.Errorf("pyTorchJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(pyTorchJob) + if err != nil { + return nil, err + } + name := pyTorchJob.Name + if name == nil { + return nil, fmt.Errorf("pyTorchJob.Name must be provided to Apply") + } + result = &v1.PyTorchJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("pytorchjobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *pyTorchJobs) ApplyStatus(ctx context.Context, pyTorchJob *kubefloworgv1.PyTorchJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PyTorchJob, err error) { + if pyTorchJob == nil { + return nil, fmt.Errorf("pyTorchJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(pyTorchJob) + if err != nil { + return nil, err + } + + name := pyTorchJob.Name + if name == nil { + return nil, fmt.Errorf("pyTorchJob.Name must be provided to Apply") + } + + result = &v1.PyTorchJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("pytorchjobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 f0a6ea679b..48d73e1c5e 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/tfjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/tfjob.go @@ -18,9 +18,12 @@ package v1 import ( "context" + json "encoding/json" + "fmt" "time" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,8 @@ type TFJobInterface interface { List(ctx context.Context, opts metav1.ListOptions) (*v1.TFJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TFJob, err error) + Apply(ctx context.Context, tFJob *kubefloworgv1.TFJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TFJob, err error) + ApplyStatus(ctx context.Context, tFJob *kubefloworgv1.TFJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TFJob, err error) TFJobExpansion } @@ -191,3 +196,59 @@ func (c *tFJobs) Patch(ctx context.Context, name string, pt types.PatchType, dat Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied tFJob. +func (c *tFJobs) Apply(ctx context.Context, tFJob *kubefloworgv1.TFJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TFJob, err error) { + if tFJob == nil { + return nil, fmt.Errorf("tFJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(tFJob) + if err != nil { + return nil, err + } + name := tFJob.Name + if name == nil { + return nil, fmt.Errorf("tFJob.Name must be provided to Apply") + } + result = &v1.TFJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("tfjobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *tFJobs) ApplyStatus(ctx context.Context, tFJob *kubefloworgv1.TFJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TFJob, err error) { + if tFJob == nil { + return nil, fmt.Errorf("tFJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(tFJob) + if err != nil { + return nil, err + } + + name := tFJob.Name + if name == nil { + return nil, fmt.Errorf("tFJob.Name must be provided to Apply") + } + + result = &v1.TFJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("tfjobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 665eb38b63..25203d400a 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v1/xgboostjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v1/xgboostjob.go @@ -18,9 +18,12 @@ package v1 import ( "context" + json "encoding/json" + "fmt" "time" v1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1" + kubefloworgv1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v1" scheme "github.com/kubeflow/training-operator/pkg/client/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,8 @@ type XGBoostJobInterface interface { List(ctx context.Context, opts metav1.ListOptions) (*v1.XGBoostJobList, error) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.XGBoostJob, err error) + Apply(ctx context.Context, xGBoostJob *kubefloworgv1.XGBoostJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.XGBoostJob, err error) + ApplyStatus(ctx context.Context, xGBoostJob *kubefloworgv1.XGBoostJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.XGBoostJob, err error) XGBoostJobExpansion } @@ -191,3 +196,59 @@ func (c *xGBoostJobs) Patch(ctx context.Context, name string, pt types.PatchType Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied xGBoostJob. +func (c *xGBoostJobs) Apply(ctx context.Context, xGBoostJob *kubefloworgv1.XGBoostJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.XGBoostJob, err error) { + if xGBoostJob == nil { + return nil, fmt.Errorf("xGBoostJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(xGBoostJob) + if err != nil { + return nil, err + } + name := xGBoostJob.Name + if name == nil { + return nil, fmt.Errorf("xGBoostJob.Name must be provided to Apply") + } + result = &v1.XGBoostJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("xgboostjobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *xGBoostJobs) ApplyStatus(ctx context.Context, xGBoostJob *kubefloworgv1.XGBoostJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.XGBoostJob, err error) { + if xGBoostJob == nil { + return nil, fmt.Errorf("xGBoostJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(xGBoostJob) + if err != nil { + return nil, err + } + + name := xGBoostJob.Name + if name == nil { + return nil, fmt.Errorf("xGBoostJob.Name must be provided to Apply") + } + + result = &v1.XGBoostJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("xgboostjobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go index c3be9e3613..767a31916c 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/clustertrainingruntime.go @@ -18,9 +18,12 @@ package v2alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/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" @@ -44,6 +47,7 @@ type ClusterTrainingRuntimeInterface interface { 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) + Apply(ctx context.Context, clusterTrainingRuntime *kubefloworgv2alpha1.ClusterTrainingRuntimeApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) ClusterTrainingRuntimeExpansion } @@ -164,3 +168,28 @@ func (c *clusterTrainingRuntimes) Patch(ctx context.Context, name string, pt typ Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterTrainingRuntime. +func (c *clusterTrainingRuntimes) Apply(ctx context.Context, clusterTrainingRuntime *kubefloworgv2alpha1.ClusterTrainingRuntimeApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + if clusterTrainingRuntime == nil { + return nil, fmt.Errorf("clusterTrainingRuntime provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(clusterTrainingRuntime) + if err != nil { + return nil, err + } + name := clusterTrainingRuntime.Name + if name == nil { + return nil, fmt.Errorf("clusterTrainingRuntime.Name must be provided to Apply") + } + result = &v2alpha1.ClusterTrainingRuntime{} + err = c.client.Patch(types.ApplyPatchType). + Resource("clustertrainingruntimes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 index 1dbb7395db..7dadf6f47c 100644 --- 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v2alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -117,3 +120,24 @@ func (c *FakeClusterTrainingRuntimes) Patch(ctx context.Context, name string, pt } return obj.(*v2alpha1.ClusterTrainingRuntime), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterTrainingRuntime. +func (c *FakeClusterTrainingRuntimes) Apply(ctx context.Context, clusterTrainingRuntime *kubefloworgv2alpha1.ClusterTrainingRuntimeApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.ClusterTrainingRuntime, err error) { + if clusterTrainingRuntime == nil { + return nil, fmt.Errorf("clusterTrainingRuntime provided to Apply must not be nil") + } + data, err := json.Marshal(clusterTrainingRuntime) + if err != nil { + return nil, err + } + name := clusterTrainingRuntime.Name + if name == nil { + return nil, fmt.Errorf("clusterTrainingRuntime.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clustertrainingruntimesResource, *name, types.ApplyPatchType, data), &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_trainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/fake/fake_trainingruntime.go index 244782183e..70db641d80 100644 --- 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v2alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -125,3 +128,25 @@ func (c *FakeTrainingRuntimes) Patch(ctx context.Context, name string, pt types. } return obj.(*v2alpha1.TrainingRuntime), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied trainingRuntime. +func (c *FakeTrainingRuntimes) Apply(ctx context.Context, trainingRuntime *kubefloworgv2alpha1.TrainingRuntimeApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainingRuntime, err error) { + if trainingRuntime == nil { + return nil, fmt.Errorf("trainingRuntime provided to Apply must not be nil") + } + data, err := json.Marshal(trainingRuntime) + if err != nil { + return nil, err + } + name := trainingRuntime.Name + if name == nil { + return nil, fmt.Errorf("trainingRuntime.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trainingruntimesResource, c.ns, *name, types.ApplyPatchType, data), &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 index 2a88d35de5..b50ed38807 100644 --- 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 @@ -18,8 +18,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/kubeflow.org/v2alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -137,3 +140,48 @@ func (c *FakeTrainJobs) Patch(ctx context.Context, name string, pt types.PatchTy } return obj.(*v2alpha1.TrainJob), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied trainJob. +func (c *FakeTrainJobs) Apply(ctx context.Context, trainJob *kubefloworgv2alpha1.TrainJobApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainJob, err error) { + if trainJob == nil { + return nil, fmt.Errorf("trainJob provided to Apply must not be nil") + } + data, err := json.Marshal(trainJob) + if err != nil { + return nil, err + } + name := trainJob.Name + if name == nil { + return nil, fmt.Errorf("trainJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trainjobsResource, c.ns, *name, types.ApplyPatchType, data), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeTrainJobs) ApplyStatus(ctx context.Context, trainJob *kubefloworgv2alpha1.TrainJobApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainJob, err error) { + if trainJob == nil { + return nil, fmt.Errorf("trainJob provided to Apply must not be nil") + } + data, err := json.Marshal(trainJob) + if err != nil { + return nil, err + } + name := trainJob.Name + if name == nil { + return nil, fmt.Errorf("trainJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trainjobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v2alpha1.TrainJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.TrainJob), err +} diff --git a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go index fb491259f3..1e712d2a29 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainingruntime.go @@ -18,9 +18,12 @@ package v2alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/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" @@ -44,6 +47,7 @@ type TrainingRuntimeInterface interface { 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) + Apply(ctx context.Context, trainingRuntime *kubefloworgv2alpha1.TrainingRuntimeApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainingRuntime, err error) TrainingRuntimeExpansion } @@ -174,3 +178,29 @@ func (c *trainingRuntimes) Patch(ctx context.Context, name string, pt types.Patc Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied trainingRuntime. +func (c *trainingRuntimes) Apply(ctx context.Context, trainingRuntime *kubefloworgv2alpha1.TrainingRuntimeApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainingRuntime, err error) { + if trainingRuntime == nil { + return nil, fmt.Errorf("trainingRuntime provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(trainingRuntime) + if err != nil { + return nil, err + } + name := trainingRuntime.Name + if name == nil { + return nil, fmt.Errorf("trainingRuntime.Name must be provided to Apply") + } + result = &v2alpha1.TrainingRuntime{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("trainingruntimes"). + Name(*name). + VersionedParams(&patchOpts, 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 index d3e4d5a355..a66f05b87b 100644 --- a/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainjob.go +++ b/pkg/client/clientset/versioned/typed/kubeflow.org/v2alpha1/trainjob.go @@ -18,9 +18,12 @@ package v2alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v2alpha1 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" + kubefloworgv2alpha1 "github.com/kubeflow/training-operator/pkg/client/applyconfiguration/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" @@ -45,6 +48,8 @@ type TrainJobInterface interface { 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) + Apply(ctx context.Context, trainJob *kubefloworgv2alpha1.TrainJobApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainJob, err error) + ApplyStatus(ctx context.Context, trainJob *kubefloworgv2alpha1.TrainJobApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainJob, err error) TrainJobExpansion } @@ -191,3 +196,59 @@ func (c *trainJobs) Patch(ctx context.Context, name string, pt types.PatchType, Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied trainJob. +func (c *trainJobs) Apply(ctx context.Context, trainJob *kubefloworgv2alpha1.TrainJobApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainJob, err error) { + if trainJob == nil { + return nil, fmt.Errorf("trainJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(trainJob) + if err != nil { + return nil, err + } + name := trainJob.Name + if name == nil { + return nil, fmt.Errorf("trainJob.Name must be provided to Apply") + } + result = &v2alpha1.TrainJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("trainjobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *trainJobs) ApplyStatus(ctx context.Context, trainJob *kubefloworgv2alpha1.TrainJobApplyConfiguration, opts v1.ApplyOptions) (result *v2alpha1.TrainJob, err error) { + if trainJob == nil { + return nil, fmt.Errorf("trainJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(trainJob) + if err != nil { + return nil, err + } + + name := trainJob.Name + if name == nil { + return nil, fmt.Errorf("trainJob.Name must be provided to Apply") + } + + result = &v2alpha1.TrainJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("trainjobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/controller.v2/trainjob_controller.go b/pkg/controller.v2/trainjob_controller.go index 95a34048e0..ceba12c1ec 100644 --- a/pkg/controller.v2/trainjob_controller.go +++ b/pkg/controller.v2/trainjob_controller.go @@ -28,7 +28,6 @@ import ( "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/apiutil" kubeflowv2 "github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v2alpha1" jobruntimes "github.com/kubeflow/training-operator/pkg/runtime.v2" @@ -82,37 +81,20 @@ func (r *TrainJobReconciler) createOrUpdateObjs(ctx context.Context, trainJob *k if err != nil { return err } + for _, obj := range objs { - var gvk schema.GroupVersionKind - if gvk, err = apiutil.GVKForObject(obj.DeepCopyObject(), r.client.Scheme()); err != nil { - return err + // TODO: evaluate the fields we need in apply configuration from the object. + //applyConfig := v2alpha1applyconfiguration.TrainJob(trainJob.Name, trainJob.Namespace).WithSpec( + // v2alpha1applyconfiguration.TrainJobSpec()) + + if err := r.client.Patch(ctx, obj, client.Apply, client.FieldOwner("trainjob-controller"), client.ForceOwnership); err != nil { + return fmt.Errorf("failed to apply object: %w", err) } - logKeysAndValues := []any{ - "groupVersionKind", gvk.String(), + + log.V(5).Info("Successfully applied object", + "groupVersionKind", obj.GetObjectKind().GroupVersionKind().String(), "namespace", obj.GetNamespace(), - "name", obj.GetName(), - } - // TODO (tenzen-y): Ideally, we should use the SSA instead of checking existence. - // Non-empty resourceVersion indicates UPDATE operation. - var creationErr error - var created bool - if obj.GetResourceVersion() == "" { - creationErr = r.client.Create(ctx, obj) - created = creationErr == nil - } - switch { - case created: - log.V(5).Info("Succeeded to create object", logKeysAndValues) - continue - case client.IgnoreAlreadyExists(creationErr) != nil: - return creationErr - default: - // This indicates CREATE operation has not been performed or the object has already existed in the cluster. - if err = r.client.Update(ctx, obj); err != nil { - return err - } - log.V(5).Info("Succeeded to update object", logKeysAndValues) - } + "name", obj.GetName()) } return nil }