From d1fa1bf1c6d944a9be3a0e28602e4fa67765a2ec Mon Sep 17 00:00:00 2001 From: Zach Aller Date: Mon, 22 Jan 2024 10:34:23 -0600 Subject: [PATCH 1/2] fix: keep rs inormer updated upon updating labels and annotations Signed-off-by: Zach Aller --- rollout/ephemeralmetadata.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rollout/ephemeralmetadata.go b/rollout/ephemeralmetadata.go index 92fc5d2670..5d6d901812 100644 --- a/rollout/ephemeralmetadata.go +++ b/rollout/ephemeralmetadata.go @@ -2,6 +2,7 @@ package rollout import ( "context" + "fmt" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -81,10 +82,14 @@ func (c *rolloutContext) syncEphemeralMetadata(ctx context.Context, rs *appsv1.R } // 2. Update ReplicaSet so that any new pods it creates will have the metadata - _, err = c.kubeclientset.AppsV1().ReplicaSets(modifiedRS.Namespace).Update(ctx, modifiedRS, metav1.UpdateOptions{}) + rs, err = c.kubeclientset.AppsV1().ReplicaSets(modifiedRS.Namespace).Update(ctx, modifiedRS, metav1.UpdateOptions{}) if err != nil { return err } + err = c.replicaSetInformer.GetIndexer().Update(rs) + if err != nil { + return fmt.Errorf("error updating replicaset informer in syncEphemeralMetadata: %w", err) + } c.log.Infof("synced ephemeral metadata %v to ReplicaSet %s", podMetadata, rs.Name) return nil } From 25fbf8d5417481808556dda3d63f6d892229e302 Mon Sep 17 00:00:00 2001 From: Zach Aller Date: Tue, 23 Jan 2024 10:20:27 -0600 Subject: [PATCH 2/2] give error some context Signed-off-by: Zach Aller --- rollout/ephemeralmetadata.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollout/ephemeralmetadata.go b/rollout/ephemeralmetadata.go index 5d6d901812..60b745ed29 100644 --- a/rollout/ephemeralmetadata.go +++ b/rollout/ephemeralmetadata.go @@ -84,7 +84,7 @@ func (c *rolloutContext) syncEphemeralMetadata(ctx context.Context, rs *appsv1.R // 2. Update ReplicaSet so that any new pods it creates will have the metadata rs, err = c.kubeclientset.AppsV1().ReplicaSets(modifiedRS.Namespace).Update(ctx, modifiedRS, metav1.UpdateOptions{}) if err != nil { - return err + return fmt.Errorf("error updating replicaset in syncEphemeralMetadata: %w", err) } err = c.replicaSetInformer.GetIndexer().Update(rs) if err != nil {