Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep rs inormer updated upon updating labels and annotations #3321

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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 @@
}

// 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)
}

Check warning on line 88 in rollout/ephemeralmetadata.go

View check run for this annotation

Codecov / codecov/patch

rollout/ephemeralmetadata.go#L87-L88

Added lines #L87 - L88 were not covered by tests
err = c.replicaSetInformer.GetIndexer().Update(rs)
if err != nil {
return fmt.Errorf("error updating replicaset informer in syncEphemeralMetadata: %w", err)

Check warning on line 91 in rollout/ephemeralmetadata.go

View check run for this annotation

Codecov / codecov/patch

rollout/ephemeralmetadata.go#L91

Added line #L91 was not covered by tests
}
c.log.Infof("synced ephemeral metadata %v to ReplicaSet %s", podMetadata, rs.Name)
return nil
Expand Down
Loading