From 99282c08cb0cfbfda90acba297e103d66ae25113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Tu=C5=BCnik?= Date: Tue, 10 Dec 2024 13:00:49 +0100 Subject: [PATCH] CA: automatically use BasicSnapshotStore when DRA is enabled By default CA is built with DeltaSnapshotStore, which isn't integrated with DRA yet. --- cluster-autoscaler/main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 121837596b60..283596ddf987 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -37,6 +37,7 @@ import ( "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/besteffortatomic" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/checkcapacity" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqclient" + "k8s.io/autoscaler/cluster-autoscaler/simulator/clustersnapshot" "k8s.io/autoscaler/cluster-autoscaler/simulator/clustersnapshot/predicate" "k8s.io/autoscaler/cluster-autoscaler/simulator/clustersnapshot/store" "k8s.io/autoscaler/cluster-autoscaler/simulator/framework" @@ -503,10 +504,17 @@ func buildAutoscaler(context ctx.Context, debuggingSnapshotter debuggingsnapshot deleteOptions := options.NewNodeDeleteOptions(autoscalingOptions) drainabilityRules := rules.Default(deleteOptions) + var snapshotStore clustersnapshot.ClusterSnapshotStore = store.NewDeltaSnapshotStore() + if autoscalingOptions.DynamicResourceAllocationEnabled { + // TODO(DRA): Remove this once DeltaSnapshotStore is integrated with DRA. + klog.Warningf("Using BasicSnapshotStore instead of DeltaSnapshotStore because DRA is enabled. Autoscaling performance/scalability might be decreased.") + snapshotStore = store.NewBasicSnapshotStore() + } + opts := core.AutoscalerOptions{ AutoscalingOptions: autoscalingOptions, FrameworkHandle: fwHandle, - ClusterSnapshot: predicate.NewPredicateSnapshot(store.NewDeltaSnapshotStore(), fwHandle, autoscalingOptions.DynamicResourceAllocationEnabled), + ClusterSnapshot: predicate.NewPredicateSnapshot(snapshotStore, fwHandle, autoscalingOptions.DynamicResourceAllocationEnabled), KubeClient: kubeClient, InformerFactory: informerFactory, DebuggingSnapshotter: debuggingSnapshotter,