-
Notifications
You must be signed in to change notification settings - Fork 473
Fix Istio sidecar injection by moving from annotations to labels #2527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
d9a0803
dabb6ca
d0ca2ee
6759bb1
1b94f1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ metadata: | |
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
labels: | ||
sidecar.istio.io/inject: "true" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,29 @@ | ||
/* | ||
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 | ||
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 ( | ||
suggestionsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1" | ||
"github.com/kubeflow/katib/pkg/controller.v1beta1/consts" | ||
) | ||
|
||
// SuggestionAnnotations returns the expected suggestion annotations. | ||
func SuggestionAnnotations(instance *suggestionsv1beta1.Suggestion) map[string]string { | ||
return appendAnnotation( | ||
instance.Annotations, | ||
consts.AnnotationIstioSidecarInjectName, | ||
consts.AnnotationIstioSidecarInjectValue) | ||
} | ||
|
||
func appendAnnotation(annotations map[string]string, newAnnotationName string, newAnnotationValue string) map[string]string { | ||
// 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 annotations { | ||
for k, v := range labels { | ||
res[k] = v | ||
} | ||
res[newAnnotationName] = newAnnotationValue | ||
|
||
res[consts.LabelIstioSidecarInjectName] = consts.LabelIstioSidecarInjectValue | ||
return res | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,7 @@ def generate_trial_template() -> V1beta1TrialTemplate: | |
"kind": "Job", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need to also update this one: https://github.com/kubeflow/trainer/blob/release-1.9/sdk/python/kubeflow/training/utils/utils.py#L259 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Made the respective Pull Request in the trainer/release-1.9 kubeflow/trainer#2637 |
||
"spec": { | ||
"template": { | ||
"metadata": {"annotations": {"sidecar.istio.io/inject": "false"}}, | ||
"metadata": {"labels": {"sidecar.istio.io/inject": "false"}}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this func here: https://github.com/kubeflow/katib/blob/6759bb1fe30a3acbc0f68a1ba745f6dabbe42c27/pkg/controller.v1beta1/util/labels.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the func in labels.go