-
Notifications
You must be signed in to change notification settings - Fork 344
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
Sidecar not removed #1508
Sidecar not removed #1508
Changes from 2 commits
03a975b
24ca36f
a5bdd69
87c5672
fe4d02a
768aa97
70af62e
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 |
---|---|---|
|
@@ -80,10 +80,10 @@ func Desired(dep *appsv1.Deployment, ns *corev1.Namespace) bool { | |
"namespace": dep.Namespace, | ||
"deployment": dep.Name, | ||
}) | ||
_, depExist := dep.Annotations[Annotation] | ||
annotationValue, depExist := dep.Annotations[Annotation] | ||
_, nsExist := ns.Annotations[Annotation] | ||
|
||
if depExist { | ||
if depExist && !strings.EqualFold(annotationValue, "false") { | ||
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. What if the annotation is at the namespace level? Isn't this logic already present in the 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. inject.Desired just test if the annotation is present, but if the annotation exists with a "false" value it still returns "true". Should i validate the same condition for the namespace? 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. I'm confident we have a logic somewhere that determines whether a deployment should have a sidecar based on annotations from both the deployment itself and the namespace. 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. it's present in "inject.select", but doesn't it make more sense for this to be validated in "inject.desired" ?, it is a bit confusing that desired returns "true" when it is not really desired. 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. True. Would you be able to create an issue to refactor that? Also, it would be great to have an e2e test to assert the behavior of this PR here. It doesn't have to be done as part of this PR, though. I'd still like to get @rubenvp8510's review before merging, but looks good to me! 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.
count on it 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. This covers both cases, because Except that we already have the cleaning logic on namespace but not on individual deployments, this is what this PR is adding., I think this modification to the desired behaviour makes sense , but it is a little bit confusing the difference between needed and desired, Indeed 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. BTW, I think we shouldn't use 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. the refactor is done, can you review @rubenvp8510 ? |
||
logger.Debug("annotation present on deployment") | ||
return true | ||
} | ||
|
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 would add this cleaning logic on the else statement of the
if inject.Needed(dep, ns) {
Here: https://github.com/jaegertracing/jaeger-operator/pull/1508/files#diff-c553184997fa4c9f63e697af2f39eb2e6fb43eeff64a0ef66c9e955f61347b02R172