Skip to content

Commit 24e4e84

Browse files
(fix) Helm to Boxcutter migration during OLM upgrade
When upgrading OLM from standard (Helm runtime) to experimental (Boxcutter runtime), the BoxcutterStorageMigrator creates a ClusterExtensionRevision from the existing Helm release. However, the migrated revision was created without status conditions, causing a race condition where it wasn't recognized as "Installed". This fix sets an initial Succeeded status on migrated revisions, ensuring they're immediately recognized and allowing version upgrades to proceed correctly after OLM upgrades. Fixes test-upgrade-st2ex-e2e failures.
1 parent c677d48 commit 24e4e84

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

api/v1/clusterextensionrevision_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const (
3232
// Condition Reasons
3333
ClusterExtensionRevisionReasonArchived = "Archived"
3434
ClusterExtensionRevisionReasonBlocked = "Blocked"
35+
ClusterExtensionRevisionReasonMigrated = "Migrated"
3536
ClusterExtensionRevisionReasonProbeFailure = "ProbeFailure"
3637
ClusterExtensionRevisionReasonProbesSucceeded = "ProbesSucceeded"
3738
ClusterExtensionRevisionReasonReconciling = "Reconciling"

internal/operator-controller/applier/boxcutter.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,33 @@ func (m *BoxcutterStorageMigrator) Migrate(ctx context.Context, ext *ocv1.Cluste
266266
return fmt.Errorf("getting created revision: %w", err)
267267
}
268268

269+
// Set initial status on the migrated revision to mark it as succeeded.
270+
//
271+
// The revision must have a Succeeded=True status condition immediately after creation.
272+
//
273+
// A revision is only considered "Installed" (vs "RollingOut") when it has this condition.
274+
// Without it, the system cannot determine what version is currently installed, which breaks:
275+
// - Version resolution (can't compute upgrade paths from unknown starting point)
276+
// - Status reporting (installed bundle appears as nil)
277+
// - Subsequent upgrades (resolution fails without knowing current version)
278+
//
279+
// While the ClusterExtensionRevision controller would eventually reconcile and set this status,
280+
// that creates a timing gap where the ClusterExtension reconciliation happens before the status
281+
// is set, causing failures during the OLM upgrade window.
282+
//
283+
// Since we're creating this revision from a successfully deployed Helm release, we know it
284+
// represents a working installation and can safely mark it as succeeded immediately.
285+
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
286+
Type: ocv1.ClusterExtensionRevisionTypeSucceeded,
287+
Status: metav1.ConditionTrue,
288+
Reason: ocv1.ClusterExtensionRevisionReasonMigrated,
289+
Message: "Migrated from Helm release",
290+
ObservedGeneration: rev.GetGeneration(),
291+
})
292+
if err := m.Client.Status().Update(ctx, rev); err != nil {
293+
return fmt.Errorf("updating migrated revision status: %w", err)
294+
}
295+
269296
return nil
270297
}
271298

0 commit comments

Comments
 (0)