Merge pull request #1444 from matejhasul/mhs-sidecar

[bitnami/mariadb-galera] Allow to set additional containers
This commit is contained in:
Juan Ariza Toledano
2019-10-03 13:39:59 +02:00
committed by GitHub
5 changed files with 45 additions and 6 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: mariadb-galera
version: 0.2.8
version: 0.3.0
appVersion: 10.3.18
description: MariaDB Galera is a multi-master database cluster solution for synchronous replication and high availability.
keywords:
+32 -2
View File
@@ -127,7 +127,8 @@ The following table lists the configurable parameters of the MariaDB Galera char
| `persistence.storageClass` | Persistent Volume Storage Class | `nil` |
| `persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
| `persistence.size` | Persistent Volume Size | `8Gi` |
| `extraInitContainers` | Additional init containers (this value is evaluated as a template) | `nil` |
| `extraInitContainers` | Additional init containers (this value is evaluated as a template) | `[]` |
| `extraContainers` | Additional containers (this value is evaluated as a template) | `[]` |
| `resources` | CPU/Memory resource requests/limits for node | `{}` |
| `livenessProbe.enabled` | Turn on and off liveness probe | `true` |
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `120` |
@@ -269,7 +270,7 @@ The chart mounts a [Persistent Volume](kubernetes.io/docs/user-guide/persistent-
The feature allows for specifying a template string for a initContainer in the pod. Usecases include situations when you need some pre-run setup. For example, in IKS (IBM Cloud Kubernetes Service), non-root users do not have write permission on the volume mount path for NFS-powered file storage. So, you could use a initcontainer to `chown` the mount. See a example below, where we add an initContainer on the pod that reports to an external resource that the db is going to starting.
`values.yaml`
```yaml
extraInitContainers: |
extraInitContainers:
- name: initcontainer
image: bitnami/minideb:stretch
command: ["/bin/sh", "-c"]
@@ -277,6 +278,35 @@ extraInitContainers: |
- install_packages curl && curl http://api-service.local/db/starting;
```
## Extra Containers
The feature allows for specifying additional containers in the pod. Usecases include situations when you need to run some sidecar containers. For example, you can observe if mysql in pod is running and report to some service discovery software like eureka. Example:
`values.yaml`
```yaml
extraContainers:
- name: '{{ .Chart.Name }}-eureka-sidecar'
image: 'image:tag'
env:
- name: SERVICE_NAME
value: '{{ template "mariadb-galera.fullname" . }}'
- name: EUREKA_APP_NAME
value: '{{ template "mariadb-galera.name" . }}'
- name: MARIADB_USER
value: '{{ .Values.db.user }}'
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
name: '{{ template "mariadb-galera.fullname" . }}'
key: mariadb-password
resources:
limits:
cpu: 100m
memory: 20Mi
requests:
cpu: 50m
memory: 10Mi
```
## Upgrading
It's necessary to specify the existing passwords while performing a upgrade to ensure the secrets are not updated with invalid randomly generated passwords. Remember to specify the existing values of the `rootUser.password`, `db.password` and `galera.mariabackup.password` parameters when upgrading the chart:
@@ -76,7 +76,7 @@ spec:
{{- include "mariadb-galera.imagePullSecrets" . | indent 6 }}
{{- if .Values.extraInitContainers }}
initContainers:
{{ tpl .Values.extraInitContainers . | indent 6}}
{{ tpl (toYaml .Values.extraInitContainers) . | indent 6 }}
{{- end }}
containers:
- name: "mariadb-galera"
@@ -239,6 +239,9 @@ spec:
timeoutSeconds: 1
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
{{- if .Values.extraContainers }}
{{ tpl (toYaml .Values.extraContainers) . | indent 6 }}
{{- end }}
volumes:
{{- if or (.Files.Glob "files/my.cnf") .Values.mariadbConfiguration .Values.configurationConfigMap }}
@@ -361,11 +361,14 @@ persistence:
## Additional init containers
##
# extraInitContainers: |
extraInitContainers: []
# - name: do-something
# image: bitnami/minideb:stretch
# command: ['do', 'something']
## Additional containers
##
extraContainers: []
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
+4 -1
View File
@@ -361,11 +361,14 @@ persistence:
## Additional init containers
##
# extraInitContainers: |
extraInitContainers: []
# - name: do-something
# image: bitnami/minideb:stretch
# command: ['do', 'something']
## Additional containers
##
extraContainers: []
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/