-
Notifications
You must be signed in to change notification settings - Fork 345
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
Update deployment sidecar when flags change #961
Conversation
9bab4aa
to
dce293b
Compare
Codecov Report
@@ Coverage Diff @@
## master #961 +/- ##
==========================================
+ Coverage 64.44% 64.56% +0.11%
==========================================
Files 82 82
Lines 6526 6542 +16
==========================================
+ Hits 4206 4224 +18
+ Misses 2178 2177 -1
+ Partials 142 141 -1
Continue to review full report at Codecov.
|
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.
Could we try a different approach? Instead of checking whether the container needs updating, you could update the container every time. Kubernetes describes the desired state and will act to make this true, so, updating the container should not yield a new deployment (nor an update) if the container spec hasn't changed.
Yes, this was my first approach, I just need to remove 1 commit. |
b5d7bb2
to
363171f
Compare
I tried the approach of updating the sidecar on each reconciliation process. It works, but I saw a couple of errors on logs. regarding of deployment update: "the object has been modified; please apply your changes to the latest version and try again". This happens even if the I think this is due the fact that the deployment status (ready, number of replicas etc..) is modified while we are injecting (or updating) the deployment. |
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.
This still needs tests:
- ensuring that deployments with explicit sidecars aren't affected by this change
- ensuring that sidecars are actually being updated
- extra test: add an assertion to the current
TestSidecarNeeded
, ensuring that there are only two containers in the deployments (to make sure our update is indeed removing the container).
You might also consider simply replacing the container instead of deleting + adding the container.
6b11c26
to
9ee64d6
Compare
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. Perhaps @objectiser or @pavolloffay would also like to take a look before merging?
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 - one minor suggestion.
dep2 = Sidecar(jaeger, dep2) | ||
dep3 := dep(map[string]string{Annotation: jaeger.Name}, map[string]string{}) | ||
|
||
assert.False(t, EqualSidecar(dep1, dep2)) |
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: Can you move this above dep3
, and then before dep3
line have a comment about // Compare with no agent
or something like that - at the moment the different criteria being tested are being interleaved.
There is one thing with this PR. I still observe this:
But the sidecar was injected, I have the theory that this happens due the changes in the deployment status. Not sure how to avoid this. |
9ea0236
to
8a519d0
Compare
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
8a519d0
to
def0fa1
Compare
@rubenvp8510 If you could create a separate issue for the Thanks! |
Still need to update tests.