From 300efaf0a0a198f8e5112815365c67b1868e4ae2 Mon Sep 17 00:00:00 2001 From: pat-s Date: Fri, 20 Dec 2024 18:15:17 +0100 Subject: [PATCH] make fallbacks more granular --- charts/rstudio-connect/files/job.tpl | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/charts/rstudio-connect/files/job.tpl b/charts/rstudio-connect/files/job.tpl index 06139448..417e982b 100644 --- a/charts/rstudio-connect/files/job.tpl +++ b/charts/rstudio-connect/files/job.tpl @@ -267,18 +267,32 @@ spec: {{- end }} {{- end }} {{- end }} - {{- if any (ne (len $requests) 0) (ne (len $limits) 0) }} + {{- if or (ne (len $requests) 0) (ne (len $limits) 0) }} resources: {{- if ne (len $requests) 0 }} requests: - {{- range $key, $val := $requests }} - {{ $key }}: {{ toYaml $val }} + {{- if $requests.cpu }} + cpu: {{ $requests.cpu }} + {{- else }} + cpu: 500m + {{- end }} + {{- if $requests.memory }} + memory: {{ $requests.memory }} + {{- else }} + memory: 1Gi {{- end }} {{- end }} {{- if ne (len $limits) 0 }} limits: - {{- range $key, $val := $limits }} - {{ $key }}: {{ toYaml $val }} + {{- if $limits.cpu }} + cpu: {{ $limits.cpu }} + {{- else }} + cpu: 500m + {{- end }} + {{- if $limits.memory }} + memory: {{ $limits.memory }} + {{- else }} + memory: 1Gi {{- end }} {{- end }} {{- else }}