Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
<label htmlFor="autoReplicaEnabled" className="text-xs font-bold text-muted-foreground uppercase tracking-tighter">
Automatically provision new nodes when throughput degrades
{isK8s
? "Scale replicas automatically with request load"
: "Automatically provision new nodes when throughput degrades"}
</label>
</div>
{autoReplicaEnabled && !isK8s && (
Expand Down
Original file line number Diff line number Diff line change
@@ -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(<AutoReplicaConfig state={state as never} dispatch={vi.fn()} />);
}

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();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
16 changes: 14 additions & 2 deletions apps/dashboard/src/components/deployment/configSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="space-y-4 p-4 bg-muted/50 rounded-lg border">
<div className="flex items-center gap-2 mb-2">
Expand All @@ -253,10 +256,19 @@ export function AutoReplicaConfig({ state, dispatch }: SectionProps) {
className="w-4 h-4 rounded border-border"
/>
<label htmlFor="autoReplicaEnabled" className="text-xs font-medium text-muted-foreground">
Automatically provision new nodes when throughput degrades
{isK8s
? "Scale replicas automatically with request load"
: "Automatically provision new nodes when throughput degrades"}
</label>
</div>
{state.autoReplicaEnabled && (
{state.autoReplicaEnabled && isK8s && (
<p className="text-xs text-muted-foreground">
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.
</p>
)}
{state.autoReplicaEnabled && !isK8s && (
<div>
<label htmlFor="tokensPerSecondThreshold" className="block text-xs font-medium text-muted-foreground mb-1.5">
Tokens/sec threshold <span className="text-muted-foreground/60">(scale out when average drops below)</span>
Expand Down
Loading