-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Make use of sidecar inject label across repos #41163
Conversation
// If pod has the sidecar container set, then, the pod is in the mesh | ||
if hasIstioProxy(containers) { | ||
return true | ||
} | ||
|
||
// If Pod has labels, return the injection label value |
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.
The check on L55 is more robust
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.
Confused, shouldn't labels be respected over annotations
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.
I misunderstood
// enabled is true when deployment d PodSpec has either the annotation 'sidecar.istio.io/inject: "true"' | ||
// ok is true when the PodSpec doesn't have the 'sidecar.istio.io/inject' annotation present. | ||
// enabled is true when deployment d PodSpec has either the label/annotation 'sidecar.istio.io/inject: "true"' | ||
// ok is true when the PodSpec doesn't have the 'sidecar.istio.io/inject' label/annotation present. | ||
func getPodSidecarInjectionStatus(annos map[string]string) (enabled bool, ok bool) { |
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.
nit: annos
is not a great name anymore
v, ok := annos[annotation.SidecarInject.Name] | ||
return v == "true", ok | ||
v, ok := annos[label.SidecarInject.Name] | ||
return strings.EqualFold(v, "true"), ok |
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.
TRUE
is not valid
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.
I am not sure, actually in some other places we compare with EqualFold
.
Can you confirm?
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.
Also ParseBool is used
The label selector in the k8s webhook is definitely not EqualFold so there
may be some inconsistencies between different areas.
…On Mon, Sep 26, 2022, 6:58 PM Zhonghu Xu ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/config/analysis/analyzers/util/in_mesh.go
<#41163 (comment)>:
> func getPodSidecarInjectionStatus(annos map[string]string) (enabled bool, ok bool) {
- v, ok := annos[annotation.SidecarInject.Name]
- return v == "true", ok
+ v, ok := annos[label.SidecarInject.Name]
+ return strings.EqualFold(v, "true"), ok
I am not sure, actually in some other places we compare with EqualFold.
Can you confirm?
—
Reply to this email directly, view it on GitHub
<#41163 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYGXKPQTDEO63Q4DDSOC3WAJICVANCNFSM6AAAAAAQVTEORQ>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
@istio/wg-user-experience-maintainers |
/retest |
// If pod has the sidecar container set, then, the pod is in the mesh | ||
if hasIstioProxy(containers) { | ||
return true | ||
} | ||
|
||
// If Pod has labels, return the injection label value |
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.
I misunderstood
kindly ping @istio/wg-user-experience-maintainers |
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.
LGTM
Please provide a description of this PR:
To help us figure out who should review this PR, please put an X in all the areas that this PR affects.
Please check any characteristics that apply to this pull request.