43 lines
1.5 KiB
Smarty
43 lines
1.5 KiB
Smarty
|
{{/*
|
||
|
Create helm partial for gitea server
|
||
|
*/}}
|
||
|
{{- define "init" }}
|
||
|
- name: init
|
||
|
image: {{ .Values.images.gitea }}
|
||
|
imagePullPolicy: {{ .Values.images.pullPolicy }}
|
||
|
env:
|
||
|
{{- if .Values.externalDB.existingSecret.enabled }}
|
||
|
- name: EXTERNALDB_USER
|
||
|
valueFrom:
|
||
|
secretKeyRef:
|
||
|
name: {{ .Values.externalDB.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
|
||
|
key: {{ .Values.externalDB.existingSecret.usernameKey | default "username" }}
|
||
|
- name: EXTERNALDB_PASS
|
||
|
valueFrom:
|
||
|
secretKeyRef:
|
||
|
name: {{ .Values.externalDB.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
|
||
|
key: {{ .Values.externalDB.existingSecret.passwordKey | default "password" }}
|
||
|
{{- end }}
|
||
|
{{- if .Values.mariadb.enabled }}
|
||
|
- name: MARIADB_PASSWORD
|
||
|
valueFrom:
|
||
|
secretKeyRef:
|
||
|
name: {{ template "mariadb.fullname" . }}
|
||
|
key: mariadb-password
|
||
|
{{- end }}
|
||
|
- name: SCRIPT
|
||
|
value: &script |-
|
||
|
mkdir -p /datatmp/gitea/conf
|
||
|
if [ ! -f /datatmp/gitea/conf/app.ini ]; then
|
||
|
sed "s/MARIADB_PASSWORD/${MARIADB_PASSWORD}/g" < /etc/gitea/app.ini > /datatmp/gitea/conf/app.ini
|
||
|
sed -i "s/EXTERNALDB_PASS/${EXTERNALDB_PASS}/g" /datatmp/gitea/conf/app.ini
|
||
|
sed -i "s/EXTERNALDB_USER/${EXTERNALDB_USER}/g" /datatmp/gitea/conf/app.ini
|
||
|
fi
|
||
|
command: ["/bin/sh",'-c', *script]
|
||
|
volumeMounts:
|
||
|
- name: gitea-data
|
||
|
mountPath: /datatmp
|
||
|
- name: gitea-config
|
||
|
mountPath: /etc/gitea
|
||
|
{{- end }}
|