mirror of
https://github.com/hanzo-ml/katib.git
synced 2026-09-24 00:31:27 +00:00
* Fix Istio sidecar injection by moving from annotations to labels Signed-off-by: madmecodes <[email protected]> * Update Istio sidecar injection from annotations to labels across the codebase Replace annotations with labels for Istio sidecar injection according to Istio recommendations. Update conformance tests, examples, constants, composers, and utilities to use the new label-based approach consistently. Signed-off-by: madmecodes <[email protected]> * fix: Update SuggestionLabels function and composer implementation for Istio label injection Signed-off-by: madmecodes <[email protected]> * Fix linting issues in mpi-job-horovod.py Signed-off-by: madmecodes <[email protected]> * update: function moved from annotations to labels Signed-off-by: madmecodes <[email protected]> --------- Signed-off-by: madmecodes <[email protected]>
59 lines
1.9 KiB
Go
59 lines
1.9 KiB
Go
/*
|
|
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.
|
|
*/
|
|
|
|
package util
|
|
|
|
import (
|
|
experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1"
|
|
suggestionsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1"
|
|
"github.com/kubeflow/katib/pkg/controller.v1beta1/consts"
|
|
)
|
|
|
|
// SuggestionLabels returns the expected suggestion labels.
|
|
// SuggestionLabels returns the expected suggestion labels.
|
|
func SuggestionLabels(instance *suggestionsv1beta1.Suggestion) map[string]string {
|
|
res := make(map[string]string)
|
|
for k, v := range instance.Labels {
|
|
res[k] = v
|
|
}
|
|
res[consts.LabelDeploymentName] = GetSuggestionDeploymentName(instance)
|
|
res[consts.LabelExperimentName] = instance.Name
|
|
res[consts.LabelSuggestionName] = instance.Name
|
|
res[consts.LabelIstioSidecarInjectName] = consts.LabelIstioSidecarInjectValue
|
|
return res
|
|
}
|
|
|
|
// TrialLabels returns the expected trial labels.
|
|
func TrialLabels(instance *experimentsv1beta1.Experiment) map[string]string {
|
|
res := make(map[string]string)
|
|
for k, v := range instance.Labels {
|
|
res[k] = v
|
|
}
|
|
res[consts.LabelExperimentName] = instance.Name
|
|
|
|
return res
|
|
}
|
|
|
|
// AppendIstioSidecarLabel adds the Istio sidecar injection label to a labels map
|
|
func AppendIstioSidecarLabel(labels map[string]string) map[string]string {
|
|
res := make(map[string]string)
|
|
for k, v := range labels {
|
|
res[k] = v
|
|
}
|
|
res[consts.LabelIstioSidecarInjectName] = consts.LabelIstioSidecarInjectValue
|
|
return res
|
|
}
|