-
Notifications
You must be signed in to change notification settings - Fork 276
Add MeshConfig upgrade when upgrading a mesh #4386
Add MeshConfig upgrade when upgrading a mesh #4386
Conversation
a6bb189
to
2d37b9e
Compare
I know this is still WIP so I haven't taken a close look yet, but a few initial thoughts: It seems like the simplest solution here would be to default the image name/tag in the injector and leave it empty in the MeshConfig. Then the upgraded injector would implicitly start using its updated default. This was the behavior until #4131. Of the reasons @shashankram describes there, I think the biggest problem with using a default was that the default would be used if there was some error reading the value from the MeshConfig. I'd argue we should fail the injection altogether in that case. Otherwise, I don't see any issues with using a default if no value is specified in the MeshConfig. Going forward, adding new required fields to the CRD should result in an appropriate version bump for the API (v1alpha1 -> v1alpha2) and we should either have a conversion webhook to handle both versions or force the user to update their MeshConfigs to the new API themselves. That would handle any new required fields, so working around that here doesn't seem worth it to me unless we need this behavior for upgrading v0.9 to v0.11. |
The reason defaults are not to be encoded in the binary is because the image digests are not known. We should avoid going back to encoding defaults in the Go code if possible, and always infer it through the MeshConfig or other means. |
The default doesn't necessarily have to be a constant in Go. We could pass it on the command line or as an environment variable when the injector starts so it can still be defined once in values.yaml like it is now. |
That would work. Just want to be mindful about not hardcoding image defaults in the Go code. |
ability to specify the images through environment variables Signed-off-by: Thomas Stringer <[email protected]>
51bce67
to
9546904
Compare
This was a complete rewrite of the original PR, so the first message in this thread is no longer completely relevant. From the feedback, I refactored this to use environment variables if there is no setting in the MeshConfig for the following images: envoy image, envoy windows image, and the init container image. The default was also removed from the mesh config CRD, as that would auto-populate the MeshConfig resource with the defaults. This does not solve the problem with missing required parameters (in the original case, |
Signed-off-by: Thomas Stringer <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #4386 +/- ##
==========================================
+ Coverage 69.27% 69.32% +0.05%
==========================================
Files 212 212
Lines 14455 14476 +21
==========================================
+ Hits 10013 10035 +22
+ Misses 4390 4389 -1
Partials 52 52
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Description:
This fixes issue #4371. Prior to this fix if there was a change to the envoy sidecar image then this would not get reflected or upgraded in the mesh config. Upon further testing we cannot just patch that in because if there are missing required keys (as indicated by the CRD) then the patch itself will fail (see the Testing done section below on the missing required key error when attempting to patch).
This PR adds the functionality for a complete upgrade of the mesh config by doing two things:
Testing done:
Integration tests and manual testing.
Prior to this change:
Even though the mesh was upgraded, the envoy sidecar image remains the old version in the mesh config:
If you try to patch that it errors because of a missing key:
With this PR:
Affected area:
Please answer the following questions with yes/no.
No.
No.