From a710130f1ed380f5e3be1a8cfc623eae2c43ed6f Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Wed, 14 Aug 2024 10:15:34 +0200 Subject: [PATCH] incl. current annotations as desired where we do not fully control them --- pkg/cluster/streams.go | 4 +++- pkg/cluster/sync.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cluster/streams.go b/pkg/cluster/streams.go index 6acb5bf25..dcdd86a1c 100644 --- a/pkg/cluster/streams.go +++ b/pkg/cluster/streams.go @@ -480,7 +480,9 @@ func (c *Cluster) compareStreams(curEventStreams, newEventStreams *zalandov1.Fab reasons := make([]string, 0) match = true - if changed, reason := c.compareAnnotations(curEventStreams.ObjectMeta.Annotations, newEventStreams.ObjectMeta.Annotations); changed { + // stream operator can add extra annotations so incl. current annotations in desired annotations + desiredAnnotations := c.annotationsSet(curEventStreams.Annotations) + if changed, reason := c.compareAnnotations(curEventStreams.ObjectMeta.Annotations, desiredAnnotations); changed { match = false reasons = append(reasons, fmt.Sprintf("new streams annotations do not match: %s", reason)) } diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index 59aee34e6..ee1713c05 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -228,6 +228,7 @@ func (c *Cluster) syncPatroniConfigMap(suffix string) error { } annotations := make(map[string]string) maps.Copy(annotations, cm.Annotations) + // Patroni can add extra annotations so incl. current annotations in desired annotations desiredAnnotations := c.annotationsSet(cm.Annotations) if changed, _ := c.compareAnnotations(annotations, desiredAnnotations); changed { patchData, err := metaAnnotationsPatch(desiredAnnotations) @@ -272,6 +273,7 @@ func (c *Cluster) syncPatroniEndpoint(suffix string) error { } annotations := make(map[string]string) maps.Copy(annotations, ep.Annotations) + // Patroni can add extra annotations so incl. current annotations in desired annotations desiredAnnotations := c.annotationsSet(ep.Annotations) if changed, _ := c.compareAnnotations(annotations, desiredAnnotations); changed { patchData, err := metaAnnotationsPatch(desiredAnnotations) @@ -315,6 +317,7 @@ func (c *Cluster) syncPatroniService() error { } annotations := make(map[string]string) maps.Copy(annotations, svc.Annotations) + // Patroni can add extra annotations so incl. current annotations in desired annotations desiredAnnotations := c.annotationsSet(svc.Annotations) if changed, _ := c.compareAnnotations(annotations, desiredAnnotations); changed { patchData, err := metaAnnotationsPatch(desiredAnnotations)