2020-08-23 12:56:55 -05:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: {{ include "gitea.fullname" . }}
|
|
|
|
labels:
|
|
|
|
{{- include "gitea.labels" . | nindent 4 }}
|
|
|
|
spec:
|
|
|
|
replicas: {{ .Values.replicaCount }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
{{- include "gitea.selectorLabels" . | nindent 6 }}
|
2021-03-16 19:07:42 -05:00
|
|
|
{{- if .Values.statefulset.labels }}
|
|
|
|
{{- toYaml .Values.statefulset.labels | nindent 6 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
serviceName: {{ include "gitea.fullname" . }}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
annotations:
|
|
|
|
checksum/config: {{ include (print $.Template.BasePath "/gitea/config.yaml") . | sha256sum }}
|
2021-10-08 07:16:24 -05:00
|
|
|
{{- range $idx, $value := .Values.gitea.ldap }}
|
|
|
|
checksum/ldap_{{ $idx }}: {{ include "gitea.ldap_settings" (list $idx $value) | sha256sum }}
|
|
|
|
{{- end }}
|
2021-12-20 08:43:55 -06:00
|
|
|
{{- range $idx, $value := .Values.gitea.oauth }}
|
|
|
|
checksum/oauth_{{ $idx }}: {{ include "gitea.oauth_settings" (list $idx $value) | sha256sum }}
|
|
|
|
{{- end }}
|
2020-09-24 11:32:11 -05:00
|
|
|
{{- with .Values.gitea.podAnnotations }}
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
labels:
|
2021-03-01 06:20:55 -06:00
|
|
|
{{- include "gitea.labels" . | nindent 8 }}
|
2021-03-16 19:07:42 -05:00
|
|
|
{{- if .Values.statefulset.labels }}
|
|
|
|
{{- toYaml .Values.statefulset.labels | nindent 8 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
spec:
|
2021-06-07 03:41:16 -05:00
|
|
|
{{- if .Values.schedulerName }}
|
|
|
|
schedulerName: "{{ .Values.schedulerName }}"
|
|
|
|
{{- end }}
|
2020-12-16 06:37:47 -06:00
|
|
|
{{- with .Values.imagePullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
securityContext:
|
2021-12-18 05:10:48 -06:00
|
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
2020-08-23 12:56:55 -05:00
|
|
|
initContainers:
|
2021-06-29 15:09:16 -05:00
|
|
|
- name: init-directories
|
2021-04-29 04:12:48 -05:00
|
|
|
image: "{{ include "gitea.image" . }}"
|
2021-06-29 15:09:16 -05:00
|
|
|
command: ["/usr/sbin/init_directory_structure.sh"]
|
|
|
|
env:
|
|
|
|
- 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
|
|
|
|
{{- if .Values.statefulset.env }}
|
|
|
|
{{- toYaml .Values.statefulset.env | nindent 12 }}
|
|
|
|
{{- end }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: init
|
|
|
|
mountPath: /usr/sbin
|
|
|
|
- name: temp
|
|
|
|
mountPath: /tmp
|
2021-11-19 15:15:45 -06:00
|
|
|
- name: data
|
|
|
|
mountPath: /data
|
2021-12-20 05:58:44 -06:00
|
|
|
{{- if .Values.persistence.subPath }}
|
|
|
|
subPath: {{ .Values.persistence.subPath }}
|
|
|
|
{{- end }}
|
2021-11-19 15:15:45 -06:00
|
|
|
{{- if .Values.extraVolumeMounts }}
|
|
|
|
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
|
|
|
{{- end }}
|
2021-12-18 05:10:48 -06:00
|
|
|
securityContext:
|
|
|
|
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
|
2021-11-19 15:15:45 -06:00
|
|
|
- name: init-app-ini
|
|
|
|
image: "{{ include "gitea.image" . }}"
|
|
|
|
command: ["/usr/sbin/config_environment.sh"]
|
|
|
|
env:
|
|
|
|
- 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
|
|
|
|
{{- if .Values.statefulset.env }}
|
|
|
|
{{- toYaml .Values.statefulset.env | nindent 12 }}
|
|
|
|
{{- end }}
|
|
|
|
volumeMounts:
|
2021-06-29 15:09:16 -05:00
|
|
|
- name: config
|
2021-11-19 15:15:45 -06:00
|
|
|
mountPath: /usr/sbin
|
|
|
|
- name: temp
|
|
|
|
mountPath: /tmp
|
2021-06-29 15:09:16 -05:00
|
|
|
- name: data
|
|
|
|
mountPath: /data
|
2021-12-20 05:58:44 -06:00
|
|
|
{{- if .Values.persistence.subPath }}
|
|
|
|
subPath: {{ .Values.persistence.subPath }}
|
|
|
|
{{- end }}
|
2021-06-29 15:09:16 -05:00
|
|
|
{{- if .Values.extraVolumeMounts }}
|
|
|
|
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
|
|
|
{{- end }}
|
2021-12-18 05:10:48 -06:00
|
|
|
securityContext:
|
|
|
|
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
|
2021-06-29 15:09:16 -05:00
|
|
|
- name: configure-gitea
|
|
|
|
image: "{{ include "gitea.image" . }}"
|
|
|
|
command: ["/usr/sbin/configure_gitea.sh"]
|
|
|
|
securityContext:
|
2021-12-18 05:10:48 -06:00
|
|
|
{{- /* By default this container runs as user 1000 unless otherwise stated */ -}}
|
|
|
|
{{- $csc := deepCopy .Values.containerSecurityContext -}}
|
|
|
|
{{- if not (hasKey $csc "runAsUser") -}}
|
|
|
|
{{- $_ := set $csc "runAsUser" 1000 -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- toYaml $csc | nindent 12 }}
|
2021-01-20 05:28:39 -06:00
|
|
|
env:
|
2021-04-29 04:12:48 -05:00
|
|
|
- name: GITEA_APP_INI
|
|
|
|
value: /data/gitea/conf/app.ini
|
|
|
|
- name: GITEA_CUSTOM
|
|
|
|
value: /data/gitea
|
|
|
|
- name: GITEA_WORK_DIR
|
|
|
|
value: /data
|
2021-06-09 09:35:50 -05:00
|
|
|
- name: GITEA_TEMP
|
|
|
|
value: /tmp/gitea
|
2021-10-08 07:16:24 -05:00
|
|
|
{{- if .Values.gitea.ldap }}
|
|
|
|
{{- range $idx, $value := .Values.gitea.ldap }}
|
|
|
|
{{- if $value.existingSecret }}
|
|
|
|
- name: GITEA_LDAP_BIND_DN_{{ $idx }}
|
2021-06-10 06:13:33 -05:00
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: bindDn
|
2021-10-08 07:16:24 -05:00
|
|
|
name: {{ $value.existingSecret }}
|
|
|
|
- name: GITEA_LDAP_PASSWORD_{{ $idx }}
|
2021-06-10 06:13:33 -05:00
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: bindPassword
|
2021-10-08 07:16:24 -05:00
|
|
|
name: {{ $value.existingSecret }}
|
2021-06-10 06:13:33 -05:00
|
|
|
{{- else }}
|
2021-10-08 07:16:24 -05:00
|
|
|
- name: GITEA_LDAP_BIND_DN_{{ $idx }}
|
|
|
|
value: {{ $value.bindDn | quote }}
|
|
|
|
- name: GITEA_LDAP_PASSWORD_{{ $idx }}
|
|
|
|
value: {{ $value.bindPassword | quote }}
|
|
|
|
{{- end }}
|
2021-07-06 00:28:13 -05:00
|
|
|
{{- end }}
|
2021-06-10 06:13:33 -05:00
|
|
|
{{- end }}
|
2021-12-20 08:43:55 -06:00
|
|
|
{{- if .Values.gitea.oauth }}
|
|
|
|
{{- range $idx, $value := .Values.gitea.oauth }}
|
|
|
|
{{- if $value.existingSecret }}
|
|
|
|
- name: GITEA_OAUTH_KEY_{{ $idx }}
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: key
|
|
|
|
name: {{ $value.existingSecret }}
|
|
|
|
- name: GITEA_OAUTH_SECRET_{{ $idx }}
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: secret
|
|
|
|
name: {{ $value.existingSecret }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2021-06-10 06:13:33 -05:00
|
|
|
{{- if .Values.gitea.admin.existingSecret }}
|
|
|
|
- name: GITEA_ADMIN_USERNAME
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: username
|
|
|
|
name: {{ .Values.gitea.admin.existingSecret }}
|
|
|
|
- name: GITEA_ADMIN_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: password
|
|
|
|
name: {{ .Values.gitea.admin.existingSecret }}
|
|
|
|
{{- else }}
|
|
|
|
- name: GITEA_ADMIN_USERNAME
|
|
|
|
value: {{ .Values.gitea.admin.username | quote }}
|
|
|
|
- name: GITEA_ADMIN_PASSWORD
|
|
|
|
value: {{ .Values.gitea.admin.password | quote }}
|
|
|
|
{{- end }}
|
2021-04-29 04:12:48 -05:00
|
|
|
{{- if .Values.statefulset.env }}
|
|
|
|
{{- toYaml .Values.statefulset.env | nindent 12 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
volumeMounts:
|
2020-09-25 08:37:55 -05:00
|
|
|
- name: init
|
|
|
|
mountPath: /usr/sbin
|
2021-06-09 09:35:50 -05:00
|
|
|
- name: temp
|
|
|
|
mountPath: /tmp
|
2020-08-23 12:56:55 -05:00
|
|
|
- name: data
|
|
|
|
mountPath: /data
|
2021-12-20 05:58:44 -06:00
|
|
|
{{- if .Values.persistence.subPath }}
|
|
|
|
subPath: {{ .Values.persistence.subPath }}
|
|
|
|
{{- end }}
|
2021-01-20 05:28:39 -06:00
|
|
|
{{- if .Values.extraVolumeMounts }}
|
|
|
|
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
terminationGracePeriodSeconds: {{ .Values.statefulset.terminationGracePeriodSeconds }}
|
|
|
|
containers:
|
|
|
|
- name: {{ .Chart.Name }}
|
2021-04-29 04:12:48 -05:00
|
|
|
image: "{{ include "gitea.image" . }}"
|
2020-08-23 12:56:55 -05:00
|
|
|
imagePullPolicy: {{ .Values.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 }}
|
2021-04-29 04:12:48 -05:00
|
|
|
- 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
|
2021-06-07 08:27:25 -05:00
|
|
|
- name: TMPDIR
|
|
|
|
value: /tmp/gitea
|
2021-06-29 14:23:32 -05:00
|
|
|
{{- if .Values.signing.enabled }}
|
|
|
|
- name: GNUPGHOME
|
|
|
|
value: {{ .Values.signing.gpgHome }}
|
|
|
|
{{- end }}
|
2021-04-29 04:12:48 -05:00
|
|
|
{{- if .Values.statefulset.env }}
|
|
|
|
{{- toYaml .Values.statefulset.env | nindent 12 }}
|
2020-09-10 05:15:34 -05:00
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
ports:
|
|
|
|
- name: ssh
|
|
|
|
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
|
|
|
|
- name: http
|
|
|
|
containerPort: {{ .Values.gitea.config.server.HTTP_PORT }}
|
2021-02-17 03:44:40 -06:00
|
|
|
{{- if .Values.gitea.config.server.ENABLE_PPROF }}
|
2021-01-21 09:45:26 -06:00
|
|
|
- name: profiler
|
|
|
|
containerPort: 6060
|
|
|
|
{{- end }}
|
2021-12-13 02:50:08 -06:00
|
|
|
{{- if .Values.gitea.livenessProbe }}
|
2020-08-23 12:56:55 -05:00
|
|
|
livenessProbe:
|
2021-12-13 02:50:08 -06:00
|
|
|
{{- toYaml .Values.gitea.livenessProbe | nindent 12 }}
|
2021-03-01 08:46:05 -06:00
|
|
|
{{- end }}
|
2021-12-13 02:50:08 -06:00
|
|
|
{{- if .Values.gitea.readinessProbe }}
|
2021-03-01 08:46:05 -06:00
|
|
|
readinessProbe:
|
2021-12-13 02:50:08 -06:00
|
|
|
{{- toYaml .Values.gitea.readinessProbe | nindent 12 }}
|
2021-03-01 08:46:05 -06:00
|
|
|
{{- end }}
|
2021-12-13 02:50:08 -06:00
|
|
|
{{- if .Values.gitea.startupProbe }}
|
2021-03-01 08:46:05 -06:00
|
|
|
startupProbe:
|
2021-12-13 02:50:08 -06:00
|
|
|
{{- toYaml .Values.gitea.startupProbe | nindent 12 }}
|
2021-03-01 08:46:05 -06:00
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
resources:
|
|
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
2021-03-01 06:16:49 -06:00
|
|
|
securityContext:
|
2021-12-18 05:10:48 -06:00
|
|
|
{{- /* Honor the deprecated securityContext variable when defined */ -}}
|
|
|
|
{{- if .Values.containerSecurityContext -}}
|
|
|
|
{{ toYaml .Values.containerSecurityContext | nindent 12 -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{ toYaml .Values.securityContext | nindent 12 -}}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
volumeMounts:
|
2021-04-29 04:12:48 -05:00
|
|
|
- name: temp
|
2021-06-07 08:27:25 -05:00
|
|
|
mountPath: /tmp
|
2020-08-23 12:56:55 -05:00
|
|
|
- name: data
|
|
|
|
mountPath: /data
|
2021-12-20 05:58:44 -06:00
|
|
|
{{- if .Values.persistence.subPath }}
|
|
|
|
subPath: {{ .Values.persistence.subPath }}
|
|
|
|
{{- end }}
|
2021-01-20 05:28:39 -06:00
|
|
|
{{- if .Values.extraVolumeMounts }}
|
|
|
|
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- with .Values.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.affinity }}
|
|
|
|
affinity:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.tolerations }}
|
|
|
|
tolerations:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
volumes:
|
2020-09-25 08:37:55 -05:00
|
|
|
- name: init
|
|
|
|
secret:
|
|
|
|
secretName: {{ include "gitea.fullname" . }}-init
|
2021-11-19 15:15:45 -06:00
|
|
|
defaultMode: 110
|
2020-08-23 12:56:55 -05:00
|
|
|
- name: config
|
2020-09-25 08:37:55 -05:00
|
|
|
secret:
|
|
|
|
secretName: {{ include "gitea.fullname" . }}
|
2021-11-19 15:15:45 -06:00
|
|
|
defaultMode: 110
|
2021-01-20 05:28:39 -06:00
|
|
|
{{- if .Values.extraVolumes }}
|
|
|
|
{{- toYaml .Values.extraVolumes | nindent 8 }}
|
|
|
|
{{- end }}
|
2021-04-29 04:12:48 -05:00
|
|
|
- name: temp
|
|
|
|
emptyDir: {}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
|
|
|
|
- name: data
|
|
|
|
persistentVolumeClaim:
|
2021-07-16 21:47:41 -05:00
|
|
|
{{- with .Values.persistence.existingClaim }}
|
|
|
|
claimName: {{ tpl . $ }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
{{- else if not .Values.persistence.enabled }}
|
|
|
|
- name: data
|
|
|
|
emptyDir: {}
|
|
|
|
{{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
|
|
|
name: data
|
2021-01-22 02:24:37 -06:00
|
|
|
{{- with .Values.persistence.annotations }}
|
|
|
|
annotations:
|
|
|
|
{{- range $key, $value := . }}
|
|
|
|
{{ $key }}: {{ $value }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.persistence.labels }}
|
|
|
|
labels:
|
|
|
|
{{- range $key, $value := . }}
|
|
|
|
{{ $key }}: {{ $value }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
{{- range .Values.persistence.accessModes }}
|
|
|
|
- {{ . | quote }}
|
|
|
|
{{- end }}
|
2020-10-29 12:10:10 -05:00
|
|
|
{{- if .Values.persistence.storageClass }}
|
|
|
|
storageClassName: {{ .Values.persistence.storageClass | quote }}
|
|
|
|
{{- end }}
|
2020-08-23 12:56:55 -05:00
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .Values.persistence.size | quote }}
|
|
|
|
{{- end }}
|