diff --git a/README.md b/README.md index 257478b..2fc73f7 100644 --- a/README.md +++ b/README.md @@ -646,18 +646,20 @@ gitea: ### Persistence -| Name | Description | Value | -| --------------------------- | ---------------------------------------------------------- | ------------------- | -| `persistence.enabled` | Enable persistent storage | `true` | -| `persistence.existingClaim` | Use an existing claim to store repository information | `nil` | -| `persistence.size` | Size for persistence to store repo information | `10Gi` | -| `persistence.accessModes` | AccessMode for persistence | `["ReadWriteOnce"]` | -| `persistence.labels` | Labels for the persistence volume claim to be created | `{}` | -| `persistence.annotations` | Annotations for the persistence volume claim to be created | `{}` | -| `persistence.storageClass` | Name of the storage class to use | `nil` | -| `persistence.subPath` | Subdirectory of the volume to mount at | `nil` | -| `extraVolumes` | Additional volumes to mount to the Gitea statefulset | `nil` | -| `extraVolumeMounts` | Additional volume mounts for the Gitea containers | `nil` | +| Name | Description | Value | +| ---------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------- | +| `persistence.enabled` | Enable persistent storage | `true` | +| `persistence.existingClaim` | Use an existing claim to store repository information | `nil` | +| `persistence.size` | Size for persistence to store repo information | `10Gi` | +| `persistence.accessModes` | AccessMode for persistence | `["ReadWriteOnce"]` | +| `persistence.labels` | Labels for the persistence volume claim to be created | `{}` | +| `persistence.annotations` | Annotations for the persistence volume claim to be created | `{}` | +| `persistence.storageClass` | Name of the storage class to use | `nil` | +| `persistence.subPath` | Subdirectory of the volume to mount at | `nil` | +| `extraVolumes` | Additional volumes to mount to the Gitea statefulset | `[]` | +| `extraContainerVolumeMounts` | Mounts that are only mapped into the Gitea runtime/main container, to e.g. override custom templates. | `[]` | +| `extraInitVolumeMounts` | Mounts that are only mapped into the init-containers. Can be used for additional preconfiguration. | `[]` | +| `extraVolumeMounts` | **DEPRECATED** Additional volume mounts for init containers and the Gitea main container | `[]` | ### Init @@ -786,6 +788,18 @@ Please read them carefully to upgrade successfully. ### To 6.0.0 +#### Different volume mounts for init-containers and runtime container + +**The `extraVolumeMounts` is deprecated** in favor of `extraInitVolumeMounts` and +`extraContainerVolumeMounts`. You can now have different mounts for the initialization +phase and Gitea runtime. The deprecated `extraVolumeMounts` will still be available +for the time being and is mounted into every container. If you want to switch to +the new settings and want to mount specific volumes into all containers, you have +to configure their mount points within both new settings. + +**Combining values from the deprecated setting with values from the new settings +is not possible.** + #### New `enabled` flag for `startupProbe` Prior to this version the `startupProbe` was just a commented sample within the diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 9c2c63c..0e481e0 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -313,3 +313,21 @@ https {{- $_ := set .Values.gitea.config.database "PASSWD" .Values.mariadb.auth.password -}} {{- end -}} {{- end -}} + +{{- define "gitea.init-additional-mounts" -}} + {{- /* Honor the deprecated extraVolumeMounts variable when defined */ -}} + {{- if gt (len .Values.extraInitVolumeMounts) 0 -}} + {{- toYaml .Values.extraInitVolumeMounts -}} + {{- else if gt (len .Values.extraVolumeMounts) 0 -}} + {{- toYaml .Values.extraVolumeMounts -}} + {{- end -}} +{{- end -}} + +{{- define "gitea.container-additional-mounts" -}} + {{- /* Honor the deprecated extraVolumeMounts variable when defined */ -}} + {{- if gt (len .Values.extraContainerVolumeMounts) 0 -}} + {{- toYaml .Values.extraContainerVolumeMounts -}} + {{- else if gt (len .Values.extraVolumeMounts) 0 -}} + {{- toYaml .Values.extraVolumeMounts -}} + {{- end -}} +{{- end -}} diff --git a/templates/gitea/statefulset.yaml b/templates/gitea/statefulset.yaml index bb2b42c..ed9a887 100644 --- a/templates/gitea/statefulset.yaml +++ b/templates/gitea/statefulset.yaml @@ -69,9 +69,7 @@ spec: {{- if .Values.persistence.subPath }} subPath: {{ .Values.persistence.subPath }} {{- end }} - {{- if .Values.extraVolumeMounts }} - {{- toYaml .Values.extraVolumeMounts | nindent 12 }} - {{- end }} + {{- include "gitea.init-additional-mounts" . | nindent 12 }} securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} - name: init-app-ini @@ -109,9 +107,7 @@ spec: - name: additional-config-sources-{{ $idx }} mountPath: "/env-to-ini-mounts/additionals/{{ $idx }}/" {{- end }} - {{- if .Values.extraVolumeMounts }} - {{- toYaml .Values.extraVolumeMounts | nindent 12 }} - {{- end }} + {{- include "gitea.init-additional-mounts" . | nindent 12 }} securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} - name: configure-gitea @@ -201,9 +197,7 @@ spec: {{- if .Values.persistence.subPath }} subPath: {{ .Values.persistence.subPath }} {{- end }} - {{- if .Values.extraVolumeMounts }} - {{- toYaml .Values.extraVolumeMounts | nindent 12 }} - {{- end }} + {{- include "gitea.init-additional-mounts" . | nindent 12 }} terminationGracePeriodSeconds: {{ .Values.statefulset.terminationGracePeriodSeconds }} containers: - name: {{ .Chart.Name }} @@ -273,9 +267,7 @@ spec: {{- if .Values.persistence.subPath }} subPath: {{ .Values.persistence.subPath }} {{- end }} - {{- if .Values.extraVolumeMounts }} - {{- toYaml .Values.extraVolumeMounts | nindent 12 }} - {{- end }} + {{- include "gitea.container-additional-mounts" . | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -301,7 +293,7 @@ spec: secret: secretName: {{ include "gitea.fullname" . }} defaultMode: 110 - {{- if .Values.extraVolumes }} + {{- if gt (len .Values.extraVolumes) 0 }} {{- toYaml .Values.extraVolumes | nindent 8 }} {{- end }} - name: inline-config-sources diff --git a/values.yaml b/values.yaml index 6f084dc..bd8c4d0 100644 --- a/values.yaml +++ b/values.yaml @@ -217,17 +217,23 @@ persistence: subPath: ## @param extraVolumes Additional volumes to mount to the Gitea statefulset -extraVolumes: +extraVolumes: [] # - name: postgres-ssl-vol # secret: # secretName: gitea-postgres-ssl +## @param extraContainerVolumeMounts Mounts that are only mapped into the Gitea runtime/main container, to e.g. override custom templates. +extraContainerVolumeMounts: [] -# additional volumes to mount, both to the init container and to the main -# container. As an example, can be used to mount a client cert when connecting -# to an external Postgres server. -## @param extraVolumeMounts Additional volume mounts for the Gitea containers -extraVolumeMounts: +## @param extraInitVolumeMounts Mounts that are only mapped into the init-containers. Can be used for additional preconfiguration. +extraInitVolumeMounts: [] + +## @depracated The extraVolumeMounts variable has been split two: +## - extraContainerVolumeMounts +## - extraInitVolumeMounts +## As an example, can be used to mount a client cert when connecting to an external Postgres server. +## @param extraVolumeMounts **DEPRECATED** Additional volume mounts for init containers and the Gitea main container +extraVolumeMounts: [] # - name: postgres-ssl-vol # readOnly: true # mountPath: "/pg-ssl"