diff --git a/stable/mysql/Chart.yaml b/stable/mysql/Chart.yaml index bed3fca583..3ab0a40a8d 100644 --- a/stable/mysql/Chart.yaml +++ b/stable/mysql/Chart.yaml @@ -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 diff --git a/stable/mysql/README.md b/stable/mysql/README.md index 66e2c7f8f7..7d7b4528c9 100644 --- a/stable/mysql/README.md +++ b/stable/mysql/README.md @@ -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] +``` diff --git a/stable/mysql/templates/configmap.yaml b/stable/mysql/templates/configmap.yaml new file mode 100644 index 0000000000..e412faa104 --- /dev/null +++ b/stable/mysql/templates/configmap.yaml @@ -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 -}} \ No newline at end of file diff --git a/stable/mysql/templates/deployment.yaml b/stable/mysql/templates/deployment.yaml index 4ab8c7d631..36d4f9773c 100644 --- a/stable/mysql/templates/deployment.yaml +++ b/stable/mysql/templates/deployment.yaml @@ -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: diff --git a/stable/mysql/values.yaml b/stable/mysql/values.yaml index 9eb41f5966..f292e16fed 100644 --- a/stable/mysql/values.yaml +++ b/stable/mysql/values.yaml @@ -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