-
Notifications
You must be signed in to change notification settings - Fork 16
feat: PodSpec changes now are applied only to pods on creation (#41 step 7) #118
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
Conversation
975ee9b to
015e334
Compare
77cbf0b to
7cf47c4
Compare
b9d6eb1 to
309d711
Compare
6916456 to
ab25dd5
Compare
|
|
||
| } | ||
|
|
||
| func TestProperCleanupOfEnvAndVolumes(t *testing.T) { |
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.
We don't remove the a configuration from a PodTemplateSpec after it has been applied anymore.
| u = workload.NewUpdater() | ||
| ) | ||
|
|
||
| // Create a 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.
Most of the changes in this test simply replace Deployment with Pod.
| wantsInstanceArg, foundContainer.Args) | ||
| } | ||
|
|
||
| // Now change the spec |
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.
No need to test applying the configuration to the PodSpec a second time with a slight change.
| }) | ||
| } | ||
|
|
||
| // loadOldEnvVarState loads the state connecting EnvVar changes done by the |
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.
Remove code that saves the the existing state so changes can later be removed.
| inst := matches[i] | ||
| var instContainer *corev1.Container | ||
|
|
||
| for j := range containers { |
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.
At the beginning of this function all containers on PodSpec were defined in the workload by the user. No more need to distinguish between containers that existed in the original workload and containers added by the operator.
…es PodSpec update code.
5f0429a to
71493f9
Compare
| for i := 0; i < len(proxies); i++ { | ||
| l.Items[i] = *proxies[i] | ||
| } | ||
| _, _, err := u.ConfigurePodProxies(l, wl, nil) |
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 is the only place ConfigurePodProxies is called. Should we get rid of the unused return values from the signature?
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 return values are used in mainline code coming in the next PR.
// internal/controller/pod_controller.go:88
// Reconfigure the PodSpec
updated, matchingInstances, wlConfigErr = a.updater.ConfigurePodProxies(instList, wl, owners)
Sadly, that means we need this awkward conversion method in the test code.
The proxy configuration is now only applied when a pod is created. The old algorithm allowed updates to the PodSpec
to apply changes after the pod was created. This PR simplifies the logic that applies the proxy configuration to a
PodSpec, mainly removing the code that would update the pod spec multiple times.