From 193b1d810306636de5f2f309f8c4578f3c295fcd Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 21 Feb 2024 18:31:04 -0500 Subject: [PATCH] fix: set lower cpu/memory requests --- docs/deployment/schedulers/k3s.md | 16 ++++------------ plugins/scheduler-k3s/functions.go | 9 +++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/docs/deployment/schedulers/k3s.md b/docs/deployment/schedulers/k3s.md index f21315f53..573a2eb2d 100644 --- a/docs/deployment/schedulers/k3s.md +++ b/docs/deployment/schedulers/k3s.md @@ -361,20 +361,12 @@ App logs for the `logs` command are fetched by Dokku from running containers via ### Supported Resource Management Properties -The `k3s` scheduler supports a minimal list of resource _limits_ and _reservations_. The following properties are supported: - -#### Resource Limits - -> [!NOTE] -> Cron tasks retrieve resource limits based on the computed cron task ID. If unspecified, the default will be 1 CPU and 512m RAM. +The `k3s` scheduler supports a minimal list of resource _limits_ and _reservations_: - cpu: is specified in number of CPUs a process can access. -- memory: should be specified with a suffix of `b` (bytes), `k` (kilobytes), `m` (megabytes), `g` (gigabytes). Default unit is `m` (megabytes). +- memory: should be specified with a suffix of `b` (bytes), `Ki` (kilobytes), `Mi` (megabytes), `Gi` (gigabytes). Default unit is `Mi` (megabytes). -#### Resource Reservations +If unspecified for any task, the default reservation will be .1 CPU and 128Mi RAM, with no limit set for either CPU or RAM. This is to avoid issues with overscheduling pods on a cluster. To avoid issues, set more specific values for at least resource reservations. > [!NOTE] -> Cron tasks retrieve resource reservations based on the computed cron task ID. If unspecified, the default will be 1 CPU and 512m RAM. - -- cpu: is specified in number of CPUs a process can access. -- memory: should be specified with a suffix of `b` (bytes), `k` (kilobytes), `m` (megabytes), `g` (gigabytes). Default unit is `m` (megabytes). +> Cron tasks retrieve resource limits based on the computed cron task ID. diff --git a/plugins/scheduler-k3s/functions.go b/plugins/scheduler-k3s/functions.go index e2756cf23..4c8b17355 100644 --- a/plugins/scheduler-k3s/functions.go +++ b/plugins/scheduler-k3s/functions.go @@ -824,13 +824,10 @@ func getProcessHealtchecks(healthchecks []appjson.Healthcheck, primaryPort int32 func getProcessResources(appName string, processType string) (ProcessResourcesMap, error) { processResources := ProcessResourcesMap{ - Limits: ProcessResources{ - CPU: "1000m", - Memory: "512Mi", - }, + Limits: ProcessResources{}, Requests: ProcessResources{ - CPU: "1000m", - Memory: "512Mi", + CPU: "100m", + Memory: "128Mi", }, }