[stable/mysql] Accept custom mysql config files (#1723)

* [stable/mysql] Accept custom mysql config files

* Fixed documentation
This commit is contained in:
Fábio Maia
2017-08-15 09:08:35 -05:00
committed by Michael Goodness
parent fe072f4e69
commit eddcd3618b
5 changed files with 43 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: mysql
version: 0.2.7
version: 0.2.8
description: Fast, reliable, scalable, and easy to use open-source relational database system.
keywords:
- mysql
+16
View File
@@ -59,6 +59,7 @@ The following tables lists the configurable parameters of the MySQL chart and th
| `persistence.existingClaim`| Name of existing persistent volume | `nil`
| `persistence.subPath` | Subdirectory of the volume to mount | `nil`
| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` |
| `configurationFiles` | List of mysql configuration files | `nil`
Some of the parameters above map to the env variables defined in the [MySQL DockerHub image](https://hub.docker.com/_/mysql/).
@@ -88,3 +89,18 @@ By default a PersistentVolumeClaim is created and mounted into that directory. I
you can change the values.yaml to disable persistence and use an emptyDir instead.
> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."*
## Custom MySQL configuration files
The [MySQL](https://hub.docker.com/_/mysql/) image accepts custom configuration files at the path `/etc/mysql/conf.d`. If you want to use a customized MySQL configuration, you can create your alternative configuration files by passing the file contents on the `configurationFiles` attribute. Note that according to the MySQL documentation only files ending with `.cfn` are loaded.
```yaml
configurationFiles:
mysql.cnf: |-
[mysqld]
skip-host-cache
skip-name-resolve
sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
mysql_custom.cnf: |-
[mysqld]
```
+11
View File
@@ -0,0 +1,11 @@
{{- if .Values.configurationFiles }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}
data:
{{- range $key, $val := .Values.configurationFiles }}
{{ $key }}: |-
{{ $val | indent 4}}
{{- end }}
{{- end -}}
+9
View File
@@ -92,7 +92,16 @@ spec:
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- end }}
{{- if .Values.configurationFiles }}
- name: configurations
mountPath: /etc/mysql/conf.d
{{- end }}
volumes:
{{- if .Values.configurationFiles }}
- name: configurations
configMap:
name: {{ template "fullname" . }}
{{- end }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
+6
View File
@@ -45,3 +45,9 @@ resources:
requests:
memory: 256Mi
cpu: 100m
# Custom mysql configuration files used to override default mysql settings
configurationFiles:
# mysql.cnf: |-
# [mysqld]
# skip-name-resolve