Skip to content
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
14 changes: 14 additions & 0 deletions internal/controller/state_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
package controller

import (
"cmp"
"slices"

"github.com/temporalio/temporal-worker-controller/api/v1alpha1"
"github.com/temporalio/temporal-worker-controller/internal/k8s"
"github.com/temporalio/temporal-worker-controller/internal/temporal"
Expand Down Expand Up @@ -65,6 +68,17 @@ func (m *stateMapper) mapToStatus(targetBuildID string) *v1alpha1.WorkerDeployme
deprecatedVersions = append(deprecatedVersions, versionStatus)
}
}
// NOTE(jaypipes): Need to sort the deprecated versions here in order to
// prevent sort order differences from causing unnecessary status
// generation increments.
//
// See: https://github.com/temporalio/temporal-worker-controller/issues/415
slices.SortStableFunc(
deprecatedVersions,
func(a, b *v1alpha1.DeprecatedWorkerDeploymentVersion) int {
return cmp.Compare(a.BuildID, b.BuildID)
},
)
status.DeprecatedVersions = deprecatedVersions

// Set version count from temporal state (directly from VersionSummaries via Versions map)
Expand Down
Loading