apiVersion: v1 kind: Service metadata: name: {{ include "covidok.mysql" . }} labels: {{- include "covidok.labels" . | nindent 4 }} spec: ports: - port: 3306 selector: {{- include "covidok.selectorLabels" . | nindent 4 }} app: mysql --- apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "covidok.mysql" . }} spec: selector: matchLabels: {{- include "covidok.selectorLabels" . | nindent 6 }} app: mysql strategy: type: Recreate template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "covidok.selectorLabels" . | nindent 8 }} app: mysql spec: containers: - image: "{{ .Values.images.mysql.name }}:{{ .Values.images.mysql.tag }}" name: mysql env: # Use secret in real usage - name: MYSQL_ROOT_PASSWORD value: dev-pass1 - name: MYSQL_DATABASE value: "{{ .Values.config.mysql.database }}" - name: MYSQL_USER value: "{{ .Values.config.mysql.user }}" - name: MYSQL_PASSWORD value: "{{ .Values.config.mysql.password }}" ports: - containerPort: 3306 name: mysql {{ if .Values.persistence.enabled }} volumeMounts: - name: mysql-data mountPath: /var/lib/mysql volumes: - name: mysql-data persistentVolumeClaim: claimName: mysql-pvc-{{ .Release.Name }} --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-pvc-{{ .Release.Name }} labels: {{- include "covidok.labels" . | nindent 4 }} spec: storageClassName: {{ .Values.persistence.storageClass }} accessModes: - ReadWriteOnce resources: requests: storage: {{ .Values.persistence.claimSize }} {{ end }}