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>
222 lines
8.4 KiB
YAML
222 lines
8.4 KiB
YAML
{{- if .Values.deployment.enabled -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
{{- with (include "gitea.deployment.annotations" . | fromYaml) }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
{{- with (include "gitea.deployment.labels" . | fromYaml) }}
|
|
labels:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
name: {{ include "gitea.fullname" . }}
|
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
spec:
|
|
replicas: {{ .Values.deployment.replicas }}
|
|
strategy:
|
|
type: {{ .Values.deployment.strategy.type }}
|
|
{{- if eq .Values.deployment.strategy.type "RollingUpdate" }}
|
|
rollingUpdate:
|
|
maxUnavailable: {{ .Values.deployment.strategy.rollingUpdate.maxUnavailable }}
|
|
maxSurge: {{ .Values.deployment.strategy.rollingUpdate.maxSurge }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "gitea.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
{{- with (include "gitea.pod.annotations" . | fromYaml) }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "gitea.labels" . | nindent 8 }}
|
|
{{- if .Values.deployment.labels }}
|
|
{{- toYaml .Values.deployment.labels | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- $hostUsers := include "gitea.hostUsers" . | trim }}
|
|
{{- $securityContext := include "gitea.deployment.securityContext" . | trim }}
|
|
{{- $containerSecurityContext := include "gitea.containerSecurityContext" (list . (deepCopy .Values.deployment.gitea.securityContext)) | trim }}
|
|
{{- if .Values.deployment.schedulerName }}
|
|
schedulerName: "{{ .Values.deployment.schedulerName }}"
|
|
{{- end }}
|
|
{{- if (or .Values.serviceAccount.create .Values.serviceAccount.name) }}
|
|
serviceAccountName: {{ include "gitea.serviceAccountName" . }}
|
|
{{- end }}
|
|
{{- if .Values.deployment.priorityClassName }}
|
|
priorityClassName: "{{ .Values.deployment.priorityClassName }}"
|
|
{{- end }}
|
|
{{- if $hostUsers }}
|
|
hostUsers: {{ $hostUsers }}
|
|
{{- end }}
|
|
{{- include "gitea.images.pullSecrets" . | nindent 6 }}
|
|
{{- if $securityContext }}
|
|
securityContext:
|
|
{{- $securityContext | nindent 8 }}
|
|
{{- end }}
|
|
initContainers:
|
|
{{- include "gitea.deployment.initContainers" . | trim | nindent 8 }}
|
|
terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
image: "{{ include "gitea.image" . }}"
|
|
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
|
env:
|
|
# SSH Port values have to be set here as well for openssh configuration
|
|
- name: SSH_LISTEN_PORT
|
|
value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }}
|
|
- name: SSH_PORT
|
|
value: {{ .Values.gitea.config.server.SSH_PORT | quote }}
|
|
{{- if not .Values.deployment.gitea.image.rootless }}
|
|
- name: SSH_LOG_LEVEL
|
|
value: {{ .Values.gitea.ssh.logLevel | quote }}
|
|
{{- end }}
|
|
- name: GITEA_APP_INI
|
|
value: /data/gitea/conf/app.ini
|
|
- name: GITEA_CUSTOM
|
|
value: /data/gitea
|
|
- name: GITEA_WORK_DIR
|
|
value: /data
|
|
- name: GITEA_TEMP
|
|
value: /tmp/gitea
|
|
{{- with .Values.deployment.gitea.resources }}
|
|
{{- if and (hasKey . "limits") (hasKey (.limits | default dict) "cpu") }}
|
|
- name: GOMAXPROCS
|
|
valueFrom:
|
|
resourceFieldRef:
|
|
divisor: "1"
|
|
resource: limits.cpu
|
|
{{- end }}
|
|
{{- end }}
|
|
- name: TMPDIR
|
|
value: /tmp/gitea
|
|
{{- if .Values.deployment.gitea.image.rootless }}
|
|
- name: HOME
|
|
value: /data/gitea/git
|
|
{{- end }}
|
|
{{- if .Values.secrets.gpg.enabled }}
|
|
- name: GNUPGHOME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "gitea.secret.gpg.name" . }}
|
|
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
|
{{- end }}
|
|
{{- if .Values.deployment.gitea.env }}
|
|
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.gitea.envFrom }}
|
|
envFrom:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: ssh
|
|
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
|
|
{{- if .Values.service.ssh.hostPort }}
|
|
hostPort: {{ .Values.service.ssh.hostPort }}
|
|
{{- end }}
|
|
- name: http
|
|
containerPort: {{ .Values.gitea.config.server.HTTP_PORT }}
|
|
{{- if .Values.gitea.config.server.ENABLE_PPROF }}
|
|
- name: profiler
|
|
containerPort: 6060
|
|
{{- end }}
|
|
{{- if .Values.gitea.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
{{- include "gitea.deployment.probe" .Values.gitea.livenessProbe | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.gitea.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
{{- include "gitea.deployment.probe" .Values.gitea.readinessProbe | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.gitea.startupProbe.enabled }}
|
|
startupProbe:
|
|
{{- include "gitea.deployment.probe" .Values.gitea.startupProbe | nindent 12 }}
|
|
{{- end }}
|
|
resources:
|
|
{{- toYaml (.Values.deployment.gitea.resources | default dict) | nindent 12 }}
|
|
{{- if $containerSecurityContext }}
|
|
securityContext:
|
|
{{- $containerSecurityContext | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: temp
|
|
mountPath: /tmp
|
|
- name: data
|
|
mountPath: /data
|
|
{{- if .Values.persistence.new.subPath }}
|
|
subPath: {{ .Values.persistence.new.subPath }}
|
|
{{- end }}
|
|
{{- include "gitea.container-additional-mounts" . | nindent 12 }}
|
|
{{- if .Values.extraContainers }}
|
|
{{- toYaml .Values.extraContainers | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.global.hostAliases }}
|
|
hostAliases:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.topologySpreadConstraints }}
|
|
topologySpreadConstraints:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.deployment.dnsConfig }}
|
|
dnsConfig:
|
|
{{- toYaml .Values.deployment.dnsConfig | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.deployment.resources }}
|
|
resources:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: init
|
|
secret:
|
|
secretName: {{ include "gitea.secret.init.name" . }}
|
|
defaultMode: 110
|
|
- name: config
|
|
secret:
|
|
secretName: {{ include "gitea.secret.config.name" . }}
|
|
defaultMode: 110
|
|
{{- if gt (len .Values.deployment.volumes) 0 }}
|
|
{{- toYaml .Values.deployment.volumes | nindent 8 }}
|
|
{{- end }}
|
|
- name: inline-config-sources
|
|
secret:
|
|
secretName: {{ include "gitea.secret.inlineConfig.name" . }}
|
|
{{- range $idx, $value := .Values.gitea.additionalConfigSources }}
|
|
- name: additional-config-sources-{{ $idx }}
|
|
{{- toYaml $value | nindent 10 }}
|
|
{{- end }}
|
|
- name: temp
|
|
emptyDir: {}
|
|
{{- if .Values.secrets.gpg.enabled }}
|
|
- name: gpg-private-key
|
|
secret:
|
|
secretName: {{ include "gitea.secret.gpg.name" . }}
|
|
items:
|
|
- key: {{ include "gitea.secret.gpg.privateKeyKey" . }}
|
|
path: private.asc
|
|
defaultMode: 0100
|
|
{{- end }}
|
|
{{- if .Values.persistence.enabled }}
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "gitea.persistentVolumeClaim.name" . }}
|
|
{{- else }}
|
|
- name: data
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- end }}
|