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

chore: sort cmpv.status.serviceVersions according to the semantic version #8652

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Changes from 1 commit
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
12 changes: 7 additions & 5 deletions controllers/apps/componentversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,17 @@ func (r *ComponentVersionReconciler) status(cli client.Client, rctx intctrlutil.
}

func (r *ComponentVersionReconciler) supportedServiceVersions(compVersion *appsv1.ComponentVersion) string {
versions := map[string]bool{}
versionSet := sets.New[string]()
for _, release := range compVersion.Spec.Releases {
if len(release.ServiceVersion) > 0 {
versions[release.ServiceVersion] = true
versionSet.Insert(release.ServiceVersion)
}
}
keys := maps.Keys(versions)
slices.Sort(keys)
return strings.Join(keys, ",") // TODO(API): service versions length
versions := versionSet.UnsortedList()
slices.SortFunc(versions, func(a, b string) int {
return serviceVersionComparator(a, b) * -1
})
return strings.Join(versions, ",") // TODO(API): service versions length
}

func (r *ComponentVersionReconciler) updateSupportedCompDefLabels(cli client.Client, rctx intctrlutil.RequestCtx,
Expand Down
Loading