openstack-helm-infra/helm-toolkit/templates/snippets/_kubernetes_resources.tpl
Georg Kunz 5596247f3f 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
2019-06-05 11:37:43 +02:00

56 lines
1.4 KiB
Smarty

{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{/*
Note: This function is deprecated and will be removed in the future.
abstract: |
Renders kubernetes resource limits for pods
values: |
pod:
resources:
enabled: true
api:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
hugepages-1Gi: "1Gi"
usage: |
{{ include "helm-toolkit.snippets.kubernetes_resources" ( tuple . .Values.pod.resources.api ) }}
return: |
resources:
limits:
cpu: "2000m"
memory: "1024Mi"
hugepages-1Gi: "1Gi"
requests:
cpu: "100m"
memory: "128Mi
*/}}
{{- define "helm-toolkit.snippets.kubernetes_resources" -}}
{{- $envAll := index . 0 -}}
{{- $component := index . 1 -}}
{{- if $envAll.Values.pod.resources.enabled -}}
resources:
{{ toYaml $component | trim | indent 2 }}
{{- end -}}
{{- end -}}