From 5596247f3fff381b5d29fe16cd94a1589b11e59e Mon Sep 17 00:00:00 2001 From: Georg Kunz Date: Sat, 1 Jun 2019 00:24:19 +0200 Subject: [PATCH] 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 --- .../snippets/_kubernetes_resources.tpl | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/helm-toolkit/templates/snippets/_kubernetes_resources.tpl b/helm-toolkit/templates/snippets/_kubernetes_resources.tpl index 7797c8ed8..a2b3feaa3 100644 --- a/helm-toolkit/templates/snippets/_kubernetes_resources.tpl +++ b/helm-toolkit/templates/snippets/_kubernetes_resources.tpl @@ -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 -}}