Skip to content

Instantly share code, notes, and snippets.

@naveensrinivasan
Created December 13, 2016 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naveensrinivasan/02e1606b3c618083594cc3fb37089dbb to your computer and use it in GitHub Desktop.
Save naveensrinivasan/02e1606b3c618083594cc3fb37089dbb to your computer and use it in GitHub Desktop.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
template:
metadata:
labels:
app: {{ template "fullname" . }}
annotations:
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "remove-lost-found",
"image": "busybox:1.25.0",
"command": ["rm", "-fr", "/var/lib/mysql/lost+found"],
"volumeMounts": [
{
"name": "data",
"mountPath": "/var/lib/mysql"
}
]
}
]'
spec:
containers:
- name: {{ template "fullname" . }}
image: "mysql:{{ .Values.imageTag }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
resources:
{{ toYaml .Values.resources | indent 10 }}
env:
{{- if .Values.mysqlAllowEmptyPassword }}
- name: MYSQL_ALLOW_EMPTY_PASSWORD
value: "true"
{{- else }}
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: mysql-root-password
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: mysql-password
{{- end }}
- name: MYSQL_USER
value: {{ default "" .Values.mysqlUser | quote }}
- name: MYSQL_DATABASE
value: {{ default "" .Values.mysqlDatabase | quote }}
ports:
- name: mysql
containerPort: 3306
livenessProbe:
exec:
command:
- mysqladmin
- ping
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
exec:
command:
- mysqladmin
- ping
initialDelaySeconds: 5
timeoutSeconds: 1
volumeMounts:
- name: data
mountPath: /var/lib/mysql
{{- if .Values.secret.enabled }}
imagePullSecrets:
- name: containerbot-pull-secret
{{- end -}}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}
{{- else }}
emptyDir: {}
{{- end -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment