feat: support persistent volume
All checks were successful
continuous-integration/drone/push Build is passing

Add persistent volume for sqlite3 backend
This commit is contained in:
Markus Pesch 2021-08-08 19:39:12 +02:00
parent cb03476ed7
commit ce624330c1
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 49 additions and 5 deletions

View File

@ -97,8 +97,7 @@ be the options passed via the `--set` flag of the `helm install` command.
## Missing features
1. Add Persistent Volume for the SQLite database
2. Support postgres, maria and mysql database directly as helm dependency if as
1. Support postgres, maria and mysql database directly as helm dependency if as
`DATABASE_DRIVER` an other instead of `sqlite` has been selected.
Alternatively can be passed a completely custom string to establish a
database connection, when the database is running outside the cluster.

View File

@ -38,7 +38,24 @@ spec:
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 }}

View File

@ -0,0 +1,17 @@
{{ if and (eq (default "sqlite3" .Values.config.DRONE_DATABASE_DRIVER) "sqlite3") (not .Values.persistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: drone
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
{{- end }}

View File

@ -27,7 +27,7 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000
config:
config: {}
# DRONE_BITBUCKET_CLIENT_ID
# String value. Configures the Bitbucket OAuth client id. This is used to
# authorize access to Bitbucket on behalf of a Drone user.
@ -507,3 +507,14 @@ nodeSelector: {}
tolerations: []
affinity: {}
# persistence is only required when config.DATABASE_DRIVER is not sqlite3 or
# undefined.
persistence:
# existingClaim:
size: 5Gi
accessModes:
- ReadWriteOnce
labels: {}
annotation: {}
# storageClass: