+
{filteredRollouts.length}
diff --git a/ui/frontend/src/lib/components/projects/SideNav.svelte b/ui/frontend/src/lib/components/projects/SideNav.svelte
index 1907242f..ec1b5ef0 100644
--- a/ui/frontend/src/lib/components/projects/SideNav.svelte
+++ b/ui/frontend/src/lib/components/projects/SideNav.svelte
@@ -1,15 +1,12 @@
+
+
+
diff --git a/ui/frontend/src/lib/components/scale/MemorySettings.svelte b/ui/frontend/src/lib/components/scale/MemorySettings.svelte
new file mode 100644
index 00000000..d99a2950
--- /dev/null
+++ b/ui/frontend/src/lib/components/scale/MemorySettings.svelte
@@ -0,0 +1,65 @@
+
+
+
+
diff --git a/ui/frontend/src/lib/components/scale/ScaleSettings.svelte b/ui/frontend/src/lib/components/scale/ScaleSettings.svelte
index d9623dce..3d67d278 100644
--- a/ui/frontend/src/lib/components/scale/ScaleSettings.svelte
+++ b/ui/frontend/src/lib/components/scale/ScaleSettings.svelte
@@ -3,9 +3,11 @@
import { client } from "$lib/pocketbase";
import type { RolloutsRecord, RolloutsResponse } from "$lib/pocketbase/generated-types";
import { type Rexpand, rollouts, updateDataStores, UpdateFilterEnum } from "$lib/stores/data";
- import { Button, Heading, Input, Label, P } from "flowbite-svelte";
+ import { Badge, Button, Heading, Input, Label, P, Radio, Range } from "flowbite-svelte";
import selectedProjectId from "$lib/stores/project";
import toast from "svelte-french-toast";
+ import CpuSettings from "./CPUSettings.svelte";
+ import MemorySettings from "./MemorySettings.svelte";
let current_rollout: RolloutsResponse
| undefined;
let lastUpdatedRollout: RolloutsResponse | undefined;
@@ -15,13 +17,7 @@
let maxInstances: number = 1;
let targetCPUUtilizationPercentage: number = 80;
- let cpuLimits: string = "200m";
- let cpuLimitsFloat: number = 0.2;
- let memoryLimits: string = "256Mi";
- let memoryLimitsInt: number = 256;
- let cpuRequests: string = "100m";
let cpuRequestsFloat: number = 0.1;
- let memoryRequests: string = "128Mi";
let memoryRequestsInt: number = 128;
function convertFloatToCpuString(value: number): string {
@@ -64,14 +60,12 @@
targetCPUUtilizationPercentage =
current_rollout.manifest?.spec.horizontalScale.targetCPUUtilizationPercentage ?? 80;
lastUpdatedRollout = current_rollout;
- cpuLimits = current_rollout.manifest?.spec.resources?.limits?.cpu ?? "200m";
- memoryLimits = current_rollout.manifest?.spec.resources?.limits?.memory ?? "256Mi";
- cpuRequests = current_rollout.manifest?.spec.resources?.requests?.cpu ?? "100m";
- memoryRequests = current_rollout.manifest?.spec.resources?.requests?.memory ?? "128Mi";
- cpuLimitsFloat = convertCpuStringToFloat(cpuLimits);
- memoryLimitsInt = parseInt(memoryLimits.replace("Mi", ""));
- cpuRequestsFloat = convertCpuStringToFloat(cpuRequests);
- memoryRequestsInt = parseInt(memoryRequests.replace("Mi", ""));
+ cpuRequestsFloat = convertCpuStringToFloat(
+ current_rollout.manifest?.spec.resources?.requests?.cpu ?? "0m"
+ );
+ memoryRequestsInt = parseInt(
+ current_rollout.manifest?.spec.resources?.requests?.memory?.replace("Mi", "") ?? "0"
+ );
}
hadRolloutsOnLastPage = true;
@@ -96,12 +90,6 @@
minInstances = 1;
maxInstances = 1;
targetCPUUtilizationPercentage = 80;
- cpuLimits = "200m";
- memoryLimits = "256Mi";
- cpuRequests = "100m";
- memoryRequests = "128Mi";
- cpuLimitsFloat = 0.2;
- memoryLimitsInt = 256;
cpuRequestsFloat = 0.1;
memoryRequestsInt = 128;
}
@@ -111,14 +99,12 @@
maxInstances = current_rollout?.manifest?.spec.horizontalScale.maxReplicas ?? 1;
targetCPUUtilizationPercentage =
current_rollout?.manifest?.spec.horizontalScale.targetCPUUtilizationPercentage ?? 80;
- cpuLimits = current_rollout?.manifest?.spec.resources?.limits?.cpu ?? "200m";
- memoryLimits = current_rollout?.manifest?.spec.resources?.limits?.memory ?? "256Mi";
- cpuRequests = current_rollout?.manifest?.spec.resources?.requests?.cpu ?? "100m";
- memoryRequests = current_rollout?.manifest?.spec.resources?.requests?.memory ?? "128Mi";
- cpuLimitsFloat = convertCpuStringToFloat(cpuLimits);
- memoryLimitsInt = parseInt(memoryLimits.replace("Mi", ""));
- cpuRequestsFloat = convertCpuStringToFloat(cpuRequests);
- memoryRequestsInt = parseInt(memoryRequests.replace("Mi", ""));
+ cpuRequestsFloat = convertCpuStringToFloat(
+ current_rollout?.manifest?.spec.resources?.requests?.cpu ?? "0m"
+ );
+ memoryRequestsInt = parseInt(
+ current_rollout?.manifest?.spec.resources?.requests?.memory?.replace("Mi", "") ?? "0"
+ );
}
function handleInputChange(event: any, field: any) {
@@ -132,18 +118,6 @@
case "targetCPUUtilizationPercentage":
targetCPUUtilizationPercentage = event.target.value;
break;
- case "cpuLimits":
- cpuLimits = event.target.value;
- break;
- case "memoryLimits":
- memoryLimits = event.target.value;
- break;
- case "cpuRequests":
- cpuRequests = event.target.value;
- break;
- case "memoryRequests":
- memoryRequests = event.target.value;
- break;
}
}
@@ -169,16 +143,6 @@
return;
}
- if (cpuLimitsFloat <= 0) {
- toast.error("CPU limits must be greater than 0.");
- return;
- }
-
- if (memoryLimitsInt <= 0) {
- toast.error("Memory limits must be greater than 0.");
- return;
- }
-
if (cpuRequestsFloat <= 0) {
toast.error("CPU requests must be greater than 0.");
return;
@@ -189,16 +153,6 @@
return;
}
- if (cpuLimitsFloat < cpuRequestsFloat) {
- toast.error("CPU limits must be greater or equal than CPU requests.");
- return;
- }
-
- if (memoryLimitsInt < memoryRequestsInt) {
- toast.error("Memory limits must be greater or equal than memory requests.");
- return;
- }
-
const new_manifest = {
...current_rollout.manifest,
spec: {
@@ -211,8 +165,8 @@
},
resources: {
limits: {
- cpu: convertFloatToCpuString(cpuLimitsFloat),
- memory: `${memoryLimitsInt}Mi`
+ cpu: convertFloatToCpuString(cpuRequestsFloat),
+ memory: `${memoryRequestsInt}Mi`
},
requests: {
cpu: convertFloatToCpuString(cpuRequestsFloat),
@@ -321,20 +275,30 @@
-
+
+ {targetCPUUtilizationPercentage}%
+
+
+
+ handleInputChange(e, "targetCPUUtilizationPercentage")}
- placeholder="1"
- class="
- {targetCPUUtilizationPercentage < 40 ? 'border-red-500' : 'border-green-500'}
- "
+ min="1"
+ max="100"
+ step="1"
/>
|
@@ -363,7 +327,10 @@