Skip to content

Commit a28e16a

Browse files
fix: Check all containers and init containers for proxy before recreating pod (#662)
Since the controller is now using sidecar init containers, these should be checked for existence when determining if a pod needs to be recreated because the proxy injection failed. In other words, currently we get false positives if the main workload is erroring and the proxy was injected as a sidecar init container, which causes the controller to remove the pod instead of letting it progress. I ran into some errors running the go_lint step in the Makefile (even before making changes) and ran into a problem during the terraform execution of building the infra for the e2e tests, so I wasn't able to complete them as laid out in the docs. I did however remove the go_lint step, build the controller image and replace it in my cluster and confirmed the desired effect. Co-authored-by: Jonathan Hess (he/him) <103529393+hessjcg@users.noreply.github.com>
1 parent d06664c commit a28e16a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/workload/podspec_updates.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ func (u *Updater) CheckWorkloadContainers(wl *PodWorkload, matches []*cloudsqlap
226226
for _, p := range matches {
227227
wantName := ContainerName(p)
228228
var found bool
229-
for _, c := range wl.PodSpec().Containers {
229+
podSpec := wl.PodSpec()
230+
allContainers := append(podSpec.Containers, podSpec.InitContainers...)
231+
for _, c := range allContainers {
230232
if c.Name == wantName {
231233
found = true
232234
}

0 commit comments

Comments
 (0)