Skip to content

Commit

Permalink
incl. current annotations as desired where we do not fully control them
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Aug 14, 2024
1 parent 612fe5a commit a710130
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/cluster/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cluster/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a710130

Please sign in to comment.