Skip to content

Commit 2e30625

Browse files
committed
test
1 parent 0180632 commit 2e30625

1 file changed

Lines changed: 25 additions & 20 deletions

File tree

internal/operator-controller/controllers/clusterextension_controller.go

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -550,31 +550,36 @@ func (d *BoxcutterRevisionStatesGetter) GetRevisionStates(ctx context.Context, e
550550
return nil, fmt.Errorf("listing revisions: %w", err)
551551
}
552552
slices.SortFunc(existingRevisionList.Items, func(a, b ocv1.ClusterExtensionRevision) int {
553-
return cmp.Compare(b.Spec.Revision, a.Spec.Revision)
553+
return cmp.Compare(a.Spec.Revision, b.Spec.Revision)
554554
})
555555

556556
rs := &RevisionStates{}
557557
for _, rev := range existingRevisionList.Items {
558-
if rev.Spec.LifecycleState == ocv1.ClusterExtensionRevisionLifecycleStateActive {
559-
// TODO: the setting of these annotations (happens in boxcutter applier when we pass in "storageLabels")
560-
// is fairly decoupled from this code where we get the annotations back out. We may want to co-locate
561-
// the set/get logic a bit better to make it more maintainable and less likely to get out of sync.
562-
rm := &RevisionMetadata{
563-
Package: rev.Labels[labels.PackageNameKey],
564-
Image: rev.Annotations[labels.BundleReferenceKey],
565-
BundleMetadata: ocv1.BundleMetadata{
566-
Name: rev.Annotations[labels.BundleNameKey],
567-
Version: rev.Annotations[labels.BundleVersionKey],
568-
},
569-
}
558+
switch rev.Spec.LifecycleState {
559+
case ocv1.ClusterExtensionRevisionLifecycleStateActive,
560+
ocv1.ClusterExtensionRevisionLifecycleStatePaused:
561+
default:
562+
// Skip anything not active or paused, which should only be "Archived".
563+
continue
564+
}
570565

571-
// TODO: we should make constants for the ClusterExtensionRevision condition types.
572-
if installedCondition := apimeta.FindStatusCondition(rev.Status.Conditions, "Succeeded"); installedCondition == nil || installedCondition.Status != metav1.ConditionTrue {
573-
rs.RollingOut = append(rs.RollingOut, rm)
574-
} else {
575-
rs.Installed = rm
576-
break
577-
}
566+
// TODO: the setting of these annotations (happens in boxcutter applier when we pass in "storageLabels")
567+
// is fairly decoupled from this code where we get the annotations back out. We may want to co-locate
568+
// the set/get logic a bit better to make it more maintainable and less likely to get out of sync.
569+
rm := &RevisionMetadata{
570+
Package: rev.Labels[labels.PackageNameKey],
571+
Image: rev.Annotations[labels.BundleReferenceKey],
572+
BundleMetadata: ocv1.BundleMetadata{
573+
Name: rev.Annotations[labels.BundleNameKey],
574+
Version: rev.Annotations[labels.BundleVersionKey],
575+
},
576+
}
577+
578+
// TODO: we should make constants for the ClusterExtensionRevision condition types.
579+
if apimeta.IsStatusConditionTrue(rev.Status.Conditions, "Succeeded") {
580+
rs.Installed = rm
581+
} else {
582+
rs.RollingOut = append(rs.RollingOut, rm)
578583
}
579584
}
580585

0 commit comments

Comments
 (0)