blob: 72fca33da155e1973c19da18e46d7df81feff6d0 [file] [log] [blame] [view]
Giorgi Lekveishvili8c99d622023-05-30 14:40:50 +04001# Bitnami Common Library Chart
2
3A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between Bitnami charts.
4
5Looking to use our applications in production? Try [VMware Application Catalog](https://bitnami.com/enterprise), the enterprise edition of Bitnami Application Catalog.
6
7## TL;DR
8
9```yaml
10dependencies:
11 - name: common
12 version: 1.x.x
13 repository: oci://registry-1.docker.io/bitnamicharts
14```
15
16```console
17helm dependency update
18```
19
20```yaml
21apiVersion: v1
22kind: ConfigMap
23metadata:
24 name: {{ include "common.names.fullname" . }}
25data:
26 myvalue: "Hello World"
27```
28
29## Introduction
30
31This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
32
33Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters.
34
35## Prerequisites
36
37- Kubernetes 1.19+
38- Helm 3.2.0+
39
40## Parameters
41
42## Special input schemas
43
44### ImageRoot
45
46```yaml
47registry:
48 type: string
49 description: Docker registry where the image is located
50 example: docker.io
51
52repository:
53 type: string
54 description: Repository and image name
55 example: bitnami/nginx
56
57tag:
58 type: string
59 description: image tag
60 example: 1.16.1-debian-10-r63
61
62pullPolicy:
63 type: string
64 description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
65
66pullSecrets:
67 type: array
68 items:
69 type: string
70 description: Optionally specify an array of imagePullSecrets (evaluated as templates).
71
72debug:
73 type: boolean
74 description: Set to true if you would like to see extra information on logs
75 example: false
76
77## An instance would be:
78# registry: docker.io
79# repository: bitnami/nginx
80# tag: 1.16.1-debian-10-r63
81# pullPolicy: IfNotPresent
82# debug: false
83```
84
85### Persistence
86
87```yaml
88enabled:
89 type: boolean
90 description: Whether enable persistence.
91 example: true
92
93storageClass:
94 type: string
95 description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
96 example: "-"
97
98accessMode:
99 type: string
100 description: Access mode for the Persistent Volume Storage.
101 example: ReadWriteOnce
102
103size:
104 type: string
105 description: Size the Persistent Volume Storage.
106 example: 8Gi
107
108path:
109 type: string
110 description: Path to be persisted.
111 example: /bitnami
112
113## An instance would be:
114# enabled: true
115# storageClass: "-"
116# accessMode: ReadWriteOnce
117# size: 8Gi
118# path: /bitnami
119```
120
121### ExistingSecret
122
123```yaml
124name:
125 type: string
126 description: Name of the existing secret.
127 example: mySecret
128keyMapping:
129 description: Mapping between the expected key name and the name of the key in the existing secret.
130 type: object
131
132## An instance would be:
133# name: mySecret
134# keyMapping:
135# password: myPasswordKey
136```
137
138#### Example of use
139
140When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets.
141
142```yaml
143# templates/secret.yaml
144---
145apiVersion: v1
146kind: Secret
147metadata:
148 name: {{ include "common.names.fullname" . }}
149 labels:
150 app: {{ include "common.names.fullname" . }}
151type: Opaque
152data:
153 password: {{ .Values.password | b64enc | quote }}
154
155# templates/dpl.yaml
156---
157...
158 env:
159 - name: PASSWORD
160 valueFrom:
161 secretKeyRef:
162 name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
163 key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
164...
165
166# values.yaml
167---
168name: mySecret
169keyMapping:
170 password: myPasswordKey
171```
172
173### ValidateValue
174
175#### NOTES.txt
176
177```console
178{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
179{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
180
181{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
182```
183
184If we force those values to be empty we will see some alerts
185
186```console
187helm install test mychart --set path.to.value00="",path.to.value01=""
188 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
189
190 export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d)
191
192 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
193
194 export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d)
195```
196
197## Upgrading
198
199### To 1.0.0
200
201[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
202
203#### What changes were introduced in this major version?
204
205- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field.
206- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information.
207- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
208
209#### Considerations when upgrading to this version
210
211- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues
212- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore
213- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3
214
215#### Useful links
216
217- <https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/>
218- <https://helm.sh/docs/topics/v2_v3_migration/>
219- <https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/>
220
221## License
222
223Copyright &copy; 2023 Bitnami
224
225Licensed under the Apache License, Version 2.0 (the "License");
226you may not use this file except in compliance with the License.
227You may obtain a copy of the License at
228
229<http://www.apache.org/licenses/LICENSE-2.0>
230
231Unless required by applicable law or agreed to in writing, software
232distributed under the License is distributed on an "AS IS" BASIS,
233WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
234See the License for the specific language governing permissions and
235limitations under the License.