compare revision hash instead of spec

This commit is contained in:
Felix Kunde 2020-04-20 18:39:45 +02:00
parent c73f944846
commit f7699b2714
1 changed files with 1 additions and 2 deletions

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"math/rand"
"reflect"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
@ -344,7 +343,7 @@ func (c *Cluster) recreatePods() error {
role := PostgresRole(pod.Labels[c.OpConfig.PodRoleLabel])
// final check if spec of running pod differs from template
if reflect.DeepEqual(pod.Spec, c.Statefulset.Spec.Template.Spec) {
if pod.ObjectMeta.Labels["controller-revision-hash"] == c.Statefulset.Status.CurrentRevision {
c.logger.Infof("%q pod %q already updated", role, podName)
continue
}