Skip to content

Commit 565028f

Browse files
authored
Merge pull request #8598 from towca/jtuznik/dra-enable-fix
Fix DRA enablement logic
2 parents 8602947 + 0697aac commit 565028f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cluster-autoscaler/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,13 @@ func main() {
349349

350350
autoscalingOpts := flags.AutoscalingOptions()
351351

352-
// If the DRA flag is passed, we need to set the DRA feature gate as well. The selection of scheduler plugins for the default
353-
// scheduling profile depends on feature gates, and the DRA plugin is only included if the DRA feature gate is enabled. The DRA
354-
// plugin itself also checks the DRA feature gate and doesn't do anything if it's not enabled.
355-
if autoscalingOpts.DynamicResourceAllocationEnabled && !featureGate.Enabled(features.DynamicResourceAllocation) {
356-
if err := featureGate.SetFromMap(map[string]bool{string(features.DynamicResourceAllocation): true}); err != nil {
357-
klog.Fatalf("couldn't enable the DRA feature gate: %v", err)
352+
// The DRA feature controls whether the DRA scheduler plugin is selected in scheduler framework. The local DRA flag controls whether
353+
// DRA logic is enabled in Cluster Autoscaler. The 2 values should be in sync - enabling DRA logic in CA without selecting the DRA scheduler
354+
// plugin doesn't actually do anything, and selecting the DRA scheduler plugin without enabling DRA logic in CA means the plugin is not set up
355+
// correctly and can panic.
356+
if autoscalingOpts.DynamicResourceAllocationEnabled != featureGate.Enabled(features.DynamicResourceAllocation) {
357+
if err := featureGate.SetFromMap(map[string]bool{string(features.DynamicResourceAllocation): autoscalingOpts.DynamicResourceAllocationEnabled}); err != nil {
358+
klog.Fatalf("couldn't set the DRA feature gate to %v: %v", autoscalingOpts.DynamicResourceAllocationEnabled, err)
358359
}
359360
}
360361

0 commit comments

Comments
 (0)