_configuration.tpl 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {{- define "gitea.configuration" -}}
  2. {{ if not (hasPrefix "http" .Values.giteaNetwork.rootURL) }}
  3. {{ fail "Gitea - Expected [Root URL] to have the following format [http(s)://(sub).domain.tld(:port)] or [http://IP_ADDRESS:port]" }}
  4. {{ end }}
  5. {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
  6. {{- $dbHost := (printf "%s-postgres" $fullname) -}}
  7. {{- $dbUser := "gitea" -}}
  8. {{- $dbName := "gitea" -}}
  9. {{- $dbPass := (randAlphaNum 32) -}}
  10. {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-postgres-creds" $fullname)) -}}
  11. {{- $dbPass = ((index .data "POSTGRES_PASSWORD") | b64dec) -}}
  12. {{- end -}}
  13. {{/* Temporary set dynamic db details on values,
  14. so we can print them on the notes */}}
  15. {{- $_ := set .Values "giteaDbPass" $dbPass -}}
  16. {{- $_ := set .Values "giteaDbHost" $dbHost -}}
  17. {{ $dbURL := (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" $dbUser $dbPass $dbHost $dbName) }}
  18. secret:
  19. postgres-creds:
  20. enabled: true
  21. data:
  22. POSTGRES_USER: {{ $dbUser }}
  23. POSTGRES_DB: {{ $dbName }}
  24. POSTGRES_PASSWORD: {{ $dbPass }}
  25. POSTGRES_HOST: {{ $dbHost }}
  26. POSTGRES_URL: {{ $dbURL }}
  27. gitea-creds:
  28. enabled: true
  29. data:
  30. GITEA__database__DB_TYPE: postgres
  31. GITEA__database__PASSWD: {{ $dbPass }}
  32. GITEA__database__HOST: {{ $dbHost }}
  33. GITEA__database__NAME: {{ $dbName }}
  34. GITEA__database__USER: {{ $dbUser }}
  35. configmap:
  36. gitea-config:
  37. enabled: true
  38. data:
  39. {{ $protocol := "http" }}
  40. GITEA__server__HTTP_PORT: {{ .Values.giteaNetwork.webPort | quote }}
  41. GITEA__server__SSH_PORT: {{ .Values.giteaNetwork.externalSshPort | default .Values.giteaNetwork.sshPort | quote }}
  42. GITEA__server__SSH_LISTEN_PORT: {{ .Values.giteaNetwork.sshPort | quote }}
  43. GITEA__server__ROOT_URL: {{ .Values.giteaNetwork.rootURL | quote }}
  44. {{ if .Values.giteaNetwork.certificateID }}
  45. {{ $protocol = "https" }}
  46. GITEA__server__CERT_FILE: /etc/certs/gitea/public.crt
  47. GITEA__server__KEY_FILE: /etc/certs/gitea/private.key
  48. {{ end }}
  49. GITEA__server__PROTOCOL: {{ $protocol }}
  50. {{ with .Values.giteaNetwork.certificateID }}
  51. scaleCertificate:
  52. gitea-cert:
  53. enabled: true
  54. id: {{ . }}
  55. {{ end }}
  56. {{- end -}}