diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 2873cf808..572535e19 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -215,7 +215,7 @@ jobs: --set reloader.deployment.resources.limits.cpu=150m \ --set reloader.deployment.resources.limits.memory=512Mi \ --set reloader.deployment.resources.requests.cpu=10m \ - --set reloader.deployment.resources.requests.memory=128Mi > deployments/kubernetes/reloader.yaml + --set reloader.deployment.resources.requests.memory=512Mi > deployments/kubernetes/reloader.yaml helm template reloader deployments/kubernetes/chart/reloader/ --output-dir deployments/kubernetes/manifests && mv deployments/kubernetes/manifests/reloader/templates/* deployments/kubernetes/manifests/ && rm -r deployments/kubernetes/manifests/reloader diff --git a/deployments/kubernetes/chart/reloader/templates/_helpers.tpl b/deployments/kubernetes/chart/reloader/templates/_helpers.tpl index 04b3ee4d8..238eb43d8 100644 --- a/deployments/kubernetes/chart/reloader/templates/_helpers.tpl +++ b/deployments/kubernetes/chart/reloader/templates/_helpers.tpl @@ -63,3 +63,23 @@ Create the annotations to support helm3 meta.helm.sh/release-namespace: {{ .Release.Namespace | quote }} meta.helm.sh/release-name: {{ .Release.Name | quote }} {{- end -}} + +{{- define "reloader-convertCpuResourceToCores" -}} +{{- $coresf := . -}} +{{- if hasSuffix "m" . -}} +{{- $milicores := trimSuffix "m" . -}} +{{- $coresf = divf $milicores 1000.0 -}} +{{- end -}} +{{- ceil $coresf -}} +{{- end -}} + +{{- define "reloader-convertMemResourceToMi" -}} +{{- $mibis := trimSuffix "Mi" . -}} +{{- if hasSuffix "Ki" . -}} +{{- $kilobytes := trimSuffix "Ki" . -}} +{{- $mibis = divf $kilobytes 1024.0 | ceil -}} +{{- else if hasSuffix "Gi" . -}} +{{- $mibis = trimSuffix "Gi" . | mulf 1024.0 | ceil -}} +{{- end -}} +{{- $mibis -}}Mi +{{- end -}} diff --git a/deployments/kubernetes/chart/reloader/templates/deployment.yaml b/deployments/kubernetes/chart/reloader/templates/deployment.yaml index dca675074..40278ea85 100644 --- a/deployments/kubernetes/chart/reloader/templates/deployment.yaml +++ b/deployments/kubernetes/chart/reloader/templates/deployment.yaml @@ -76,8 +76,17 @@ spec: - image: "{{ .Values.reloader.deployment.image.name }}:{{ .Values.reloader.deployment.image.tag }}" imagePullPolicy: {{ .Values.reloader.deployment.image.pullPolicy }} name: {{ template "reloader-fullname" . }} - {{- if or (.Values.reloader.deployment.env.open) (.Values.reloader.deployment.env.secret) (.Values.reloader.deployment.env.field) (.Values.reloader.deployment.env.existing) (eq .Values.reloader.watchGlobally false) (.Values.reloader.enableHA) (.Values.reloader.enableMetricsByNamespace)}} env: + {{- with .Values.reloader.deployment.resources.limits }} + {{- with .cpu }} + - name: GOMAXPROCS + value: {{ include "reloader-convertCpuResourceToCores" . | quote }} + {{- end }} + {{- with .memory }} + - name: GOMEMLIMIT + value: {{ include "reloader-convertMemResourceToMi" . }}B + {{- end }} + {{- end }} {{- range $name, $value := .Values.reloader.deployment.env.open }} {{- if not (empty $value) }} - name: {{ $name | quote }} @@ -112,7 +121,6 @@ spec: fieldRef: fieldPath: {{ $value | quote}} {{- end }} - {{- end }} {{- if eq .Values.reloader.watchGlobally false }} - name: KUBERNETES_NAMESPACE valueFrom: