entur / helm-charts

0 stars 3 forks source link

Make use of `mulf` et. al #5

Closed AlexanderBrevig closed 7 months ago

AlexanderBrevig commented 2 years ago

Currently the implementation in #3 used a workaround for programmatically setting default limits for CPU and memory.

Instead of an if checking cpuLimit and then doing this abomination: cpu: "{{ .Values.container.cpu | toString | replace "." "" | int64 | mul 500 }}m"

We should be able to do this: cpu: {{ .Values.container.cpuLimit | default (mulf .Values.container.cpu * 5) }}

Here's the breakdown of what my hack does: 0.1 -> "0.1" -> "01" -> 1 -> 500 -> "500m". Oh joy...

We are currently blocked by Harness (waiting for 3.8 to be enabled by feature flag) and by https://github.com/vbehar/helm3-unittest/pull/11.