Skip to content

Commit e95c682

Browse files
Fix: Protect CRD upgrade safety preflight behind feature flag
CRD upgrade safety preflight checks run unconditionally and is not protected under the feature flag causing massive error messages and breaking the ClusterExtension upgrades with "Too long: may not be more than 32768 bytes". Commit cab41aa added CRD upgrade safety preflights without feature flag protection: ```go // Always runs for everyone - not protected preflights := []controllers.Preflight{ crdupgradesafety.NewPreflight(...), } ``` Later, commit 543f099 added PreflightPermissions feature flag but only protected the RBAC preauthorizer, leaving CRD upgrade safety unprotected. Move CRD upgrade safety behind the existing `PreflightPermissions` feature flag: ```go // Only runs when feature flag enabled if features.OperatorControllerFeatureGate.Enabled(features.PreflightPermissions) { preflights = append(preflights, crdupgradesafety.NewPreflight(...)) } ``` - **By Default**: Users get normal upgrades without CRD validation - **By Opt-In with Feature flag**: enable PreflightPermissions=true for CRD safety checks Fixes issue introduced in cab41aa
1 parent 43caaae commit e95c682

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cmd/operator-controller/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,12 @@ func run() error {
417417
return err
418418
}
419419

420-
preflights := []applier.Preflight{
421-
crdupgradesafety.NewPreflight(aeClient.CustomResourceDefinitions()),
422-
}
423-
424-
// determine if PreAuthorizer should be enabled based on feature gate
420+
var preflights []applier.Preflight
425421
var preAuth authorization.PreAuthorizer
422+
423+
// determine if preflight checks should be enabled based on feature gate
426424
if features.OperatorControllerFeatureGate.Enabled(features.PreflightPermissions) {
425+
preflights = append(preflights, crdupgradesafety.NewPreflight(aeClient.CustomResourceDefinitions()))
427426
preAuth = authorization.NewRBACPreAuthorizer(mgr.GetClient())
428427
}
429428

0 commit comments

Comments
 (0)