From 1e2c1c686d15e478693db1d4109acba1933afc2e Mon Sep 17 00:00:00 2001 From: V-Paranoiaque Date: Sun, 21 Sep 2025 21:15:50 +0200 Subject: [PATCH] Add volumes --- helm/gitea-mirror/templates/deployment.yaml | 20 ++++++++++++++++ helm/gitea-mirror/templates/pvc.yaml | 26 +++++++++++++++++++++ helm/gitea-mirror/values.yaml | 10 ++++++++ 3 files changed, 56 insertions(+) create mode 100644 helm/gitea-mirror/templates/pvc.yaml diff --git a/helm/gitea-mirror/templates/deployment.yaml b/helm/gitea-mirror/templates/deployment.yaml index c99bd7a..f30e0d6 100644 --- a/helm/gitea-mirror/templates/deployment.yaml +++ b/helm/gitea-mirror/templates/deployment.yaml @@ -103,6 +103,12 @@ spec: failureThreshold: {{ .Values.startupProbe.failureThreshold }} successThreshold: {{ .Values.startupProbe.successThreshold }} {{- end }} + volumeMounts: + - name: data + mountPath: /app/data + {{- if .Values.extraVolumeMounts }} + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} + {{- end }} {{- with .Values.deployment.resources }} resources: {{- toYaml .Values.deployment.resources | nindent 12 }} @@ -123,3 +129,17 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} + volumes: + {{- if .Values.persistence.enabled }} + {{- if .Values.persistence.mount }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.persistence.claimName }} + {{- end }} + {{- else if not .Values.persistence.enabled }} + - name: data + emptyDir: {} + {{- end }} + {{- if .Values.extraVolumes }} + {{- toYaml .Values.extraVolumes | nindent 8 }} + {{- end }} diff --git a/helm/gitea-mirror/templates/pvc.yaml b/helm/gitea-mirror/templates/pvc.yaml new file mode 100644 index 0000000..0e63293 --- /dev/null +++ b/helm/gitea-mirror/templates/pvc.yaml @@ -0,0 +1,26 @@ +{{- if and .Values.persistence.enabled .Values.persistence.create }} +{{- $gm := index .Values "gitea-mirror" -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ .Values.persistence.claimName }} + labels: + {{- include "gitea-mirror.labels" . | nindent 4 }} + {{- with .Values.persistence.annotations }} + annotations: + {{ . | toYaml | indent 4}} + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessModes }} + {{- with .Values.persistence.storageClass }} + storageClass: {{ . }} + {{- end }} + volumeMode: Filesystem + {{- with .Values.persistence.volumeName }} + volumeName: {{ . }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- end }} diff --git a/helm/gitea-mirror/values.yaml b/helm/gitea-mirror/values.yaml index d896b1e..07eb7f6 100644 --- a/helm/gitea-mirror/values.yaml +++ b/helm/gitea-mirror/values.yaml @@ -81,10 +81,20 @@ startupProbe: failureThreshold: 6 successThreshold: 1 +persistence: + enabled: true + create: true + claimName: gitea-mirror-storage + storageClass: "" + accessMode: ReadWriteOnce + size: 1Gi + affinity: {} nodeSelector: {} tolerations: [] topologySpreadConstraints: [] +extraVolumes: [] +extraVolumeMounts: [] serviceAccount: create: false