2020-09-25 08:37:55 -05:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: {{ include "gitea.fullname" . }}-init
|
|
|
|
labels:
|
|
|
|
{{- include "gitea.labels" . | nindent 4 }}
|
|
|
|
type: Opaque
|
|
|
|
stringData:
|
|
|
|
init_gitea.sh: |-
|
|
|
|
#!/bin/bash
|
2021-01-20 05:28:39 -06:00
|
|
|
{{- if .Values.initPreScript }}
|
|
|
|
# BEGIN: initPreScript
|
|
|
|
{{- with .Values.initPreScript -}}
|
|
|
|
{{ . | nindent 4}}
|
|
|
|
{{- end -}}
|
|
|
|
# END: initPreScript
|
|
|
|
{{- end }}
|
|
|
|
|
2020-09-25 08:37:55 -05:00
|
|
|
mkdir -p /data/git/.ssh
|
|
|
|
chmod -R 700 /data/git/.ssh
|
|
|
|
mkdir -p /data/gitea/conf
|
|
|
|
cp /etc/gitea/conf/app.ini /data/gitea/conf/app.ini
|
|
|
|
chmod a+rwx /data/gitea/conf/app.ini
|
|
|
|
nc -v -w2 -z {{ include "db.servicename" . }} {{ include "db.port" . }} && \
|
|
|
|
su git -c ' \
|
|
|
|
set -x; \
|
|
|
|
gitea migrate; \
|
|
|
|
{{- if and .Values.gitea.admin.username .Values.gitea.admin.password }}
|
2020-12-10 03:16:13 -06:00
|
|
|
gitea admin create-user --username {{ .Values.gitea.admin.username }} --password '{{ .Values.gitea.admin.password }}' --email {{ .Values.gitea.admin.email }} --admin --must-change-password=false \
|
2020-09-25 08:37:55 -05:00
|
|
|
|| \
|
|
|
|
gitea admin change-password --username {{ .Values.gitea.admin.username }} --password '{{ .Values.gitea.admin.password }}'; \
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.gitea.ldap.enabled }}
|
|
|
|
gitea admin auth add-ldap \
|
2020-12-16 06:37:47 -06:00
|
|
|
{{- include "gitea.ldap_settings" . | nindent 6 }} \
|
2020-09-25 08:37:55 -05:00
|
|
|
|| \
|
|
|
|
( \
|
|
|
|
export GITEA_AUTH_ID=$(gitea admin auth list | grep {{ .Values.gitea.ldap.name | quote }} | awk -F " " "{print \$1}"); \
|
|
|
|
gitea admin auth update-ldap --id ${GITEA_AUTH_ID} \
|
2020-12-16 06:37:47 -06:00
|
|
|
{{- include "gitea.ldap_settings" . | nindent 6 }} \
|
2020-09-25 08:37:55 -05:00
|
|
|
) \
|
|
|
|
{{- end }}
|
2021-01-20 05:28:39 -06:00
|
|
|
'
|