diff --git a/go.mod b/go.mod index eceba4136e7..d60380d519f 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/google/go-containerregistry v0.20.6 github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20250613215107-59a4b8593039 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 + github.com/kubeflow/trainer v1.5.0-rc.0.0.20250703110320-1ea271265d49 github.com/lib/pq v1.10.6 github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a github.com/nxadm/tail v1.4.11 @@ -72,7 +73,6 @@ require ( github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/docker-credential-helpers v0.9.3 // indirect github.com/emicklei/go-restful/v3 v3.12.2 // indirect - github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect @@ -102,9 +102,9 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.62.0 // indirect @@ -148,6 +148,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.34.0 // indirect k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect + sigs.k8s.io/jobset v0.8.0 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect sigs.k8s.io/randfill v1.0.0 // indirect ) diff --git a/go.sum b/go.sum index 7756249a67b..4902f725250 100644 --- a/go.sum +++ b/go.sum @@ -464,6 +464,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kubeflow/trainer v1.5.0-rc.0.0.20250703110320-1ea271265d49 h1:9Wmc4az/pQ1K0D4nu/cKXLn2ri1FVq+t400F9WsXzao= +github.com/kubeflow/trainer v1.5.0-rc.0.0.20250703110320-1ea271265d49/go.mod h1:I67gBLZqNPq5RFJ0TwQEcoVsRQ/3UHQanANn7J4sfVs= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leesper/go_rng v0.0.0-20171009123644-5344a9259b21/go.mod h1:N0SVk0uhy+E1PZ3C9ctsPRlvOPAFPkCNlcPBDkt0N3U= @@ -544,15 +546,17 @@ github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgr github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= @@ -1282,6 +1286,8 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/controller-runtime v0.22.0 h1:mTOfibb8Hxwpx3xEkR56i7xSjB+nH4hZG37SrlCY5e0= sigs.k8s.io/controller-runtime v0.22.0/go.mod h1:FwiwRjkRPbiN+zp2QRp7wlTCzbUXxZ/D4OzuQUDwBHY= +sigs.k8s.io/jobset v0.8.0 h1:80cJcPld+IMdKFOqzEW4et3Y6lGAPcP8YmBZ+aiKGYA= +sigs.k8s.io/jobset v0.8.0/go.mod h1:yitjuGOExl2p964nhyevQGIkfiPSRHcdC3zNBneKCT8= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index de1078337a4..9ac7c6e9aff 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -43,3 +43,8 @@ kube::codegen::gen_client \ --with-watch \ --with-applyconfig \ "${KATIB_ROOT}/pkg/apis/controller" + +echo "Generating deepcopy and defaults for optimizer.kubeflow.org ..." +kube::codegen::gen_helpers \ + --boilerplate "${KATIB_ROOT}/hack/boilerplate/boilerplate.go.txt" \ + "${KATIB_ROOT}/pkg/apis/optimizer" \ No newline at end of file diff --git a/pkg/apis/optimizer/v1alpha1/doc.go b/pkg/apis/optimizer/v1alpha1/doc.go new file mode 100644 index 00000000000..4c21acc5b63 --- /dev/null +++ b/pkg/apis/optimizer/v1alpha1/doc.go @@ -0,0 +1,8 @@ +// pkg/apis/optimizer/v1alpha1/doc.go + +// Package v1alpha1 contains API Schema definitions for the optimizer v1alpha1 API group. +// +k8s:deepcopy-gen=package +// +groupName=optimizer.kubeflow.org +// +kubebuilder:object:generate=true + +package v1alpha1 diff --git a/pkg/apis/optimizer/v1alpha1/optimizationjob_types.go b/pkg/apis/optimizer/v1alpha1/optimizationjob_types.go new file mode 100644 index 00000000000..2b663a9336e --- /dev/null +++ b/pkg/apis/optimizer/v1alpha1/optimizationjob_types.go @@ -0,0 +1,101 @@ +// pkg/apis/optimizer/v1alpha1/optimizationjob_types.go + +package v1alpha1 + +import ( + trainerv1alpha1 "github.com/kubeflow/trainer/pkg/apis/trainer/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// Objective defines the metric and goal for the HPO job. +type Objective struct { + Metric string `json:"metric"` + Direction string `json:"direction"` + Goal *float64 `json:"goal,omitempty"` +} + +// Algorithm defines the optimization algorithm configuration. +type Algorithm struct { + Name string `json:"name"` + Settings []SettingKV `json:"settings,omitempty"` +} + +// SettingKV is a key-value pair for algorithm settings. +type SettingKV struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// TrialConfig controls the orchestration of the trials. +type TrialConfig struct { + NumTrials *int32 `json:"num_trials,omitempty"` + ParallelTrials *int32 `json:"parallel_trials,omitempty"` + MaxFailedTrials *int32 `json:"max_failed_trials,omitempty"` +} + +// BestTrial tracks the best performing trial and its metrics. +type BestTrial struct { + Name string `json:"name"` + Value float64 `json:"value"` +} + +// OptimizationJobSpec defines the desired state of OptimizationJob. +type OptimizationJobSpec struct { + Objectives []Objective `json:"objectives"` + Algorithm Algorithm `json:"algorithm"` + + // Using map[string]string initially, can be refined to strict types later if needed. + SearchSpace map[string]string `json:"searchSpace"` + + TrialConfig TrialConfig `json:"trialConfig"` + + Initializer *trainerv1alpha1.Initializer `json:"initializer,omitempty"` + + // Tighter TrainJob Integration: Strongly typed to TrainJob rather than arbitrary CRDs. + // runtime.RawExtension allows embedding the raw TrainJob Kubernetes object. + // +kubebuilder:pruning:PreserveUnknownFields + TrialTemplate runtime.RawExtension `json:"trialTemplate"` +} + +// OptimizationJobStatus defines the observed state of OptimizationJob. +type OptimizationJobStatus struct { + // Conditions track the overall lifecycle of the OptimizationJob (e.g., Created, Running, Succeeded, Failed). + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // Active is the number of currently running trials. + Active int32 `json:"active,omitempty"` + + // Succeeded is the number of trials that successfully completed. + Succeeded int32 `json:"succeeded,omitempty"` + + // Failed is the number of trials that failed. + Failed int32 `json:"failed,omitempty"` + + // BestTrial holds the information about the best performing trial so far. + BestTrial *BestTrial `json:"bestTrial,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status + +// OptimizationJob is the Schema for the optimizationjobs API. +type OptimizationJob struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OptimizationJobSpec `json:"spec,omitempty"` + Status OptimizationJobStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// OptimizationJobList contains a list of OptimizationJob. +type OptimizationJobList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OptimizationJob `json:"items"` +} diff --git a/pkg/apis/optimizer/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/optimizer/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..15c6e1f08b9 --- /dev/null +++ b/pkg/apis/optimizer/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,260 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2022 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 deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + trainerv1alpha1 "github.com/kubeflow/trainer/pkg/apis/trainer/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Algorithm) DeepCopyInto(out *Algorithm) { + *out = *in + if in.Settings != nil { + in, out := &in.Settings, &out.Settings + *out = make([]SettingKV, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Algorithm. +func (in *Algorithm) DeepCopy() *Algorithm { + if in == nil { + return nil + } + out := new(Algorithm) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BestTrial) DeepCopyInto(out *BestTrial) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BestTrial. +func (in *BestTrial) DeepCopy() *BestTrial { + if in == nil { + return nil + } + out := new(BestTrial) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Objective) DeepCopyInto(out *Objective) { + *out = *in + if in.Goal != nil { + in, out := &in.Goal, &out.Goal + *out = new(float64) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Objective. +func (in *Objective) DeepCopy() *Objective { + if in == nil { + return nil + } + out := new(Objective) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OptimizationJob) DeepCopyInto(out *OptimizationJob) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptimizationJob. +func (in *OptimizationJob) DeepCopy() *OptimizationJob { + if in == nil { + return nil + } + out := new(OptimizationJob) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OptimizationJob) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OptimizationJobList) DeepCopyInto(out *OptimizationJobList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OptimizationJob, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptimizationJobList. +func (in *OptimizationJobList) DeepCopy() *OptimizationJobList { + if in == nil { + return nil + } + out := new(OptimizationJobList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OptimizationJobList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OptimizationJobSpec) DeepCopyInto(out *OptimizationJobSpec) { + *out = *in + if in.Objectives != nil { + in, out := &in.Objectives, &out.Objectives + *out = make([]Objective, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Algorithm.DeepCopyInto(&out.Algorithm) + if in.SearchSpace != nil { + in, out := &in.SearchSpace, &out.SearchSpace + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.TrialConfig.DeepCopyInto(&out.TrialConfig) + if in.Initializer != nil { + in, out := &in.Initializer, &out.Initializer + *out = new(trainerv1alpha1.Initializer) + (*in).DeepCopyInto(*out) + } + in.TrialTemplate.DeepCopyInto(&out.TrialTemplate) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptimizationJobSpec. +func (in *OptimizationJobSpec) DeepCopy() *OptimizationJobSpec { + if in == nil { + return nil + } + out := new(OptimizationJobSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OptimizationJobStatus) DeepCopyInto(out *OptimizationJobStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.BestTrial != nil { + in, out := &in.BestTrial, &out.BestTrial + *out = new(BestTrial) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptimizationJobStatus. +func (in *OptimizationJobStatus) DeepCopy() *OptimizationJobStatus { + if in == nil { + return nil + } + out := new(OptimizationJobStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SettingKV) DeepCopyInto(out *SettingKV) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingKV. +func (in *SettingKV) DeepCopy() *SettingKV { + if in == nil { + return nil + } + out := new(SettingKV) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrialConfig) DeepCopyInto(out *TrialConfig) { + *out = *in + if in.NumTrials != nil { + in, out := &in.NumTrials, &out.NumTrials + *out = new(int32) + **out = **in + } + if in.ParallelTrials != nil { + in, out := &in.ParallelTrials, &out.ParallelTrials + *out = new(int32) + **out = **in + } + if in.MaxFailedTrials != nil { + in, out := &in.MaxFailedTrials, &out.MaxFailedTrials + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialConfig. +func (in *TrialConfig) DeepCopy() *TrialConfig { + if in == nil { + return nil + } + out := new(TrialConfig) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/configmapsource.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/configmapsource.go new file mode 100644 index 00000000000..6e548a6fb25 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/configmapsource.go @@ -0,0 +1,57 @@ +/* +Copyright 2022 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 v1beta1 + +// ConfigMapSourceApplyConfiguration represents a declarative configuration of the ConfigMapSource type for use +// with apply. +type ConfigMapSourceApplyConfiguration struct { + ConfigMapName *string `json:"configMapName,omitempty"` + ConfigMapNamespace *string `json:"configMapNamespace,omitempty"` + TemplatePath *string `json:"templatePath,omitempty"` +} + +// ConfigMapSourceApplyConfiguration constructs a declarative configuration of the ConfigMapSource type for use with +// apply. +func ConfigMapSource() *ConfigMapSourceApplyConfiguration { + return &ConfigMapSourceApplyConfiguration{} +} + +// WithConfigMapName sets the ConfigMapName 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 ConfigMapName field is set to the value of the last call. +func (b *ConfigMapSourceApplyConfiguration) WithConfigMapName(value string) *ConfigMapSourceApplyConfiguration { + b.ConfigMapName = &value + return b +} + +// WithConfigMapNamespace sets the ConfigMapNamespace 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 ConfigMapNamespace field is set to the value of the last call. +func (b *ConfigMapSourceApplyConfiguration) WithConfigMapNamespace(value string) *ConfigMapSourceApplyConfiguration { + b.ConfigMapNamespace = &value + return b +} + +// WithTemplatePath sets the TemplatePath 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 TemplatePath field is set to the value of the last call. +func (b *ConfigMapSourceApplyConfiguration) WithTemplatePath(value string) *ConfigMapSourceApplyConfiguration { + b.TemplatePath = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experiment.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experiment.go new file mode 100644 index 00000000000..0aeaa1e16ed --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experiment.go @@ -0,0 +1,242 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ExperimentApplyConfiguration represents a declarative configuration of the Experiment type for use +// with apply. +type ExperimentApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ExperimentSpecApplyConfiguration `json:"spec,omitempty"` + Status *ExperimentStatusApplyConfiguration `json:"status,omitempty"` +} + +// Experiment constructs a declarative configuration of the Experiment type for use with +// apply. +func Experiment(name, namespace string) *ExperimentApplyConfiguration { + b := &ExperimentApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Experiment") + b.WithAPIVersion("experiment.kubeflow.org/v1beta1") + return b +} +func (b ExperimentApplyConfiguration) IsApplyConfiguration() {} + +// 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 *ExperimentApplyConfiguration) WithKind(value string) *ExperimentApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithAPIVersion(value string) *ExperimentApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithName(value string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithGenerateName(value string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithNamespace(value string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithUID(value types.UID) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithResourceVersion(value string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithGeneration(value int64) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithLabels(entries map[string]string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithAnnotations(entries map[string]string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.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 *ExperimentApplyConfiguration) WithFinalizers(values ...string) *ExperimentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ExperimentApplyConfiguration) 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 *ExperimentApplyConfiguration) WithSpec(value *ExperimentSpecApplyConfiguration) *ExperimentApplyConfiguration { + 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 *ExperimentApplyConfiguration) WithStatus(value *ExperimentStatusApplyConfiguration) *ExperimentApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ExperimentApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ExperimentApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ExperimentApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ExperimentApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentcondition.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentcondition.go new file mode 100644 index 00000000000..0cbb90d551f --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentcondition.go @@ -0,0 +1,90 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ExperimentConditionApplyConfiguration represents a declarative configuration of the ExperimentCondition type for use +// with apply. +type ExperimentConditionApplyConfiguration struct { + Type *experimentsv1beta1.ExperimentConditionType `json:"type,omitempty"` + Status *v1.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"` +} + +// ExperimentConditionApplyConfiguration constructs a declarative configuration of the ExperimentCondition type for use with +// apply. +func ExperimentCondition() *ExperimentConditionApplyConfiguration { + return &ExperimentConditionApplyConfiguration{} +} + +// 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 *ExperimentConditionApplyConfiguration) WithType(value experimentsv1beta1.ExperimentConditionType) *ExperimentConditionApplyConfiguration { + 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 *ExperimentConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *ExperimentConditionApplyConfiguration { + 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 *ExperimentConditionApplyConfiguration) WithReason(value string) *ExperimentConditionApplyConfiguration { + 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 *ExperimentConditionApplyConfiguration) WithMessage(value string) *ExperimentConditionApplyConfiguration { + 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 *ExperimentConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *ExperimentConditionApplyConfiguration { + 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 *ExperimentConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *ExperimentConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentspec.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentspec.go new file mode 100644 index 00000000000..376fc1d4b0d --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentspec.go @@ -0,0 +1,139 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" + experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" +) + +// ExperimentSpecApplyConfiguration represents a declarative configuration of the ExperimentSpec type for use +// with apply. +type ExperimentSpecApplyConfiguration struct { + Parameters []ParameterSpecApplyConfiguration `json:"parameters,omitempty"` + Objective *commonv1beta1.ObjectiveSpec `json:"objective,omitempty"` + Algorithm *commonv1beta1.AlgorithmSpec `json:"algorithm,omitempty"` + EarlyStopping *commonv1beta1.EarlyStoppingSpec `json:"earlyStopping,omitempty"` + TrialTemplate *TrialTemplateApplyConfiguration `json:"trialTemplate,omitempty"` + ParallelTrialCount *int32 `json:"parallelTrialCount,omitempty"` + MaxTrialCount *int32 `json:"maxTrialCount,omitempty"` + MaxFailedTrialCount *int32 `json:"maxFailedTrialCount,omitempty"` + MetricsCollectorSpec *commonv1beta1.MetricsCollectorSpec `json:"metricsCollectorSpec,omitempty"` + NasConfig *NasConfigApplyConfiguration `json:"nasConfig,omitempty"` + ResumePolicy *experimentsv1beta1.ResumePolicyType `json:"resumePolicy,omitempty"` +} + +// ExperimentSpecApplyConfiguration constructs a declarative configuration of the ExperimentSpec type for use with +// apply. +func ExperimentSpec() *ExperimentSpecApplyConfiguration { + return &ExperimentSpecApplyConfiguration{} +} + +// WithParameters adds the given value to the Parameters 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 Parameters field. +func (b *ExperimentSpecApplyConfiguration) WithParameters(values ...*ParameterSpecApplyConfiguration) *ExperimentSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithParameters") + } + b.Parameters = append(b.Parameters, *values[i]) + } + return b +} + +// WithObjective sets the Objective 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 Objective field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithObjective(value commonv1beta1.ObjectiveSpec) *ExperimentSpecApplyConfiguration { + b.Objective = &value + return b +} + +// WithAlgorithm sets the Algorithm 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 Algorithm field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithAlgorithm(value commonv1beta1.AlgorithmSpec) *ExperimentSpecApplyConfiguration { + b.Algorithm = &value + return b +} + +// WithEarlyStopping sets the EarlyStopping 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 EarlyStopping field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithEarlyStopping(value commonv1beta1.EarlyStoppingSpec) *ExperimentSpecApplyConfiguration { + b.EarlyStopping = &value + return b +} + +// WithTrialTemplate sets the TrialTemplate 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 TrialTemplate field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithTrialTemplate(value *TrialTemplateApplyConfiguration) *ExperimentSpecApplyConfiguration { + b.TrialTemplate = value + return b +} + +// WithParallelTrialCount sets the ParallelTrialCount 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 ParallelTrialCount field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithParallelTrialCount(value int32) *ExperimentSpecApplyConfiguration { + b.ParallelTrialCount = &value + return b +} + +// WithMaxTrialCount sets the MaxTrialCount 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 MaxTrialCount field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithMaxTrialCount(value int32) *ExperimentSpecApplyConfiguration { + b.MaxTrialCount = &value + return b +} + +// WithMaxFailedTrialCount sets the MaxFailedTrialCount 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 MaxFailedTrialCount field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithMaxFailedTrialCount(value int32) *ExperimentSpecApplyConfiguration { + b.MaxFailedTrialCount = &value + return b +} + +// WithMetricsCollectorSpec sets the MetricsCollectorSpec 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 MetricsCollectorSpec field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithMetricsCollectorSpec(value commonv1beta1.MetricsCollectorSpec) *ExperimentSpecApplyConfiguration { + b.MetricsCollectorSpec = &value + return b +} + +// WithNasConfig sets the NasConfig 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 NasConfig field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithNasConfig(value *NasConfigApplyConfiguration) *ExperimentSpecApplyConfiguration { + b.NasConfig = value + return b +} + +// WithResumePolicy sets the ResumePolicy 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 ResumePolicy field is set to the value of the last call. +func (b *ExperimentSpecApplyConfiguration) WithResumePolicy(value experimentsv1beta1.ResumePolicyType) *ExperimentSpecApplyConfiguration { + b.ResumePolicy = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentstatus.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentstatus.go new file mode 100644 index 00000000000..9f721285dd3 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/experimentstatus.go @@ -0,0 +1,233 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ExperimentStatusApplyConfiguration represents a declarative configuration of the ExperimentStatus type for use +// with apply. +type ExperimentStatusApplyConfiguration struct { + StartTime *v1.Time `json:"startTime,omitempty"` + CompletionTime *v1.Time `json:"completionTime,omitempty"` + LastReconcileTime *v1.Time `json:"lastReconcileTime,omitempty"` + Conditions []ExperimentConditionApplyConfiguration `json:"conditions,omitempty"` + CurrentOptimalTrial *OptimalTrialApplyConfiguration `json:"currentOptimalTrial,omitempty"` + RunningTrialList []string `json:"runningTrialList,omitempty"` + PendingTrialList []string `json:"pendingTrialList,omitempty"` + FailedTrialList []string `json:"failedTrialList,omitempty"` + SucceededTrialList []string `json:"succeededTrialList,omitempty"` + KilledTrialList []string `json:"killedTrialList,omitempty"` + EarlyStoppedTrialList []string `json:"earlyStoppedTrialList,omitempty"` + MetricsUnavailableTrialList []string `json:"metricsUnavailableTrialList,omitempty"` + Trials *int32 `json:"trials,omitempty"` + TrialsSucceeded *int32 `json:"trialsSucceeded,omitempty"` + TrialsFailed *int32 `json:"trialsFailed,omitempty"` + TrialsKilled *int32 `json:"trialsKilled,omitempty"` + TrialsPending *int32 `json:"trialsPending,omitempty"` + TrialsRunning *int32 `json:"trialsRunning,omitempty"` + TrialsEarlyStopped *int32 `json:"trialsEarlyStopped,omitempty"` + TrialMetricsUnavailable *int32 `json:"trialMetricsUnavailable,omitempty"` +} + +// ExperimentStatusApplyConfiguration constructs a declarative configuration of the ExperimentStatus type for use with +// apply. +func ExperimentStatus() *ExperimentStatusApplyConfiguration { + return &ExperimentStatusApplyConfiguration{} +} + +// 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 *ExperimentStatusApplyConfiguration) WithStartTime(value v1.Time) *ExperimentStatusApplyConfiguration { + 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 *ExperimentStatusApplyConfiguration) WithCompletionTime(value v1.Time) *ExperimentStatusApplyConfiguration { + 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 *ExperimentStatusApplyConfiguration) WithLastReconcileTime(value v1.Time) *ExperimentStatusApplyConfiguration { + b.LastReconcileTime = &value + return b +} + +// 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 *ExperimentStatusApplyConfiguration) WithConditions(values ...*ExperimentConditionApplyConfiguration) *ExperimentStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithCurrentOptimalTrial sets the CurrentOptimalTrial 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 CurrentOptimalTrial field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithCurrentOptimalTrial(value *OptimalTrialApplyConfiguration) *ExperimentStatusApplyConfiguration { + b.CurrentOptimalTrial = value + return b +} + +// WithRunningTrialList adds the given value to the RunningTrialList 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 RunningTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithRunningTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.RunningTrialList = append(b.RunningTrialList, values[i]) + } + return b +} + +// WithPendingTrialList adds the given value to the PendingTrialList 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 PendingTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithPendingTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.PendingTrialList = append(b.PendingTrialList, values[i]) + } + return b +} + +// WithFailedTrialList adds the given value to the FailedTrialList 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 FailedTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithFailedTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.FailedTrialList = append(b.FailedTrialList, values[i]) + } + return b +} + +// WithSucceededTrialList adds the given value to the SucceededTrialList 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 SucceededTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithSucceededTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.SucceededTrialList = append(b.SucceededTrialList, values[i]) + } + return b +} + +// WithKilledTrialList adds the given value to the KilledTrialList 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 KilledTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithKilledTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.KilledTrialList = append(b.KilledTrialList, values[i]) + } + return b +} + +// WithEarlyStoppedTrialList adds the given value to the EarlyStoppedTrialList 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 EarlyStoppedTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithEarlyStoppedTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.EarlyStoppedTrialList = append(b.EarlyStoppedTrialList, values[i]) + } + return b +} + +// WithMetricsUnavailableTrialList adds the given value to the MetricsUnavailableTrialList 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 MetricsUnavailableTrialList field. +func (b *ExperimentStatusApplyConfiguration) WithMetricsUnavailableTrialList(values ...string) *ExperimentStatusApplyConfiguration { + for i := range values { + b.MetricsUnavailableTrialList = append(b.MetricsUnavailableTrialList, values[i]) + } + return b +} + +// WithTrials sets the Trials 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 Trials field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrials(value int32) *ExperimentStatusApplyConfiguration { + b.Trials = &value + return b +} + +// WithTrialsSucceeded sets the TrialsSucceeded 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 TrialsSucceeded field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialsSucceeded(value int32) *ExperimentStatusApplyConfiguration { + b.TrialsSucceeded = &value + return b +} + +// WithTrialsFailed sets the TrialsFailed 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 TrialsFailed field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialsFailed(value int32) *ExperimentStatusApplyConfiguration { + b.TrialsFailed = &value + return b +} + +// WithTrialsKilled sets the TrialsKilled 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 TrialsKilled field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialsKilled(value int32) *ExperimentStatusApplyConfiguration { + b.TrialsKilled = &value + return b +} + +// WithTrialsPending sets the TrialsPending 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 TrialsPending field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialsPending(value int32) *ExperimentStatusApplyConfiguration { + b.TrialsPending = &value + return b +} + +// WithTrialsRunning sets the TrialsRunning 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 TrialsRunning field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialsRunning(value int32) *ExperimentStatusApplyConfiguration { + b.TrialsRunning = &value + return b +} + +// WithTrialsEarlyStopped sets the TrialsEarlyStopped 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 TrialsEarlyStopped field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialsEarlyStopped(value int32) *ExperimentStatusApplyConfiguration { + b.TrialsEarlyStopped = &value + return b +} + +// WithTrialMetricsUnavailable sets the TrialMetricsUnavailable 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 TrialMetricsUnavailable field is set to the value of the last call. +func (b *ExperimentStatusApplyConfiguration) WithTrialMetricsUnavailable(value int32) *ExperimentStatusApplyConfiguration { + b.TrialMetricsUnavailable = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/feasiblespace.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/feasiblespace.go new file mode 100644 index 00000000000..772335d9531 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/feasiblespace.go @@ -0,0 +1,81 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" +) + +// FeasibleSpaceApplyConfiguration represents a declarative configuration of the FeasibleSpace type for use +// with apply. +type FeasibleSpaceApplyConfiguration struct { + Max *string `json:"max,omitempty"` + Min *string `json:"min,omitempty"` + List []string `json:"list,omitempty"` + Step *string `json:"step,omitempty"` + Distribution *experimentsv1beta1.Distribution `json:"distribution,omitempty"` +} + +// FeasibleSpaceApplyConfiguration constructs a declarative configuration of the FeasibleSpace type for use with +// apply. +func FeasibleSpace() *FeasibleSpaceApplyConfiguration { + return &FeasibleSpaceApplyConfiguration{} +} + +// WithMax sets the Max 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 Max field is set to the value of the last call. +func (b *FeasibleSpaceApplyConfiguration) WithMax(value string) *FeasibleSpaceApplyConfiguration { + b.Max = &value + return b +} + +// WithMin sets the Min 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 Min field is set to the value of the last call. +func (b *FeasibleSpaceApplyConfiguration) WithMin(value string) *FeasibleSpaceApplyConfiguration { + b.Min = &value + return b +} + +// WithList adds the given value to the List 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 List field. +func (b *FeasibleSpaceApplyConfiguration) WithList(values ...string) *FeasibleSpaceApplyConfiguration { + for i := range values { + b.List = append(b.List, values[i]) + } + return b +} + +// WithStep sets the Step 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 Step field is set to the value of the last call. +func (b *FeasibleSpaceApplyConfiguration) WithStep(value string) *FeasibleSpaceApplyConfiguration { + b.Step = &value + return b +} + +// WithDistribution sets the Distribution 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 Distribution field is set to the value of the last call. +func (b *FeasibleSpaceApplyConfiguration) WithDistribution(value experimentsv1beta1.Distribution) *FeasibleSpaceApplyConfiguration { + b.Distribution = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/graphconfig.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/graphconfig.go new file mode 100644 index 00000000000..94516a4781e --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/graphconfig.go @@ -0,0 +1,61 @@ +/* +Copyright 2022 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 v1beta1 + +// GraphConfigApplyConfiguration represents a declarative configuration of the GraphConfig type for use +// with apply. +type GraphConfigApplyConfiguration struct { + NumLayers *int32 `json:"numLayers,omitempty"` + InputSizes []int32 `json:"inputSizes,omitempty"` + OutputSizes []int32 `json:"outputSizes,omitempty"` +} + +// GraphConfigApplyConfiguration constructs a declarative configuration of the GraphConfig type for use with +// apply. +func GraphConfig() *GraphConfigApplyConfiguration { + return &GraphConfigApplyConfiguration{} +} + +// WithNumLayers sets the NumLayers 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 NumLayers field is set to the value of the last call. +func (b *GraphConfigApplyConfiguration) WithNumLayers(value int32) *GraphConfigApplyConfiguration { + b.NumLayers = &value + return b +} + +// WithInputSizes adds the given value to the InputSizes 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 InputSizes field. +func (b *GraphConfigApplyConfiguration) WithInputSizes(values ...int32) *GraphConfigApplyConfiguration { + for i := range values { + b.InputSizes = append(b.InputSizes, values[i]) + } + return b +} + +// WithOutputSizes adds the given value to the OutputSizes 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 OutputSizes field. +func (b *GraphConfigApplyConfiguration) WithOutputSizes(values ...int32) *GraphConfigApplyConfiguration { + for i := range values { + b.OutputSizes = append(b.OutputSizes, values[i]) + } + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/nasconfig.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/nasconfig.go new file mode 100644 index 00000000000..916d900cbb7 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/nasconfig.go @@ -0,0 +1,53 @@ +/* +Copyright 2022 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 v1beta1 + +// NasConfigApplyConfiguration represents a declarative configuration of the NasConfig type for use +// with apply. +type NasConfigApplyConfiguration struct { + GraphConfig *GraphConfigApplyConfiguration `json:"graphConfig,omitempty"` + Operations []OperationApplyConfiguration `json:"operations,omitempty"` +} + +// NasConfigApplyConfiguration constructs a declarative configuration of the NasConfig type for use with +// apply. +func NasConfig() *NasConfigApplyConfiguration { + return &NasConfigApplyConfiguration{} +} + +// WithGraphConfig sets the GraphConfig 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 GraphConfig field is set to the value of the last call. +func (b *NasConfigApplyConfiguration) WithGraphConfig(value *GraphConfigApplyConfiguration) *NasConfigApplyConfiguration { + b.GraphConfig = value + return b +} + +// WithOperations adds the given value to the Operations 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 Operations field. +func (b *NasConfigApplyConfiguration) WithOperations(values ...*OperationApplyConfiguration) *NasConfigApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOperations") + } + b.Operations = append(b.Operations, *values[i]) + } + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/operation.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/operation.go new file mode 100644 index 00000000000..6ace3534c3c --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/operation.go @@ -0,0 +1,53 @@ +/* +Copyright 2022 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 v1beta1 + +// OperationApplyConfiguration represents a declarative configuration of the Operation type for use +// with apply. +type OperationApplyConfiguration struct { + OperationType *string `json:"operationType,omitempty"` + Parameters []ParameterSpecApplyConfiguration `json:"parameters,omitempty"` +} + +// OperationApplyConfiguration constructs a declarative configuration of the Operation type for use with +// apply. +func Operation() *OperationApplyConfiguration { + return &OperationApplyConfiguration{} +} + +// WithOperationType sets the OperationType 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 OperationType field is set to the value of the last call. +func (b *OperationApplyConfiguration) WithOperationType(value string) *OperationApplyConfiguration { + b.OperationType = &value + return b +} + +// WithParameters adds the given value to the Parameters 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 Parameters field. +func (b *OperationApplyConfiguration) WithParameters(values ...*ParameterSpecApplyConfiguration) *OperationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithParameters") + } + b.Parameters = append(b.Parameters, *values[i]) + } + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/optimaltrial.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/optimaltrial.go new file mode 100644 index 00000000000..da7865b4154 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/optimaltrial.go @@ -0,0 +1,63 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" +) + +// OptimalTrialApplyConfiguration represents a declarative configuration of the OptimalTrial type for use +// with apply. +type OptimalTrialApplyConfiguration struct { + BestTrialName *string `json:"bestTrialName,omitempty"` + ParameterAssignments []commonv1beta1.ParameterAssignment `json:"parameterAssignments,omitempty"` + Observation *commonv1beta1.Observation `json:"observation,omitempty"` +} + +// OptimalTrialApplyConfiguration constructs a declarative configuration of the OptimalTrial type for use with +// apply. +func OptimalTrial() *OptimalTrialApplyConfiguration { + return &OptimalTrialApplyConfiguration{} +} + +// WithBestTrialName sets the BestTrialName 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 BestTrialName field is set to the value of the last call. +func (b *OptimalTrialApplyConfiguration) WithBestTrialName(value string) *OptimalTrialApplyConfiguration { + b.BestTrialName = &value + return b +} + +// WithParameterAssignments adds the given value to the ParameterAssignments 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 ParameterAssignments field. +func (b *OptimalTrialApplyConfiguration) WithParameterAssignments(values ...commonv1beta1.ParameterAssignment) *OptimalTrialApplyConfiguration { + for i := range values { + b.ParameterAssignments = append(b.ParameterAssignments, values[i]) + } + return b +} + +// WithObservation sets the Observation 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 Observation field is set to the value of the last call. +func (b *OptimalTrialApplyConfiguration) WithObservation(value commonv1beta1.Observation) *OptimalTrialApplyConfiguration { + b.Observation = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/parameterspec.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/parameterspec.go new file mode 100644 index 00000000000..29a8d4eec4b --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/parameterspec.go @@ -0,0 +1,61 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" +) + +// ParameterSpecApplyConfiguration represents a declarative configuration of the ParameterSpec type for use +// with apply. +type ParameterSpecApplyConfiguration struct { + Name *string `json:"name,omitempty"` + ParameterType *experimentsv1beta1.ParameterType `json:"parameterType,omitempty"` + FeasibleSpace *FeasibleSpaceApplyConfiguration `json:"feasibleSpace,omitempty"` +} + +// ParameterSpecApplyConfiguration constructs a declarative configuration of the ParameterSpec type for use with +// apply. +func ParameterSpec() *ParameterSpecApplyConfiguration { + return &ParameterSpecApplyConfiguration{} +} + +// 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 *ParameterSpecApplyConfiguration) WithName(value string) *ParameterSpecApplyConfiguration { + b.Name = &value + return b +} + +// WithParameterType sets the ParameterType 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 ParameterType field is set to the value of the last call. +func (b *ParameterSpecApplyConfiguration) WithParameterType(value experimentsv1beta1.ParameterType) *ParameterSpecApplyConfiguration { + b.ParameterType = &value + return b +} + +// WithFeasibleSpace sets the FeasibleSpace 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 FeasibleSpace field is set to the value of the last call. +func (b *ParameterSpecApplyConfiguration) WithFeasibleSpace(value *FeasibleSpaceApplyConfiguration) *ParameterSpecApplyConfiguration { + b.FeasibleSpace = value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialparameterspec.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialparameterspec.go new file mode 100644 index 00000000000..5e15f38d537 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialparameterspec.go @@ -0,0 +1,57 @@ +/* +Copyright 2022 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 v1beta1 + +// TrialParameterSpecApplyConfiguration represents a declarative configuration of the TrialParameterSpec type for use +// with apply. +type TrialParameterSpecApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Reference *string `json:"reference,omitempty"` +} + +// TrialParameterSpecApplyConfiguration constructs a declarative configuration of the TrialParameterSpec type for use with +// apply. +func TrialParameterSpec() *TrialParameterSpecApplyConfiguration { + return &TrialParameterSpecApplyConfiguration{} +} + +// 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 *TrialParameterSpecApplyConfiguration) WithName(value string) *TrialParameterSpecApplyConfiguration { + b.Name = &value + return b +} + +// WithDescription sets the Description 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 Description field is set to the value of the last call. +func (b *TrialParameterSpecApplyConfiguration) WithDescription(value string) *TrialParameterSpecApplyConfiguration { + b.Description = &value + return b +} + +// WithReference sets the Reference 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 Reference field is set to the value of the last call. +func (b *TrialParameterSpecApplyConfiguration) WithReference(value string) *TrialParameterSpecApplyConfiguration { + b.Reference = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialsource.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialsource.go new file mode 100644 index 00000000000..697ecad7cbb --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialsource.go @@ -0,0 +1,52 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" +) + +// TrialSourceApplyConfiguration represents a declarative configuration of the TrialSource type for use +// with apply. +type TrialSourceApplyConfiguration struct { + TrialSpec *unstructured.Unstructured `json:"trialSpec,omitempty"` + ConfigMap *ConfigMapSourceApplyConfiguration `json:"configMap,omitempty"` +} + +// TrialSourceApplyConfiguration constructs a declarative configuration of the TrialSource type for use with +// apply. +func TrialSource() *TrialSourceApplyConfiguration { + return &TrialSourceApplyConfiguration{} +} + +// WithTrialSpec sets the TrialSpec 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 TrialSpec field is set to the value of the last call. +func (b *TrialSourceApplyConfiguration) WithTrialSpec(value unstructured.Unstructured) *TrialSourceApplyConfiguration { + b.TrialSpec = &value + return b +} + +// WithConfigMap sets the ConfigMap 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 ConfigMap field is set to the value of the last call. +func (b *TrialSourceApplyConfiguration) WithConfigMap(value *ConfigMapSourceApplyConfiguration) *TrialSourceApplyConfiguration { + b.ConfigMap = value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialtemplate.go b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialtemplate.go new file mode 100644 index 00000000000..21e8a1e4312 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/experiments/v1beta1/trialtemplate.go @@ -0,0 +1,116 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" +) + +// TrialTemplateApplyConfiguration represents a declarative configuration of the TrialTemplate type for use +// with apply. +type TrialTemplateApplyConfiguration struct { + Retain *bool `json:"retain,omitempty"` + TrialSourceApplyConfiguration `json:",inline"` + TrialParameters []TrialParameterSpecApplyConfiguration `json:"trialParameters,omitempty"` + PrimaryPodLabels map[string]string `json:"primaryPodLabels,omitempty"` + PrimaryContainerName *string `json:"primaryContainerName,omitempty"` + SuccessCondition *string `json:"successCondition,omitempty"` + FailureCondition *string `json:"failureCondition,omitempty"` +} + +// TrialTemplateApplyConfiguration constructs a declarative configuration of the TrialTemplate type for use with +// apply. +func TrialTemplate() *TrialTemplateApplyConfiguration { + return &TrialTemplateApplyConfiguration{} +} + +// WithRetain sets the Retain 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 Retain field is set to the value of the last call. +func (b *TrialTemplateApplyConfiguration) WithRetain(value bool) *TrialTemplateApplyConfiguration { + b.Retain = &value + return b +} + +// WithTrialSpec sets the TrialSpec 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 TrialSpec field is set to the value of the last call. +func (b *TrialTemplateApplyConfiguration) WithTrialSpec(value unstructured.Unstructured) *TrialTemplateApplyConfiguration { + b.TrialSourceApplyConfiguration.TrialSpec = &value + return b +} + +// WithConfigMap sets the ConfigMap 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 ConfigMap field is set to the value of the last call. +func (b *TrialTemplateApplyConfiguration) WithConfigMap(value *ConfigMapSourceApplyConfiguration) *TrialTemplateApplyConfiguration { + b.TrialSourceApplyConfiguration.ConfigMap = value + return b +} + +// WithTrialParameters adds the given value to the TrialParameters 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 TrialParameters field. +func (b *TrialTemplateApplyConfiguration) WithTrialParameters(values ...*TrialParameterSpecApplyConfiguration) *TrialTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTrialParameters") + } + b.TrialParameters = append(b.TrialParameters, *values[i]) + } + return b +} + +// WithPrimaryPodLabels puts the entries into the PrimaryPodLabels 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 PrimaryPodLabels field, +// overwriting an existing map entries in PrimaryPodLabels field with the same key. +func (b *TrialTemplateApplyConfiguration) WithPrimaryPodLabels(entries map[string]string) *TrialTemplateApplyConfiguration { + if b.PrimaryPodLabels == nil && len(entries) > 0 { + b.PrimaryPodLabels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.PrimaryPodLabels[k] = v + } + return b +} + +// WithPrimaryContainerName sets the PrimaryContainerName 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 PrimaryContainerName field is set to the value of the last call. +func (b *TrialTemplateApplyConfiguration) WithPrimaryContainerName(value string) *TrialTemplateApplyConfiguration { + b.PrimaryContainerName = &value + return b +} + +// WithSuccessCondition sets the SuccessCondition 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 SuccessCondition field is set to the value of the last call. +func (b *TrialTemplateApplyConfiguration) WithSuccessCondition(value string) *TrialTemplateApplyConfiguration { + b.SuccessCondition = &value + return b +} + +// WithFailureCondition sets the FailureCondition 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 FailureCondition field is set to the value of the last call. +func (b *TrialTemplateApplyConfiguration) WithFailureCondition(value string) *TrialTemplateApplyConfiguration { + b.FailureCondition = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/internal/internal.go b/pkg/client/optimizer/applyconfiguration/internal/internal.go new file mode 100644 index 00000000000..410d7fa9e01 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/internal/internal.go @@ -0,0 +1,62 @@ +/* +Copyright 2022 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 "fmt" + sync "sync" + + typed "sigs.k8s.io/structured-merge-diff/v6/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/optimizer/applyconfiguration/optimizer/v1alpha1/algorithm.go b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/algorithm.go new file mode 100644 index 00000000000..0b3c49e1c5a --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/algorithm.go @@ -0,0 +1,53 @@ +/* +Copyright 2022 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 v1alpha1 + +// AlgorithmApplyConfiguration represents a declarative configuration of the Algorithm type for use +// with apply. +type AlgorithmApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Settings []SettingKVApplyConfiguration `json:"settings,omitempty"` +} + +// AlgorithmApplyConfiguration constructs a declarative configuration of the Algorithm type for use with +// apply. +func Algorithm() *AlgorithmApplyConfiguration { + return &AlgorithmApplyConfiguration{} +} + +// 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 *AlgorithmApplyConfiguration) WithName(value string) *AlgorithmApplyConfiguration { + b.Name = &value + return b +} + +// WithSettings adds the given value to the Settings 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 Settings field. +func (b *AlgorithmApplyConfiguration) WithSettings(values ...*SettingKVApplyConfiguration) *AlgorithmApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSettings") + } + b.Settings = append(b.Settings, *values[i]) + } + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/objective.go b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/objective.go new file mode 100644 index 00000000000..f8854ce1064 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/objective.go @@ -0,0 +1,57 @@ +/* +Copyright 2022 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 v1alpha1 + +// ObjectiveApplyConfiguration represents a declarative configuration of the Objective type for use +// with apply. +type ObjectiveApplyConfiguration struct { + Metric *string `json:"metric,omitempty"` + Direction *string `json:"direction,omitempty"` + Goal *float64 `json:"goal,omitempty"` +} + +// ObjectiveApplyConfiguration constructs a declarative configuration of the Objective type for use with +// apply. +func Objective() *ObjectiveApplyConfiguration { + return &ObjectiveApplyConfiguration{} +} + +// WithMetric sets the Metric 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 Metric field is set to the value of the last call. +func (b *ObjectiveApplyConfiguration) WithMetric(value string) *ObjectiveApplyConfiguration { + b.Metric = &value + return b +} + +// WithDirection sets the Direction 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 Direction field is set to the value of the last call. +func (b *ObjectiveApplyConfiguration) WithDirection(value string) *ObjectiveApplyConfiguration { + b.Direction = &value + return b +} + +// WithGoal sets the Goal 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 Goal field is set to the value of the last call. +func (b *ObjectiveApplyConfiguration) WithGoal(value float64) *ObjectiveApplyConfiguration { + b.Goal = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/optimizationjob.go b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/optimizationjob.go new file mode 100644 index 00000000000..71598485c3d --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/optimizationjob.go @@ -0,0 +1,243 @@ +/* +Copyright 2022 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 v1alpha1 + +import ( + optimizerv1alpha1 "github.com/kubeflow/katib/pkg/apis/optimizer/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// OptimizationJobApplyConfiguration represents a declarative configuration of the OptimizationJob type for use +// with apply. +type OptimizationJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *OptimizationJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *optimizerv1alpha1.OptimizationJobStatus `json:"status,omitempty"` +} + +// OptimizationJob constructs a declarative configuration of the OptimizationJob type for use with +// apply. +func OptimizationJob(name, namespace string) *OptimizationJobApplyConfiguration { + b := &OptimizationJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("OptimizationJob") + b.WithAPIVersion("optimizer.kubeflow.org/v1alpha1") + return b +} +func (b OptimizationJobApplyConfiguration) IsApplyConfiguration() {} + +// 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 *OptimizationJobApplyConfiguration) WithKind(value string) *OptimizationJobApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithAPIVersion(value string) *OptimizationJobApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithName(value string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithGenerateName(value string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithNamespace(value string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithUID(value types.UID) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithResourceVersion(value string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithGeneration(value int64) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithLabels(entries map[string]string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithAnnotations(entries map[string]string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.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 *OptimizationJobApplyConfiguration) WithFinalizers(values ...string) *OptimizationJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *OptimizationJobApplyConfiguration) 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 *OptimizationJobApplyConfiguration) WithSpec(value *OptimizationJobSpecApplyConfiguration) *OptimizationJobApplyConfiguration { + 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 *OptimizationJobApplyConfiguration) WithStatus(value optimizerv1alpha1.OptimizationJobStatus) *OptimizationJobApplyConfiguration { + b.Status = &value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *OptimizationJobApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *OptimizationJobApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *OptimizationJobApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *OptimizationJobApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/optimizationjobspec.go b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/optimizationjobspec.go new file mode 100644 index 00000000000..fd5225b2374 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/optimizationjobspec.go @@ -0,0 +1,86 @@ +/* +Copyright 2022 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 v1alpha1 + +// OptimizationJobSpecApplyConfiguration represents a declarative configuration of the OptimizationJobSpec type for use +// with apply. +type OptimizationJobSpecApplyConfiguration struct { + Objectives []ObjectiveApplyConfiguration `json:"objectives,omitempty"` + Algorithm *AlgorithmApplyConfiguration `json:"algorithm,omitempty"` + SearchSpace map[string]string `json:"searchSpace,omitempty"` + TrialConfig *TrialConfigApplyConfiguration `json:"trialConfig,omitempty"` + TrialTemplate *unnameable_Unsupported `json:"trialTemplate,omitempty"` +} + +// OptimizationJobSpecApplyConfiguration constructs a declarative configuration of the OptimizationJobSpec type for use with +// apply. +func OptimizationJobSpec() *OptimizationJobSpecApplyConfiguration { + return &OptimizationJobSpecApplyConfiguration{} +} + +// WithObjectives adds the given value to the Objectives 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 Objectives field. +func (b *OptimizationJobSpecApplyConfiguration) WithObjectives(values ...*ObjectiveApplyConfiguration) *OptimizationJobSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithObjectives") + } + b.Objectives = append(b.Objectives, *values[i]) + } + return b +} + +// WithAlgorithm sets the Algorithm 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 Algorithm field is set to the value of the last call. +func (b *OptimizationJobSpecApplyConfiguration) WithAlgorithm(value *AlgorithmApplyConfiguration) *OptimizationJobSpecApplyConfiguration { + b.Algorithm = value + return b +} + +// WithSearchSpace puts the entries into the SearchSpace 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 SearchSpace field, +// overwriting an existing map entries in SearchSpace field with the same key. +func (b *OptimizationJobSpecApplyConfiguration) WithSearchSpace(entries map[string]string) *OptimizationJobSpecApplyConfiguration { + if b.SearchSpace == nil && len(entries) > 0 { + b.SearchSpace = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.SearchSpace[k] = v + } + return b +} + +// WithTrialConfig sets the TrialConfig 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 TrialConfig field is set to the value of the last call. +func (b *OptimizationJobSpecApplyConfiguration) WithTrialConfig(value *TrialConfigApplyConfiguration) *OptimizationJobSpecApplyConfiguration { + b.TrialConfig = value + return b +} + +// WithTrialTemplate sets the TrialTemplate 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 TrialTemplate field is set to the value of the last call. +func (b *OptimizationJobSpecApplyConfiguration) WithTrialTemplate(value unnameable_Unsupported) *OptimizationJobSpecApplyConfiguration { + b.TrialTemplate = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/settingkv.go b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/settingkv.go new file mode 100644 index 00000000000..32c7310963a --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/settingkv.go @@ -0,0 +1,48 @@ +/* +Copyright 2022 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 v1alpha1 + +// SettingKVApplyConfiguration represents a declarative configuration of the SettingKV type for use +// with apply. +type SettingKVApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// SettingKVApplyConfiguration constructs a declarative configuration of the SettingKV type for use with +// apply. +func SettingKV() *SettingKVApplyConfiguration { + return &SettingKVApplyConfiguration{} +} + +// 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 *SettingKVApplyConfiguration) WithName(value string) *SettingKVApplyConfiguration { + b.Name = &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 *SettingKVApplyConfiguration) WithValue(value string) *SettingKVApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/trialconfig.go b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/trialconfig.go new file mode 100644 index 00000000000..4ef7b6a81a5 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1/trialconfig.go @@ -0,0 +1,57 @@ +/* +Copyright 2022 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 v1alpha1 + +// TrialConfigApplyConfiguration represents a declarative configuration of the TrialConfig type for use +// with apply. +type TrialConfigApplyConfiguration struct { + NumTrials *int32 `json:"num_trials,omitempty"` + ParallelTrials *int32 `json:"parallel_trials,omitempty"` + MaxFailedTrials *int32 `json:"max_failed_trials,omitempty"` +} + +// TrialConfigApplyConfiguration constructs a declarative configuration of the TrialConfig type for use with +// apply. +func TrialConfig() *TrialConfigApplyConfiguration { + return &TrialConfigApplyConfiguration{} +} + +// WithNumTrials sets the NumTrials 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 NumTrials field is set to the value of the last call. +func (b *TrialConfigApplyConfiguration) WithNumTrials(value int32) *TrialConfigApplyConfiguration { + b.NumTrials = &value + return b +} + +// WithParallelTrials sets the ParallelTrials 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 ParallelTrials field is set to the value of the last call. +func (b *TrialConfigApplyConfiguration) WithParallelTrials(value int32) *TrialConfigApplyConfiguration { + b.ParallelTrials = &value + return b +} + +// WithMaxFailedTrials sets the MaxFailedTrials 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 MaxFailedTrials field is set to the value of the last call. +func (b *TrialConfigApplyConfiguration) WithMaxFailedTrials(value int32) *TrialConfigApplyConfiguration { + b.MaxFailedTrials = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestion.go b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestion.go new file mode 100644 index 00000000000..7a654d45dea --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestion.go @@ -0,0 +1,242 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// SuggestionApplyConfiguration represents a declarative configuration of the Suggestion type for use +// with apply. +type SuggestionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *SuggestionSpecApplyConfiguration `json:"spec,omitempty"` + Status *SuggestionStatusApplyConfiguration `json:"status,omitempty"` +} + +// Suggestion constructs a declarative configuration of the Suggestion type for use with +// apply. +func Suggestion(name, namespace string) *SuggestionApplyConfiguration { + b := &SuggestionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Suggestion") + b.WithAPIVersion("suggestion.kubeflow.org/v1beta1") + return b +} +func (b SuggestionApplyConfiguration) IsApplyConfiguration() {} + +// 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 *SuggestionApplyConfiguration) WithKind(value string) *SuggestionApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithAPIVersion(value string) *SuggestionApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithName(value string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithGenerateName(value string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithNamespace(value string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithUID(value types.UID) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithResourceVersion(value string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithGeneration(value int64) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithLabels(entries map[string]string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithAnnotations(entries map[string]string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.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 *SuggestionApplyConfiguration) WithFinalizers(values ...string) *SuggestionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *SuggestionApplyConfiguration) 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 *SuggestionApplyConfiguration) WithSpec(value *SuggestionSpecApplyConfiguration) *SuggestionApplyConfiguration { + 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 *SuggestionApplyConfiguration) WithStatus(value *SuggestionStatusApplyConfiguration) *SuggestionApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *SuggestionApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *SuggestionApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *SuggestionApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *SuggestionApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestioncondition.go b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestioncondition.go new file mode 100644 index 00000000000..ae048cd7880 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestioncondition.go @@ -0,0 +1,90 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + suggestionsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SuggestionConditionApplyConfiguration represents a declarative configuration of the SuggestionCondition type for use +// with apply. +type SuggestionConditionApplyConfiguration struct { + Type *suggestionsv1beta1.SuggestionConditionType `json:"type,omitempty"` + Status *v1.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"` +} + +// SuggestionConditionApplyConfiguration constructs a declarative configuration of the SuggestionCondition type for use with +// apply. +func SuggestionCondition() *SuggestionConditionApplyConfiguration { + return &SuggestionConditionApplyConfiguration{} +} + +// 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 *SuggestionConditionApplyConfiguration) WithType(value suggestionsv1beta1.SuggestionConditionType) *SuggestionConditionApplyConfiguration { + 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 *SuggestionConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *SuggestionConditionApplyConfiguration { + 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 *SuggestionConditionApplyConfiguration) WithReason(value string) *SuggestionConditionApplyConfiguration { + 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 *SuggestionConditionApplyConfiguration) WithMessage(value string) *SuggestionConditionApplyConfiguration { + 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 *SuggestionConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *SuggestionConditionApplyConfiguration { + 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 *SuggestionConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *SuggestionConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestionspec.go b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestionspec.go new file mode 100644 index 00000000000..347f6963717 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestionspec.go @@ -0,0 +1,71 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" + experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" +) + +// SuggestionSpecApplyConfiguration represents a declarative configuration of the SuggestionSpec type for use +// with apply. +type SuggestionSpecApplyConfiguration struct { + Algorithm *commonv1beta1.AlgorithmSpec `json:"algorithm,omitempty"` + EarlyStopping *commonv1beta1.EarlyStoppingSpec `json:"earlyStopping,omitempty"` + Requests *int32 `json:"requests,omitempty"` + ResumePolicy *experimentsv1beta1.ResumePolicyType `json:"resumePolicy,omitempty"` +} + +// SuggestionSpecApplyConfiguration constructs a declarative configuration of the SuggestionSpec type for use with +// apply. +func SuggestionSpec() *SuggestionSpecApplyConfiguration { + return &SuggestionSpecApplyConfiguration{} +} + +// WithAlgorithm sets the Algorithm 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 Algorithm field is set to the value of the last call. +func (b *SuggestionSpecApplyConfiguration) WithAlgorithm(value commonv1beta1.AlgorithmSpec) *SuggestionSpecApplyConfiguration { + b.Algorithm = &value + return b +} + +// WithEarlyStopping sets the EarlyStopping 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 EarlyStopping field is set to the value of the last call. +func (b *SuggestionSpecApplyConfiguration) WithEarlyStopping(value commonv1beta1.EarlyStoppingSpec) *SuggestionSpecApplyConfiguration { + b.EarlyStopping = &value + return b +} + +// WithRequests sets the Requests 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 Requests field is set to the value of the last call. +func (b *SuggestionSpecApplyConfiguration) WithRequests(value int32) *SuggestionSpecApplyConfiguration { + b.Requests = &value + return b +} + +// WithResumePolicy sets the ResumePolicy 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 ResumePolicy field is set to the value of the last call. +func (b *SuggestionSpecApplyConfiguration) WithResumePolicy(value experimentsv1beta1.ResumePolicyType) *SuggestionSpecApplyConfiguration { + b.ResumePolicy = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestionstatus.go b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestionstatus.go new file mode 100644 index 00000000000..968c5c60172 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/suggestionstatus.go @@ -0,0 +1,110 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SuggestionStatusApplyConfiguration represents a declarative configuration of the SuggestionStatus type for use +// with apply. +type SuggestionStatusApplyConfiguration struct { + AlgorithmSettings []commonv1beta1.AlgorithmSetting `json:"algorithmSettings,omitempty"` + SuggestionCount *int32 `json:"suggestionCount,omitempty"` + Suggestions []TrialAssignmentApplyConfiguration `json:"suggestions,omitempty"` + StartTime *v1.Time `json:"startTime,omitempty"` + CompletionTime *v1.Time `json:"completionTime,omitempty"` + LastReconcileTime *v1.Time `json:"lastReconcileTime,omitempty"` + Conditions []SuggestionConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// SuggestionStatusApplyConfiguration constructs a declarative configuration of the SuggestionStatus type for use with +// apply. +func SuggestionStatus() *SuggestionStatusApplyConfiguration { + return &SuggestionStatusApplyConfiguration{} +} + +// WithAlgorithmSettings adds the given value to the AlgorithmSettings 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 AlgorithmSettings field. +func (b *SuggestionStatusApplyConfiguration) WithAlgorithmSettings(values ...commonv1beta1.AlgorithmSetting) *SuggestionStatusApplyConfiguration { + for i := range values { + b.AlgorithmSettings = append(b.AlgorithmSettings, values[i]) + } + return b +} + +// WithSuggestionCount sets the SuggestionCount 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 SuggestionCount field is set to the value of the last call. +func (b *SuggestionStatusApplyConfiguration) WithSuggestionCount(value int32) *SuggestionStatusApplyConfiguration { + b.SuggestionCount = &value + return b +} + +// WithSuggestions adds the given value to the Suggestions 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 Suggestions field. +func (b *SuggestionStatusApplyConfiguration) WithSuggestions(values ...*TrialAssignmentApplyConfiguration) *SuggestionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSuggestions") + } + b.Suggestions = append(b.Suggestions, *values[i]) + } + 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 *SuggestionStatusApplyConfiguration) WithStartTime(value v1.Time) *SuggestionStatusApplyConfiguration { + 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 *SuggestionStatusApplyConfiguration) WithCompletionTime(value v1.Time) *SuggestionStatusApplyConfiguration { + 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 *SuggestionStatusApplyConfiguration) WithLastReconcileTime(value v1.Time) *SuggestionStatusApplyConfiguration { + b.LastReconcileTime = &value + return b +} + +// 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 *SuggestionStatusApplyConfiguration) WithConditions(values ...*SuggestionConditionApplyConfiguration) *SuggestionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/trialassignment.go b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/trialassignment.go new file mode 100644 index 00000000000..770cbe389cb --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1/trialassignment.go @@ -0,0 +1,80 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" +) + +// TrialAssignmentApplyConfiguration represents a declarative configuration of the TrialAssignment type for use +// with apply. +type TrialAssignmentApplyConfiguration struct { + ParameterAssignments []commonv1beta1.ParameterAssignment `json:"parameterAssignments,omitempty"` + Name *string `json:"name,omitempty"` + EarlyStoppingRules []commonv1beta1.EarlyStoppingRule `json:"earlyStoppingRules,omitempty"` + Labels map[string]string `json:"labels,omitempty"` +} + +// TrialAssignmentApplyConfiguration constructs a declarative configuration of the TrialAssignment type for use with +// apply. +func TrialAssignment() *TrialAssignmentApplyConfiguration { + return &TrialAssignmentApplyConfiguration{} +} + +// WithParameterAssignments adds the given value to the ParameterAssignments 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 ParameterAssignments field. +func (b *TrialAssignmentApplyConfiguration) WithParameterAssignments(values ...commonv1beta1.ParameterAssignment) *TrialAssignmentApplyConfiguration { + for i := range values { + b.ParameterAssignments = append(b.ParameterAssignments, values[i]) + } + 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 *TrialAssignmentApplyConfiguration) WithName(value string) *TrialAssignmentApplyConfiguration { + b.Name = &value + return b +} + +// WithEarlyStoppingRules adds the given value to the EarlyStoppingRules 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 EarlyStoppingRules field. +func (b *TrialAssignmentApplyConfiguration) WithEarlyStoppingRules(values ...commonv1beta1.EarlyStoppingRule) *TrialAssignmentApplyConfiguration { + for i := range values { + b.EarlyStoppingRules = append(b.EarlyStoppingRules, values[i]) + } + 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 *TrialAssignmentApplyConfiguration) WithLabels(entries map[string]string) *TrialAssignmentApplyConfiguration { + 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 +} diff --git a/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trial.go b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trial.go new file mode 100644 index 00000000000..8fcdbac3f13 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trial.go @@ -0,0 +1,242 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TrialApplyConfiguration represents a declarative configuration of the Trial type for use +// with apply. +type TrialApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TrialSpecApplyConfiguration `json:"spec,omitempty"` + Status *TrialStatusApplyConfiguration `json:"status,omitempty"` +} + +// Trial constructs a declarative configuration of the Trial type for use with +// apply. +func Trial(name, namespace string) *TrialApplyConfiguration { + b := &TrialApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Trial") + b.WithAPIVersion("trial.kubeflow.org/v1beta1") + return b +} +func (b TrialApplyConfiguration) IsApplyConfiguration() {} + +// 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 *TrialApplyConfiguration) WithKind(value string) *TrialApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *TrialApplyConfiguration) WithAPIVersion(value string) *TrialApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *TrialApplyConfiguration) WithName(value string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithGenerateName(value string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithNamespace(value string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithUID(value types.UID) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithResourceVersion(value string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithGeneration(value int64) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithLabels(entries map[string]string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithAnnotations(entries map[string]string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.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 *TrialApplyConfiguration) WithFinalizers(values ...string) *TrialApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *TrialApplyConfiguration) 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 *TrialApplyConfiguration) WithSpec(value *TrialSpecApplyConfiguration) *TrialApplyConfiguration { + 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 *TrialApplyConfiguration) WithStatus(value *TrialStatusApplyConfiguration) *TrialApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *TrialApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *TrialApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TrialApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *TrialApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialcondition.go b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialcondition.go new file mode 100644 index 00000000000..8a2783a4f4a --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialcondition.go @@ -0,0 +1,90 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + trialsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TrialConditionApplyConfiguration represents a declarative configuration of the TrialCondition type for use +// with apply. +type TrialConditionApplyConfiguration struct { + Type *trialsv1beta1.TrialConditionType `json:"type,omitempty"` + Status *v1.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"` +} + +// TrialConditionApplyConfiguration constructs a declarative configuration of the TrialCondition type for use with +// apply. +func TrialCondition() *TrialConditionApplyConfiguration { + return &TrialConditionApplyConfiguration{} +} + +// 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 *TrialConditionApplyConfiguration) WithType(value trialsv1beta1.TrialConditionType) *TrialConditionApplyConfiguration { + 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 *TrialConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *TrialConditionApplyConfiguration { + 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 *TrialConditionApplyConfiguration) WithReason(value string) *TrialConditionApplyConfiguration { + 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 *TrialConditionApplyConfiguration) WithMessage(value string) *TrialConditionApplyConfiguration { + 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 *TrialConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *TrialConditionApplyConfiguration { + 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 *TrialConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *TrialConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialspec.go b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialspec.go new file mode 100644 index 00000000000..d48055a36cf --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialspec.go @@ -0,0 +1,150 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" +) + +// TrialSpecApplyConfiguration represents a declarative configuration of the TrialSpec type for use +// with apply. +type TrialSpecApplyConfiguration struct { + Objective *commonv1beta1.ObjectiveSpec `json:"objective,omitempty"` + ParameterAssignments []commonv1beta1.ParameterAssignment `json:"parameterAssignments,omitempty"` + EarlyStoppingRules []commonv1beta1.EarlyStoppingRule `json:"earlyStoppingRules,omitempty"` + RunSpec *unstructured.Unstructured `json:"runSpec,omitempty"` + RetainRun *bool `json:"retainRun,omitempty"` + MetricsCollector *commonv1beta1.MetricsCollectorSpec `json:"metricsCollector,omitempty"` + PrimaryPodLabels map[string]string `json:"primaryPodLabels,omitempty"` + PrimaryContainerName *string `json:"primaryContainerName,omitempty"` + SuccessCondition *string `json:"successCondition,omitempty"` + FailureCondition *string `json:"failureCondition,omitempty"` + Labels map[string]string `json:"labels,omitempty"` +} + +// TrialSpecApplyConfiguration constructs a declarative configuration of the TrialSpec type for use with +// apply. +func TrialSpec() *TrialSpecApplyConfiguration { + return &TrialSpecApplyConfiguration{} +} + +// WithObjective sets the Objective 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 Objective field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithObjective(value commonv1beta1.ObjectiveSpec) *TrialSpecApplyConfiguration { + b.Objective = &value + return b +} + +// WithParameterAssignments adds the given value to the ParameterAssignments 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 ParameterAssignments field. +func (b *TrialSpecApplyConfiguration) WithParameterAssignments(values ...commonv1beta1.ParameterAssignment) *TrialSpecApplyConfiguration { + for i := range values { + b.ParameterAssignments = append(b.ParameterAssignments, values[i]) + } + return b +} + +// WithEarlyStoppingRules adds the given value to the EarlyStoppingRules 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 EarlyStoppingRules field. +func (b *TrialSpecApplyConfiguration) WithEarlyStoppingRules(values ...commonv1beta1.EarlyStoppingRule) *TrialSpecApplyConfiguration { + for i := range values { + b.EarlyStoppingRules = append(b.EarlyStoppingRules, values[i]) + } + return b +} + +// WithRunSpec sets the RunSpec 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 RunSpec field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithRunSpec(value unstructured.Unstructured) *TrialSpecApplyConfiguration { + b.RunSpec = &value + return b +} + +// WithRetainRun sets the RetainRun 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 RetainRun field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithRetainRun(value bool) *TrialSpecApplyConfiguration { + b.RetainRun = &value + return b +} + +// WithMetricsCollector sets the MetricsCollector 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 MetricsCollector field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithMetricsCollector(value commonv1beta1.MetricsCollectorSpec) *TrialSpecApplyConfiguration { + b.MetricsCollector = &value + return b +} + +// WithPrimaryPodLabels puts the entries into the PrimaryPodLabels 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 PrimaryPodLabels field, +// overwriting an existing map entries in PrimaryPodLabels field with the same key. +func (b *TrialSpecApplyConfiguration) WithPrimaryPodLabels(entries map[string]string) *TrialSpecApplyConfiguration { + if b.PrimaryPodLabels == nil && len(entries) > 0 { + b.PrimaryPodLabels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.PrimaryPodLabels[k] = v + } + return b +} + +// WithPrimaryContainerName sets the PrimaryContainerName 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 PrimaryContainerName field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithPrimaryContainerName(value string) *TrialSpecApplyConfiguration { + b.PrimaryContainerName = &value + return b +} + +// WithSuccessCondition sets the SuccessCondition 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 SuccessCondition field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithSuccessCondition(value string) *TrialSpecApplyConfiguration { + b.SuccessCondition = &value + return b +} + +// WithFailureCondition sets the FailureCondition 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 FailureCondition field is set to the value of the last call. +func (b *TrialSpecApplyConfiguration) WithFailureCondition(value string) *TrialSpecApplyConfiguration { + b.FailureCondition = &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 *TrialSpecApplyConfiguration) WithLabels(entries map[string]string) *TrialSpecApplyConfiguration { + 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 +} diff --git a/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialstatus.go b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialstatus.go new file mode 100644 index 00000000000..2b41806cc2b --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/trials/v1beta1/trialstatus.go @@ -0,0 +1,85 @@ +/* +Copyright 2022 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 v1beta1 + +import ( + commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TrialStatusApplyConfiguration represents a declarative configuration of the TrialStatus type for use +// with apply. +type TrialStatusApplyConfiguration struct { + StartTime *v1.Time `json:"startTime,omitempty"` + CompletionTime *v1.Time `json:"completionTime,omitempty"` + LastReconcileTime *v1.Time `json:"lastReconcileTime,omitempty"` + Conditions []TrialConditionApplyConfiguration `json:"conditions,omitempty"` + Observation *commonv1beta1.Observation `json:"observation,omitempty"` +} + +// TrialStatusApplyConfiguration constructs a declarative configuration of the TrialStatus type for use with +// apply. +func TrialStatus() *TrialStatusApplyConfiguration { + return &TrialStatusApplyConfiguration{} +} + +// 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 *TrialStatusApplyConfiguration) WithStartTime(value v1.Time) *TrialStatusApplyConfiguration { + 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 *TrialStatusApplyConfiguration) WithCompletionTime(value v1.Time) *TrialStatusApplyConfiguration { + 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 *TrialStatusApplyConfiguration) WithLastReconcileTime(value v1.Time) *TrialStatusApplyConfiguration { + b.LastReconcileTime = &value + return b +} + +// 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 *TrialStatusApplyConfiguration) WithConditions(values ...*TrialConditionApplyConfiguration) *TrialStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithObservation sets the Observation 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 Observation field is set to the value of the last call. +func (b *TrialStatusApplyConfiguration) WithObservation(value commonv1beta1.Observation) *TrialStatusApplyConfiguration { + b.Observation = &value + return b +} diff --git a/pkg/client/optimizer/applyconfiguration/utils.go b/pkg/client/optimizer/applyconfiguration/utils.go new file mode 100644 index 00000000000..de80779b660 --- /dev/null +++ b/pkg/client/optimizer/applyconfiguration/utils.go @@ -0,0 +1,112 @@ +/* +Copyright 2022 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 ( + v1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" + suggestionsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1" + trialsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1" + v1alpha1 "github.com/kubeflow/katib/pkg/apis/optimizer/v1alpha1" + experimentsv1beta1 "github.com/kubeflow/katib/pkg/client/optimizer/applyconfiguration/experiments/v1beta1" + internal "github.com/kubeflow/katib/pkg/client/optimizer/applyconfiguration/internal" + optimizerv1alpha1 "github.com/kubeflow/katib/pkg/client/optimizer/applyconfiguration/optimizer/v1alpha1" + applyconfigurationsuggestionsv1beta1 "github.com/kubeflow/katib/pkg/client/optimizer/applyconfiguration/suggestions/v1beta1" + applyconfigurationtrialsv1beta1 "github.com/kubeflow/katib/pkg/client/optimizer/applyconfiguration/trials/v1beta1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// 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=experiment.kubeflow.org, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithKind("ConfigMapSource"): + return &experimentsv1beta1.ConfigMapSourceApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("Experiment"): + return &experimentsv1beta1.ExperimentApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ExperimentCondition"): + return &experimentsv1beta1.ExperimentConditionApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ExperimentSpec"): + return &experimentsv1beta1.ExperimentSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ExperimentStatus"): + return &experimentsv1beta1.ExperimentStatusApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("FeasibleSpace"): + return &experimentsv1beta1.FeasibleSpaceApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("GraphConfig"): + return &experimentsv1beta1.GraphConfigApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("NasConfig"): + return &experimentsv1beta1.NasConfigApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("Operation"): + return &experimentsv1beta1.OperationApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("OptimalTrial"): + return &experimentsv1beta1.OptimalTrialApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ParameterSpec"): + return &experimentsv1beta1.ParameterSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("TrialParameterSpec"): + return &experimentsv1beta1.TrialParameterSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("TrialSource"): + return &experimentsv1beta1.TrialSourceApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("TrialTemplate"): + return &experimentsv1beta1.TrialTemplateApplyConfiguration{} + + // Group=optimizer.kubeflow.org, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("Algorithm"): + return &optimizerv1alpha1.AlgorithmApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Objective"): + return &optimizerv1alpha1.ObjectiveApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("OptimizationJob"): + return &optimizerv1alpha1.OptimizationJobApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("OptimizationJobSpec"): + return &optimizerv1alpha1.OptimizationJobSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("SettingKV"): + return &optimizerv1alpha1.SettingKVApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TrialConfig"): + return &optimizerv1alpha1.TrialConfigApplyConfiguration{} + + // Group=suggestion.kubeflow.org, Version=v1beta1 + case suggestionsv1beta1.SchemeGroupVersion.WithKind("Suggestion"): + return &applyconfigurationsuggestionsv1beta1.SuggestionApplyConfiguration{} + case suggestionsv1beta1.SchemeGroupVersion.WithKind("SuggestionCondition"): + return &applyconfigurationsuggestionsv1beta1.SuggestionConditionApplyConfiguration{} + case suggestionsv1beta1.SchemeGroupVersion.WithKind("SuggestionSpec"): + return &applyconfigurationsuggestionsv1beta1.SuggestionSpecApplyConfiguration{} + case suggestionsv1beta1.SchemeGroupVersion.WithKind("SuggestionStatus"): + return &applyconfigurationsuggestionsv1beta1.SuggestionStatusApplyConfiguration{} + case suggestionsv1beta1.SchemeGroupVersion.WithKind("TrialAssignment"): + return &applyconfigurationsuggestionsv1beta1.TrialAssignmentApplyConfiguration{} + + // Group=trial.kubeflow.org, Version=v1beta1 + case trialsv1beta1.SchemeGroupVersion.WithKind("Trial"): + return &applyconfigurationtrialsv1beta1.TrialApplyConfiguration{} + case trialsv1beta1.SchemeGroupVersion.WithKind("TrialCondition"): + return &applyconfigurationtrialsv1beta1.TrialConditionApplyConfiguration{} + case trialsv1beta1.SchemeGroupVersion.WithKind("TrialSpec"): + return &applyconfigurationtrialsv1beta1.TrialSpecApplyConfiguration{} + case trialsv1beta1.SchemeGroupVersion.WithKind("TrialStatus"): + return &applyconfigurationtrialsv1beta1.TrialStatusApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter { + return managedfields.NewSchemeTypeConverter(scheme, internal.Parser()) +}