[stable/mysql] Option to create a custom service account (#19370)

* option to customize securityContext

Signed-off-by: Carlos Roberto Marques Junior <carlos.marques@bndes.gov.br>

* new line

Signed-off-by: Carlos Roberto Marques Junior <carlos.marques@bndes.gov.br>

* [stable/mysql] option to specify serviceaccount

Signed-off-by: Carlos Roberto Marques Junior <carlos.marques@bndes.gov.br>
This commit is contained in:
Carlos Roberto Marques Junior
2019-12-04 10:02:57 -08:00
committed by Kubernetes Prow Robot
parent 560f413e60
commit f54c634d64
6 changed files with 37 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: mysql
version: 1.4.0
version: 1.5.0
appVersion: 5.7.27
description: Fast, reliable, scalable, and easy to use open-source relational database
system.
+2
View File
@@ -105,6 +105,8 @@ The following table lists the configurable parameters of the MySQL chart and the
| `service.annotations` | Kubernetes annotations for mysql | {} |
| `service.type` | Kubernetes service type | ClusterIP |
| `service.loadBalancerIP` | LoadBalancer service IP | `""` |
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` |
| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the mysql.fullname template |
| `ssl.enabled` | Setup and use SSL for MySQL connections | `false` |
| `ssl.secret` | Name of the secret containing the SSL certificates | mysql-ssl-certs |
| `ssl.certificates[0].name` | Name of the secret containing the SSL certificates | `nil` |
+12 -1
View File
@@ -29,4 +29,15 @@ Generate chart secret name
*/}}
{{- define "mysql.secretName" -}}
{{ default (include "mysql.fullname" .) .Values.existingSecret }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "mysql.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "mysql.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
+1
View File
@@ -46,6 +46,7 @@ spec:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
serviceAccountName: {{ template "mysql.serviceAccountName" . }}
initContainers:
- name: "remove-lost-found"
image: "{{ .Values.busybox.image}}:{{ .Values.busybox.tag }}"
@@ -0,0 +1,11 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "mysql.serviceAccountName" . }}
labels:
app: {{ template "mysql.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end }}
+10
View File
@@ -170,6 +170,16 @@ service:
# nodePort: 32000
# loadBalancerIP:
## Pods Service Account
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccount:
## Specifies whether a ServiceAccount should be created
##
create: false
## The name of the ServiceAccount to use.
## If not set and create is true, a name is generated using the mariadb.fullname template
# name:
ssl:
enabled: false
secret: mysql-ssl-certs