Skip to content

Commit

Permalink
fix: keep rs inormer updated upon updating labels and annotations (#3321
Browse files Browse the repository at this point in the history
)

* fix: keep rs inormer updated upon updating labels and annotations

Signed-off-by: Zach Aller <[email protected]>

* give error some context

Signed-off-by: Zach Aller <[email protected]>

---------

Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller authored Jan 24, 2024
1 parent 31fe59b commit 07355a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rollout/ephemeralmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rollout

import (
"context"
"fmt"

appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -81,9 +82,13 @@ 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
return fmt.Errorf("error updating replicaset in syncEphemeralMetadata: %w", 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
Expand Down

0 comments on commit 07355a0

Please sign in to comment.