refactor(persistence)!: group the values into existingPersistentVolumeClaim and new
Helm / helm-lint (push) Successful in 13s
changelog / changelog (push) Successful in 22s
Helm / helm-unittest (push) Failing after 45s
Markdown linter / markdown-link-checker (push) Successful in 44s
Markdown linter / markdown-lint (push) Successful in 36s

The flat `persistence` dict mixed three concerns: whether persistence is used at all, whether the chart creates the
PersistentVolumeClaim, and how that claim is shaped. The pairs `create`/`claimName` and `enabled`/`mount` were only
meaningful in certain combinations, so an invalid configuration such as `create=true` together with a foreign
`claimName` was silently accepted. The same split into an `existingX`/`new` pair is already used for the Secrets, so
this aligns persistence with the rest of the chart.

`persistence.enabled` now only decides whether a volume is used at all. `persistence.existingPersistentVolumeClaim`
points at a claim managed outside of the chart, and everything under `persistence.new` describes the claim the chart
creates itself. Rendering and naming move into `templates/gitea/_persistentVolumeClaims.tpl` so the Deployment and the
PersistentVolumeClaim derive the claim name from a single helper instead of repeating the value lookups.

Support for `global.storageClass` is dropped. It was a chart-wide override that silently applied to the Gitea claim and
was evaluated through `tpl`, which made the effective storage class hard to predict. The storage class is now set
explicitly via `persistence.new.storageClassName`, which also matches the field name in the PersistentVolumeClaim spec.

BREAKING CHANGE: The `persistence` values were restructured and `global.storageClass` was removed.

- `persistence.create` and `persistence.mount` are gone. Set `persistence.enabled` to use a volume and
  `persistence.existingPersistentVolumeClaim.enabled` to reuse a claim that is not managed by the chart.
- `persistence.claimName` moves to `persistence.existingPersistentVolumeClaim.persistentVolumeClaimName`. A claim
  created by the chart is now named after `gitea.fullname` instead of the default `gitea-shared-storage`.
- `persistence.accessModes`, `annotations`, `labels`, `size` and `subPath` move into `persistence.new`.
- `persistence.volumeName` becomes `persistence.new.persistentVolumeName`.
- `persistence.storageClass` and `global.storageClass` become `persistence.new.storageClassName`.
- `persistence.enabled` now defaults to `false`.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-14 15:38:06 +02:00
co-authored by Copilot
parent 761921faed
commit dfe087c0c1
12 changed files with 160 additions and 139 deletions
-11
View File
@@ -154,17 +154,6 @@ These default to runAsUser 1000 outside OpenShift to preserve existing behavior.
{{- include "gitea.containerSecurityContext" (list $root $containerSecurityContext) -}}
{{- end -}}
{{/*
Storage Class
*/}}
{{- define "gitea.persistence.storageClass" -}}
{{- $storageClass := (tpl ( default "" .Values.persistence.storageClass) .) | default (tpl ( default "" .Values.global.storageClass) .) }}
{{- if $storageClass }}
storageClassName: {{ $storageClass | quote }}
{{- end }}
{{- end -}}
{{/*
Common labels
*/}}
+8 -8
View File
@@ -40,8 +40,8 @@
mountPath: /tmp
- name: data
mountPath: /data
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- if .Values.persistence.new.subPath }}
subPath: {{ .Values.persistence.new.subPath }}
{{- end }}
{{- include "gitea.init-additional-mounts" . | nindent 4 }}
{{- with $config.volumeMounts }}
@@ -105,8 +105,8 @@
mountPath: /tmp
- name: data
mountPath: /data
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- if .Values.persistence.new.subPath }}
subPath: {{ .Values.persistence.new.subPath }}
{{- end }}
- name: inline-config-sources
mountPath: /env-to-ini-mounts/inlines/
@@ -168,8 +168,8 @@
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
- name: data
mountPath: /data
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- if .Values.persistence.new.subPath }}
subPath: {{ .Values.persistence.new.subPath }}
{{- end }}
- name: gpg-private-key
mountPath: /raw
@@ -292,8 +292,8 @@
mountPath: /tmp
- name: data
mountPath: /data
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- if .Values.persistence.new.subPath }}
subPath: {{ .Values.persistence.new.subPath }}
{{- end }}
{{- include "gitea.init-additional-mounts" . | nindent 4 }}
{{- with $config.volumeMounts }}
@@ -0,0 +1,38 @@
{{/* vim: set filetype=mustache: */}}
{{/* annotations */}}
{{- define "gitea.persistentVolumeClaim.annotations" -}}
{{- with .Values.persistence.new.annotations }}
{{- toYaml . -}}
{{- end }}
{{- end }}
{{/* enabled */}}
{{- define "gitea.persistentVolumeClaim.enabled" -}}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingPersistentVolumeClaim.enabled) -}}
true
{{- else -}}
false
{{- end }}
{{- end }}
{{/* labels */}}
{{- define "gitea.persistentVolumeClaim.labels" -}}
{{ include "gitea.labels" . }}
{{- with .Values.persistence.new.labels }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{/* name */}}
{{- define "gitea.persistentVolumeClaim.name" -}}
{{- if .Values.persistence.existingPersistentVolumeClaim.enabled -}}
{{ required "persistence.existingPersistentVolumeClaim.persistentVolumeClaimName is required when persistence.existingPersistentVolumeClaim.enabled is true" .Values.persistence.existingPersistentVolumeClaim.persistentVolumeClaimName }}
{{- else -}}
{{ include "gitea.fullname" . }}
{{- end }}
{{- end }}
+4 -6
View File
@@ -145,8 +145,8 @@ spec:
mountPath: /tmp
- name: data
mountPath: /data
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- if .Values.persistence.new.subPath }}
subPath: {{ .Values.persistence.new.subPath }}
{{- end }}
{{- include "gitea.container-additional-mounts" . | nindent 12 }}
{{- if .Values.extraContainers }}
@@ -211,12 +211,10 @@ spec:
defaultMode: 0100
{{- end }}
{{- if .Values.persistence.enabled }}
{{- if .Values.persistence.mount }}
- name: data
persistentVolumeClaim:
claimName: {{ .Values.persistence.claimName }}
{{- end }}
{{- else if not .Values.persistence.enabled }}
claimName: {{ include "gitea.persistentVolumeClaim.name" . }}
{{- else }}
- name: data
emptyDir: {}
{{- end }}
+20 -13
View File
@@ -1,26 +1,33 @@
{{- if and .Values.persistence.enabled .Values.persistence.create }}
{{- if eq (include "gitea.persistentVolumeClaim.enabled" .) "true" }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Values.persistence.claimName }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
{{- with (include "gitea.persistentVolumeClaim.annotations" .) }}
annotations:
{{ .Values.persistence.annotations | toYaml | indent 4}}
{{- . | nindent 4 }}
{{- end }}
{{- with (include "gitea.persistentVolumeClaim.labels" .) }}
labels:
{{ .Values.persistence.labels | toYaml | indent 4}}
{{- . | nindent 4 }}
{{- end }}
name: {{ include "gitea.persistentVolumeClaim.name" . }}
namespace: {{ .Release.Namespace }}
spec:
accessModes:
{{- if gt (.Values.deployment.replicas | int) 1 }}
- ReadWriteMany
{{- else }}
{{- .Values.persistence.accessModes | toYaml | nindent 4 }}
{{- end }}
volumeMode: Filesystem
{{- include "gitea.persistence.storageClass" . | nindent 2 }}
{{- with .Values.persistence.volumeName }}
volumeName: {{ . }}
{{- .Values.persistence.new.accessModes | toYaml | nindent 4 }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}
storage: {{ .Values.persistence.new.size }}
{{- with .Values.persistence.new.storageClassName }}
storageClassName: {{ . }}
{{- end }}
volumeMode: Filesystem
{{- with .Values.persistence.new.persistentVolumeName }}
volumeName: {{ . }}
{{- end }}
{{- end }}
+2 -2
View File
@@ -37,8 +37,8 @@ stringData:
{{- end }}
{{- end }}
{{- if eq (first .Values.persistence.accessModes) "ReadWriteOnce" -}}
{{- fail "When using multiple replicas, a RWX file system is required and persistence.accessModes[0] must be set to ReadWriteMany." -}}
{{- if eq (first .Values.persistence.new.accessModes) "ReadWriteOnce" -}}
{{- fail "When using multiple replicas, a RWX file system is required and persistence.new.accessModes[0] must be set to ReadWriteMany." -}}
{{- end }}
{{- if .Values.gitea.config.indexer -}}
{{- if eq .Values.gitea.config.indexer.ISSUE_INDEXER_TYPE "bleve" -}}