feat: Automatically update default images on operator startup.#254
feat: Automatically update default images on operator startup.#254
Conversation
| Client: testintegration.Client, | ||
| Namespace: testhelpers.NewNamespaceName(name), | ||
| ConnectionString: "region:project:inst", | ||
| ProxyImageURL: "proxy-image:latest", |
There was a problem hiding this comment.
Don't set an explicit proxy image url in tests, use the default.
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| func TestUpdateWorkloadContainerWhenDefaultProxyImageChanges(t *testing.T) { |
There was a problem hiding this comment.
This is the test that demonstrates that when the operator's default image changes, it will automatically update the proxy container image on existing deployments.
There was a problem hiding this comment.
Let's definitely add this comment into the code. It really helps.
|
|
||
| // Start lists all the AuthProxyWorkload resources and triggers the update on | ||
| // the resources with a default proxy image. | ||
| func (c *upgradeDefaultProxyOnStartup) Start(ctx context.Context) error { |
There was a problem hiding this comment.
The Start() function will be called by ControllerRuntime once the operator is initialized.
| case <-ctx.Done(): | ||
| return nil | ||
| default: | ||
| err := c.c.List(ctx, l, client.Continue(l.Continue)) |
There was a problem hiding this comment.
c.c.List() fills l with a paginated list of AuthProxyWorkloads. The token in l.Continue field is used get the next page of the list.
There was a problem hiding this comment.
Thanks for the comment here. Should we add it into the code?
7cd1eee to
63bcd4c
Compare
…iners should be updated. (#253) When an AuthProxyWorkload uses the default proxy image, use the operator's default proxy image and the AuthProxyWorkload.Generation together as a key to determine if a workload's proxy containers need to be updated. Add tests to ensure that when the default image hardcoded into the operator changes, workloads using the old default will be identified and reconfigured properly. There is another PR coming #254 which will automatically check and apply configuration changes to AuthProxyWorkload resources on operator startup. Related to #87
| case <-ctx.Done(): | ||
| return nil | ||
| default: | ||
| err := c.c.List(ctx, l, client.Continue(l.Continue)) |
There was a problem hiding this comment.
Thanks for the comment here. Should we add it into the code?
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| func TestUpdateWorkloadContainerWhenDefaultProxyImageChanges(t *testing.T) { |
There was a problem hiding this comment.
Let's definitely add this comment into the code. It really helps.
…cking for updated default proxy image annotation
When the operator starts, run a function that will list all AuthProxyWorkloads, find ones that are using the
default proxy image, and trigger an update on those AuthProxyWorkloads. This will cause the Reconcile
function to ensure that the AuthProxyWorkloads are running the latest default version of the proxy image.
Fixes #87