Skip to content

Commit d3cbb5a

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 to preserve the installation state. However, the migrated revision was created without any status conditions, causing it to not be recognized as an "Installed" revision. BoxcutterRevisionStatesGetter determines if a revision is installed by checking for the Succeeded=True condition. When this condition is absent, the revision is treated as "RollingOut" rather than "Installed", which breaks subsequent upgrade operations because the system doesn't know what version is currently installed. This fix sets an initial Succeeded status condition on the migrated revision immediately after creation, ensuring it's recognized as an installed revision and allowing version upgrades to proceed correctly after the OLM upgrade. Fixes the test-upgrade-st2ex-e2e test failure where upgrading from version 1.0.0 to 1.0.1 after the OLM upgrade would fail because the system couldn't determine the currently installed version.
1 parent 95f7f9a commit d3cbb5a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

internal/operator-controller/applier/boxcutter.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,20 @@ 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+
// This ensures the revision is immediately recognized as "Installed" rather than "RollingOut"
271+
// when BoxcutterRevisionStatesGetter retrieves revision states.
272+
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
273+
Type: ocv1.ClusterExtensionRevisionTypeSucceeded,
274+
Status: metav1.ConditionTrue,
275+
Reason: "Migrated",
276+
Message: "Migrated from Helm release",
277+
ObservedGeneration: rev.GetGeneration(),
278+
})
279+
if err := m.Client.Status().Update(ctx, rev); err != nil {
280+
return fmt.Errorf("updating migrated revision status: %w", err)
281+
}
282+
269283
return nil
270284
}
271285

0 commit comments

Comments
 (0)