Skip to content

Commit 560f372

Browse files
committed
fix: preserves statefulset annotations
Signed-off-by: Juliana Oliveira <[email protected]>
1 parent 362bfec commit 560f372

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/controller/postgrescluster/pgbackrest.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,18 @@ func (r *Reconciler) generateRepoHostIntent(ctx context.Context, postgresCluster
599599
})
600600

601601
podAnnotations := naming.Merge(annotations)
602+
603+
// Preserve existing pod template annotations from the current StatefulSet.
604+
// This ensures annotations like pgbackrest-secret-version persist across reconciliations.
605+
for _, host := range repoResources.hosts {
606+
if host.Name == repoHostName {
607+
if host.Spec.Template.Annotations != nil {
608+
podAnnotations = naming.Merge(podAnnotations, host.Spec.Template.Annotations)
609+
}
610+
break
611+
}
612+
}
613+
602614
// Tracks pgbackrest secret version in order to trigger repo-host updates upon change.
603615
// Fixes a problem where repo-host certificates become stale.
604616
existingSecret := &corev1.Secret{}

0 commit comments

Comments
 (0)