1 # Bitnami Common Library Chart
3 A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts.
11 repository: https://charts.bitnami.com/bitnami
15 $ helm dependency update
22 name: {{ include "common.names.fullname" . }}
24 myvalue: "Hello World"
29 This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
31 Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of [Bitnami Kubernetes Production Runtime](https://kubeprod.io/) (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.
36 - Helm 2.12+ or Helm 3.0-beta3+
40 The following table lists the helpers available in the library which are scoped in different sections.
44 | Helper identifier | Description | Expected Input |
45 |-------------------------------------|-----------------------------------------------------------------|------------------------------------------------------------------|
46 | `common.affinities.node.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
47 | `common.affinities.node.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` |
48 | `common.affinities.pod.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
49 | `common.affinities.pod.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` |
53 | Helper identifier | Description | Expected Input |
54 |------------------------------------------------|-----------------------------------------------------------------|----------------------------|
55 | `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context |
56 | `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context |
57 | `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context |
61 | Helper identifier | Description | Expected Input |
62 |------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
63 | `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` |
67 | Helper identifier | Description | Expected Input |
68 |--------------------------------|-----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
69 | `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. |
70 | `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` |
74 | Helper identifier | Description | Expected Input |
75 |--------------------------------|-----------------------------------------------------------------|-----------------------------|
76 | `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context |
77 | `common.labels.matchLabels` | Return the proper Docker Image Registry Secret Names | `.` Chart context |
81 | Helper identifier | Description | Expected Inpput |
82 |--------------------------------|-----------------------------------------------------------------|-----------------------------|
83 | `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context |
84 | `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context |
85 | `common.names.chart` | Chart name plus version | `.` Chart context |
89 | Helper identifier | Description | Expected Input |
90 |--------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
91 | `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. |
92 | `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. |
96 | Helper identifier | Description | Expected Input |
97 |--------------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
98 | `common.affinities.node.soft` | Return a soft nodeAffinity definition | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. |
102 | Helper identifier | Description | Expected Input |
103 |--------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
104 | `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frecuently is the chart context `$` or `.` |
108 | Helper identifier | Description | Expected Input |
109 |--------------------------------|-----------------------------------------------------------------|------------------------------------------------------------------------|
110 | `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` |
111 | `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` |
112 | `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` |
116 | Helper identifier | Description | Expected Input |
117 |--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
118 | `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "context" $` secret and field are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) |
119 | `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) |
120 | `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. |
121 | `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. |
125 | Helper identifier | Description | Expected Input |
126 |--------------------------------|-----------------------------------------------------------------|------------------------------------------------------------------|
127 | `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. |
129 ## Special input schemas
136 description: Docker registry where the image is located
141 description: Repository and image name
142 example: bitnami/nginx
146 description: image tag
147 example: 1.16.1-debian-10-r63
151 description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
157 description: Optionally specify an array of imagePullSecrets.
161 description: Set to true if you would like to see extra information on logs
164 ## An instance would be:
165 # registry: docker.io
166 # repository: bitnami/nginx
167 # tag: 1.16.1-debian-10-r63
168 # pullPolicy: IfNotPresent
177 description: Whether enable persistence.
182 description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
187 description: Access mode for the Persistent Volume Storage.
188 example: ReadWriteOnce
192 description: Size the Persistent Volume Storage.
197 description: Path to be persisted.
200 ## An instance would be:
203 # accessMode: ReadWriteOnce
213 description: Name of the existing secret.
216 description: Mapping between the expected key name and the name of the key in the existing secret.
219 ## An instance would be:
222 # password: myPasswordKey
227 When we store sensitive data for a deployment in a secret, some times we want to give to users the possiblity of using theirs existing secrets.
230 # templates/secret.yaml
235 name: {{ include "common.names.fullname" . }}
237 app: {{ include "common.names.fullname" . }}
240 password: {{ .Values.password | b64enc | quote }}
249 name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
250 key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
257 password: myPasswordKey
265 {{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
266 {{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
268 {{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
271 If we force those values to be empty we will see some alerts
274 $ helm install test mychart --set path.to.value00="",path.to.value01=""
275 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
277 export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 --decode)
279 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
281 export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 --decode)