Files
helm-charts/mariadb/templates/deployment.yaml
T

91 lines
2.8 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mariadb.fullname" . }}
labels:
{{- include "mariadb.labels" . | nindent 4 }}
annotations:
version-source: dockerhub-tags:library/mariadb
kustomize.toolkit.fluxcd.io/prune: disabled
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "mariadb.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "mariadb.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: mariadb
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.port }}
env:
- name: MARIADB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.auth.existingSecret }}
key: {{ .Values.auth.rootPasswordKey }}
- name: MARIADB_DATABASE
value: {{ .Values.auth.database | quote }}
{{- if .Values.auth.username }}
- name: MARIADB_USER
value: {{ .Values.auth.username | quote }}
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.auth.existingSecret }}
key: {{ .Values.auth.passwordKey }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /var/lib/mysql
readinessProbe:
exec:
command:
- mariadb-admin
- ping
- -h
- localhost
initialDelaySeconds: 15
periodSeconds: 10
livenessProbe:
exec:
command:
- mariadb-admin
- ping
- -h
- localhost
initialDelaySeconds: 30
periodSeconds: 10
volumes:
- name: data
{{- if .Values.persistence.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "mariadb.fullname" . }}-data
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}