diff --git a/pkg/apis/controller/common/v1alpha3/common_types.go b/pkg/apis/controller/common/v1alpha3/common_types.go index 3f6dade80eb..51c3dea23c7 100644 --- a/pkg/apis/controller/common/v1alpha3/common_types.go +++ b/pkg/apis/controller/common/v1alpha3/common_types.go @@ -23,7 +23,7 @@ import ( type AlgorithmSpec struct { AlgorithmName string `json:"algorithmName,omitempty"` // Key-value pairs representing settings for suggestion algorithms. - AlgorithmSettings []AlgorithmSetting `json:"algorithmSettings"` + AlgorithmSettings []AlgorithmSetting `json:"algorithmSettings,omitempty"` EarlyStopping *EarlyStoppingSpec `json:"earlyStopping,omitempty"` } diff --git a/pkg/apis/controller/common/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/controller/common/v1alpha3/zz_generated.deepcopy.go index 911096dc124..596158ec953 100644 --- a/pkg/apis/controller/common/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/controller/common/v1alpha3/zz_generated.deepcopy.go @@ -23,6 +23,22 @@ import ( v1 "k8s.io/api/core/v1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlgorithmSetting) DeepCopyInto(out *AlgorithmSetting) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlgorithmSetting. +func (in *AlgorithmSetting) DeepCopy() *AlgorithmSetting { + if in == nil { + return nil + } + out := new(AlgorithmSetting) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AlgorithmSpec) DeepCopyInto(out *AlgorithmSpec) { *out = *in @@ -70,6 +86,22 @@ func (in *CollectorSpec) DeepCopy() *CollectorSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EarlyStoppingSetting) DeepCopyInto(out *EarlyStoppingSetting) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EarlyStoppingSetting. +func (in *EarlyStoppingSetting) DeepCopy() *EarlyStoppingSetting { + if in == nil { + return nil + } + out := new(EarlyStoppingSetting) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EarlyStoppingSpec) DeepCopyInto(out *EarlyStoppingSpec) { *out = *in @@ -128,6 +160,22 @@ func (in *FilterSpec) DeepCopy() *FilterSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Metric) DeepCopyInto(out *Metric) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metric. +func (in *Metric) DeepCopy() *Metric { + if in == nil { + return nil + } + out := new(Metric) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricsCollectorSpec) DeepCopyInto(out *MetricsCollectorSpec) { *out = *in @@ -201,6 +249,22 @@ func (in *Observation) DeepCopy() *Observation { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParameterAssignment) DeepCopyInto(out *ParameterAssignment) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParameterAssignment. +func (in *ParameterAssignment) DeepCopy() *ParameterAssignment { + if in == nil { + return nil + } + out := new(ParameterAssignment) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SourceSpec) DeepCopyInto(out *SourceSpec) { *out = *in diff --git a/pkg/apis/v1alpha3/openapi_generated.go b/pkg/apis/v1alpha3/openapi_generated.go index 8b224545e93..68f22b686ef 100644 --- a/pkg/apis/v1alpha3/openapi_generated.go +++ b/pkg/apis/v1alpha3/openapi_generated.go @@ -78,7 +78,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, }, - Required: []string{"algorithmSettings"}, }, }, Dependencies: []string{ diff --git a/pkg/apis/v1alpha3/swagger.json b/pkg/apis/v1alpha3/swagger.json index fdd3e0c20b7..f26033cec5a 100644 --- a/pkg/apis/v1alpha3/swagger.json +++ b/pkg/apis/v1alpha3/swagger.json @@ -310,9 +310,6 @@ } }, "v1alpha3.AlgorithmSpec": { - "required": [ - "algorithmSettings" - ], "properties": { "algorithmName": { "type": "string" diff --git a/pkg/controller.v1alpha3/util/annotations.go b/pkg/controller.v1alpha3/util/annotations.go index 0ab0702ffcc..47c63307be5 100644 --- a/pkg/controller.v1alpha3/util/annotations.go +++ b/pkg/controller.v1alpha3/util/annotations.go @@ -1,16 +1,33 @@ +/* + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package util import ( "fmt" - suggestionsv1alpha3 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1alpha3" - "github.com/kubeflow/katib/pkg/controller.v1alpha3/consts" - pytorchv1 "github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1" - tfv1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1" batchv1 "k8s.io/api/batch/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" + + suggestionsv1alpha3 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1alpha3" + "github.com/kubeflow/katib/pkg/controller.v1alpha3/consts" + jobv1alpha3 "github.com/kubeflow/katib/pkg/job/v1alpha3" + pytorchv1 "github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1" + tfv1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1" ) var ( @@ -85,6 +102,10 @@ func TrainingJobAnnotations(desiredJob *unstructured.Unstructured) error { } return nil default: + // Annotation appending of custom job can be done in Provider.MutateJob. + if _, ok := jobv1alpha3.SupportedJobList[kind]; ok { + return nil + } return fmt.Errorf("Invalid Katib Training Job kind %v", kind) }