Skip to content

Commit f105e8f

Browse files
ajbeattieCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 15232fc commit f105e8f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

internal/controller/reporting.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ type syncCandidate struct {
213213
func (c *Controller) makeSyncRecords(ctx context.Context, syncClusterPods []any) []*deploymentrecord.Record {
214214
// The API requires a unique set of deployment_names for a snapshot job.
215215
// During a rollout the same deployment_name can appear with multiple digests
216-
// (old and new pods running at once), so we must collapse to a single digest per workload +
216+
// (old and new pods running at once), so we must collapse to a single digest per workload and
217217
// container name. We pick the newest running pod so the snapshot reflects the rollout target.
218218
winners := make(map[string]syncCandidate)
219219
for _, p := range syncClusterPods {
@@ -244,7 +244,7 @@ func (c *Controller) makeSyncRecords(ctx context.Context, syncClusterPods []any)
244244
allContainers = append(allContainers, pod.Spec.InitContainers...)
245245

246246
// Dedupe to one record per deployment_name. On a digest conflict
247-
// (rollout in progress) the newest running pod wins.
247+
// (rollout in progress) the preferred pod wins (running over terminal; otherwise newest).
248248
for _, container := range allContainers {
249249
dn := getARDeploymentName(pod, container, c.cfg.Template, wl.Name)
250250
digest := getContainerDigest(pod, container.Name)
@@ -271,7 +271,7 @@ func (c *Controller) makeSyncRecords(ctx context.Context, syncClusterPods []any)
271271
// Keep the newest running pod's digest and log the decision so the
272272
// rollout is visible.
273273
if isPreferredSyncPod(pod, existing.pod) {
274-
slog.Info("Multiple digests observed for deployment_name during sync, choosing newest running",
274+
slog.Info("Multiple digests observed for deployment_name during sync, choosing preferred pod",
275275
"deployment_name", dn,
276276
"chosen_pod", pod.Name,
277277
"chosen_digest", digest,
@@ -280,7 +280,7 @@ func (c *Controller) makeSyncRecords(ctx context.Context, syncClusterPods []any)
280280
)
281281
winners[dn] = syncCandidate{pod: pod, container: container, wlName: wl.Name}
282282
} else {
283-
slog.Info("Multiple digests observed for deployment_name during sync, keeping newest running",
283+
slog.Info("Multiple digests observed for deployment_name during sync, keeping preferred pod",
284284
"deployment_name", dn,
285285
"kept_pod", existing.pod.Name,
286286
"kept_digest", existingDigest,

0 commit comments

Comments
 (0)