Enable hugepage support in HTK resources snippet

This patch simplifies the resource snippet in helm-toolkit to allow for
specifying hugepage limits. Specifically, this patch replaces the
individual checks for specific system resources (e.g., cpu, memory) by
just copying over the entire resource component as defined in a
values.yaml or a corresponding overwrite.

This change is a prerequisite for enable hugepage handling in other
charts such as openvswitch or postgresql.

Change-Id: I786ff6c7aa5fb6b08b54d2e21878551e5e1e3818
This commit is contained in:
Georg Kunz 2019-06-01 00:24:19 +02:00
parent b7f0fd8dff
commit 5596247f3f
1 changed files with 5 additions and 18 deletions

View File

@ -15,6 +15,8 @@ limitations under the License.
*/}}
{{/*
Note: This function is deprecated and will be removed in the future.
abstract: |
Renders kubernetes resource limits for pods
values: |
@ -28,6 +30,7 @@ values: |
limits:
memory: "1024Mi"
cpu: "2000m"
hugepages-1Gi: "1Gi"
usage: |
{{ include "helm-toolkit.snippets.kubernetes_resources" ( tuple . .Values.pod.resources.api ) }}
@ -36,6 +39,7 @@ return: |
limits:
cpu: "2000m"
memory: "1024Mi"
hugepages-1Gi: "1Gi"
requests:
cpu: "100m"
memory: "128Mi
@ -46,23 +50,6 @@ return: |
{{- $component := index . 1 -}}
{{- if $envAll.Values.pod.resources.enabled -}}
resources:
{{- if or $component.limits.cpu $component.limits.memory }}
limits:
{{- if $component.limits.cpu }}
cpu: {{ $component.limits.cpu | quote }}
{{- end }}
{{- if $component.limits.memory }}
memory: {{ $component.limits.memory | quote }}
{{- end }}
{{- end }}
{{- if or $component.requests.cpu $component.requests.memory }}
requests:
{{- if $component.requests.cpu }}
cpu: {{ $component.requests.cpu | quote }}
{{- end }}
{{- if $component.requests.memory }}
memory: {{ $component.requests.memory | quote }}
{{- end }}
{{- end }}
{{ toYaml $component | trim | indent 2 }}
{{- end -}}
{{- end -}}