fix sync streams and add diffs for annotations and owner references (#2728)

* extend and improve hasSlotsInSync unit test
* fix sync streams and add diffs for annotations and owner references
* incl. current annotations as desired where we do not fully control them
* added one more unit test and fixed sub test names
* pass maintenance windows to function and update unit test
This commit is contained in:
Felix Kunde
2024-08-14 12:56:14 +02:00
committed by GitHub
parent aad03f71ea
commit c7ee34ed12
6 changed files with 268 additions and 96 deletions
+3
View File
@@ -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)