get postgres container by name, not index (#1504)

This commit is contained in:
Felix Kunde
2021-05-27 18:56:58 +02:00
committed by GitHub
parent 48cdca645d
commit 7884af2d59
5 changed files with 49 additions and 33 deletions
+2 -2
View File
@@ -357,8 +357,8 @@ func (c *Cluster) syncStatefulSet() error {
// and
// (b) some of the pods were not restarted when the lazy update was still in place
for _, pod := range pods {
effectivePodImage := pod.Spec.Containers[0].Image
stsImage := desiredSts.Spec.Template.Spec.Containers[0].Image
effectivePodImage := c.getPostgresContainer(&pod.Spec).Image
stsImage := c.getPostgresContainer(&desiredSts.Spec.Template.Spec).Image
if stsImage != effectivePodImage {
if err = c.markRollingUpdateFlagForPod(&pod, "pod not yet restarted due to lazy update"); err != nil {