From 4938fa79b5c8c7f14c03d9e9200a8689c759ecd6 Mon Sep 17 00:00:00 2001 From: Priyanshu-u07 Date: Wed, 14 Oct 2026 17:36:39 +0530 Subject: [PATCH] Describe the Kubernetes autoscaler on both auto-replica screens Signed-off-by: Priyanshu-u07 --- .../deployment/DeploymentConfig.tsx | 4 +- .../__tests__/autoReplicaConfig.test.tsx | 39 +++++++++++++++++++ .../__tests__/autoReplicaSettings.test.tsx | 7 ++++ .../components/deployment/configSections.tsx | 16 +++++++- 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 apps/dashboard/src/components/deployment/__tests__/autoReplicaConfig.test.tsx diff --git a/apps/dashboard/src/components/deployment/DeploymentConfig.tsx b/apps/dashboard/src/components/deployment/DeploymentConfig.tsx index 53a189d5..015ee575 100644 --- a/apps/dashboard/src/components/deployment/DeploymentConfig.tsx +++ b/apps/dashboard/src/components/deployment/DeploymentConfig.tsx @@ -812,7 +812,9 @@ export function AutoReplicaSettings({ autoReplicaEnabled, tokensPerSecondThresho className="w-4 h-4 rounded border-border bg-background text-ember-500 focus:ring-ember-500/40" /> {autoReplicaEnabled && !isK8s && ( diff --git a/apps/dashboard/src/components/deployment/__tests__/autoReplicaConfig.test.tsx b/apps/dashboard/src/components/deployment/__tests__/autoReplicaConfig.test.tsx new file mode 100644 index 00000000..a42ff2ca --- /dev/null +++ b/apps/dashboard/src/components/deployment/__tests__/autoReplicaConfig.test.tsx @@ -0,0 +1,39 @@ +import { describe, it, expect, vi } from "vitest"; +import { render, screen } from "@testing-library/react"; + +import { AutoReplicaConfig } from "../configSections"; + +function renderConfig(provider: string, autoReplicaEnabled = true) { + const state = { + autoReplicaEnabled, + tokensPerSecondThreshold: "10", + selectedPool: { provider }, + }; + return render(); +} + +describe("the create form describes the autoscaler the pool actually has", () => { + it("a kubernetes pool is told about replicas, not nodes", () => { + renderConfig("k8s"); + expect(screen.getByText(/scale replicas automatically/i)).toBeInTheDocument(); + expect(screen.getByText(/in-flight requests per replica/i)).toBeInTheDocument(); + expect(screen.queryByText(/provision new nodes/i)).not.toBeInTheDocument(); + }); + + it("a kubernetes pool gets no tokens/sec field, which does nothing there", () => { + renderConfig("k8s"); + expect(screen.queryByLabelText(/tokens\/sec threshold/i)).not.toBeInTheDocument(); + }); + + it("any other pool keeps the node-provisioning text and the tokens/sec field", () => { + renderConfig("aws"); + expect(screen.getByText(/provision new nodes/i)).toBeInTheDocument(); + expect(screen.getByLabelText(/tokens\/sec threshold/i)).toBeInTheDocument(); + expect(screen.queryByText(/in-flight requests per replica/i)).not.toBeInTheDocument(); + }); + + it("nothing beyond the toggle shows while auto-replica is off", () => { + renderConfig("k8s", false); + expect(screen.queryByText(/in-flight requests per replica/i)).not.toBeInTheDocument(); + }); +}); diff --git a/apps/dashboard/src/components/deployment/__tests__/autoReplicaSettings.test.tsx b/apps/dashboard/src/components/deployment/__tests__/autoReplicaSettings.test.tsx index 1fdbee24..f5a1ead2 100644 --- a/apps/dashboard/src/components/deployment/__tests__/autoReplicaSettings.test.tsx +++ b/apps/dashboard/src/components/deployment/__tests__/autoReplicaSettings.test.tsx @@ -50,6 +50,13 @@ describe("the two autoscalers are never offered together", () => { expect(screen.queryByLabelText(label)).toBeNull(); } }); + + it("the toggle on a kubernetes pool promises replicas, not new nodes", () => { + renderSettings({ isK8s: true }); + + expect(screen.getByLabelText(/scale replicas automatically/i)).toBeInTheDocument(); + expect(screen.queryByText(/provision new nodes/i)).toBeNull(); + }); }); describe("when auto-replica is off", () => { diff --git a/apps/dashboard/src/components/deployment/configSections.tsx b/apps/dashboard/src/components/deployment/configSections.tsx index cc9333d4..138ff9e6 100644 --- a/apps/dashboard/src/components/deployment/configSections.tsx +++ b/apps/dashboard/src/components/deployment/configSections.tsx @@ -238,6 +238,9 @@ export function CompatibilityPanel({ /** Auto-replica scale-out config (inference deploys). */ export function AutoReplicaConfig({ state, dispatch }: SectionProps) { + // Kubernetes scales replicas through KEDA; the tokens/sec threshold drives + // node provisioning, which only the other pool types do. + const isK8s = state.selectedPool?.provider === "k8s" return (
@@ -253,10 +256,19 @@ export function AutoReplicaConfig({ state, dispatch }: SectionProps) { className="w-4 h-4 rounded border-border" />
- {state.autoReplicaEnabled && ( + {state.autoReplicaEnabled && isK8s && ( +

+ Replicas scale on in-flight requests per replica, with p95 latency as a + guardrail. Platform defaults apply until you change the targets in the + deployment's Configuration tab. +

+ )} + {state.autoReplicaEnabled && !isK8s && (