3 SPDX-License-Identifier: APACHE-2.0
6 {{/* vim: set filetype=mustache: */}}
8 Warning about using rolling tag.
10 {{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
12 {{- define "common.warnings.rollingTag" -}}
14 {{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }}
15 WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
16 +info https://docs.bitnami.com/tutorials/understand-rolling-tags-containers
21 Warning about not setting the resource object in all deployments.
23 {{ include "common.warnings.resources" (dict "sections" (list "path1" "path2") context $) }}
25 {{- include "common.warnings.resources" (dict "sections" (list "csiProvider.provider" "server" "volumePermissions" "") "context" $) }}
26 The list in the example assumes that the following values exist:
27 - csiProvider.provider.resources
29 - volumePermissions.resources
32 {{- define "common.warnings.resources" -}}
33 {{- $values := .context.Values -}}
34 {{- $printMessage := false -}}
35 {{ $affectedSections := list -}}
36 {{- range .sections -}}
38 {{/* Case where the resources section is at the root (one main deployment in the chart) */}}
39 {{- if not (index $values "resources") -}}
40 {{- $affectedSections = append $affectedSections "resources" -}}
41 {{- $printMessage = true -}}
44 {{/* Case where the are multiple resources sections (more than one main deployment in the chart) */}}
45 {{- $keys := split "." . -}}
46 {{/* We iterate through the different levels until arriving to the resource section. Example: a.b.c.resources */}}
47 {{- $section := $values -}}
49 {{- $section = index $section . -}}
51 {{- if not (index $section "resources") -}}
52 {{/* If the section has enabled=false or replicaCount=0, do not include it */}}
53 {{- if and (hasKey $section "enabled") -}}
54 {{- if index $section "enabled" -}}
55 {{/* enabled=true */}}
56 {{- $affectedSections = append $affectedSections (printf "%s.resources" .) -}}
57 {{- $printMessage = true -}}
59 {{- else if and (hasKey $section "replicaCount") -}}
60 {{/* We need a casting to int because number 0 is not treated as an int by default */}}
61 {{- if (gt (index $section "replicaCount" | int) 0) -}}
62 {{/* replicaCount > 0 */}}
63 {{- $affectedSections = append $affectedSections (printf "%s.resources" .) -}}
64 {{- $printMessage = true -}}
67 {{/* Default case, add it to the affected sections */}}
68 {{- $affectedSections = append $affectedSections (printf "%s.resources" .) -}}
69 {{- $printMessage = true -}}
74 {{- if $printMessage }}
76 WARNING: There are "resources" sections in the chart not set. Using "resourcesPreset" is not recommended for production. For production installations, please set the following values according to your workload needs:
77 {{- range $affectedSections }}
80 +info https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/