drone-charts/templates/deployment.yaml
Markus Pesch ce624330c1
All checks were successful
continuous-integration/drone/push Build is passing
feat: support persistent volume
Add persistent volume for sqlite3 backend
2021-08-08 22:19:34 +02:00

70 lines
2.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "drone.fullname" . }}
labels:
{{- include "drone.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "drone.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "drone.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
envFrom:
- secretRef:
name: {{ include "drone.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if eq (default "sqlite3" .Values.config.DRONE_DATABASE_DRIVER) "sqlite3" }}
volumeMounts:
- name: data
mountPath: {{ default "/data/database.sqlite" .Values.config.DRONE_DATABASE_DATASOURCE | dir }}
{{- end }}
{{- if and (eq (default "sqlite3" .Values.config.DRONE_DATABASE_DRIVER) "sqlite3") .Values.persistence.existingClaim }}
volumes:
- name: data
persistentVolumeClaim:
{{- with .Values.persistence.existingClaim }}
claimName: {{ tpl . $ }}
{{- end }}
{{- else if and (.Values.config.DRONE_DATABASE_DRIVER | default "sqlite3" | eq "sqlite3") (not .Values.persistence.existingClaim) }}
volumes:
- name: data
persistentVolumeClaim:
claimName: drone
{{- 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 }}