_gitea.tpl 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {{- define "gitea.workload" -}}
  2. workload:
  3. gitea:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.giteaNetwork.hostNetwork }}
  9. containers:
  10. gitea:
  11. enabled: true
  12. primary: true
  13. imageSelector: image
  14. securityContext:
  15. runAsUser: {{ .Values.giteaRunAs.user }}
  16. runAsGroup: {{ .Values.giteaRunAs.group }}
  17. envFrom:
  18. - secretRef:
  19. name: gitea-creds
  20. - configMapRef:
  21. name: gitea-config
  22. {{ with .Values.giteaConfig.additionalEnvs }}
  23. envList:
  24. {{ range $env := . }}
  25. - name: {{ $env.name }}
  26. value: {{ $env.value }}
  27. {{ end }}
  28. {{ end }}
  29. probes:
  30. {{ $protocol := "http" }}
  31. {{ if .Values.giteaNetwork.certificateID }}
  32. {{ $protocol = "https" }}
  33. {{ end }}
  34. liveness:
  35. enabled: true
  36. type: {{ $protocol }}
  37. path: /api/healthz
  38. port: {{ .Values.giteaNetwork.webPort }}
  39. readiness:
  40. enabled: true
  41. type: {{ $protocol }}
  42. path: /api/healthz
  43. port: {{ .Values.giteaNetwork.webPort }}
  44. startup:
  45. enabled: true
  46. type: {{ $protocol }}
  47. path: /api/healthz
  48. port: {{ .Values.giteaNetwork.webPort }}
  49. initContainers:
  50. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  51. "UID" .Values.giteaRunAs.user
  52. "GID" .Values.giteaRunAs.group
  53. "mode" "check"
  54. "type" "install") | nindent 8 }}
  55. {{- include "ix.v1.common.app.postgresWait" (dict "name" "postgres-wait"
  56. "secretName" "postgres-creds") | nindent 8 }}
  57. {{/* Service */}}
  58. service:
  59. gitea:
  60. enabled: true
  61. primary: true
  62. type: NodePort
  63. targetSelector: gitea
  64. ports:
  65. webui:
  66. enabled: true
  67. primary: true
  68. port: {{ .Values.giteaNetwork.webPort }}
  69. nodePort: {{ .Values.giteaNetwork.webPort }}
  70. targetSelector: gitea
  71. ssh:
  72. enabled: true
  73. port: {{ .Values.giteaNetwork.sshPort }}
  74. nodePort: {{ .Values.giteaNetwork.sshPort }}
  75. targetSelector: gitea
  76. {{/* Persistence */}}
  77. persistence:
  78. data:
  79. enabled: true
  80. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.giteaStorage.data) | nindent 4 }}
  81. targetSelector:
  82. gitea:
  83. gitea:
  84. mountPath: /var/lib/gitea
  85. {{- if and (eq .Values.giteaStorage.data.type "ixVolume")
  86. (not (.Values.giteaStorage.data.ixVolumeConfig | default dict).aclEnable) }}
  87. 01-permissions:
  88. mountPath: /mnt/directories/data
  89. {{- end }}
  90. config:
  91. enabled: true
  92. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.giteaStorage.config) | nindent 4 }}
  93. targetSelector:
  94. gitea:
  95. gitea:
  96. mountPath: /etc/gitea
  97. {{- if and (eq .Values.giteaStorage.config.type "ixVolume")
  98. (not (.Values.giteaStorage.config.ixVolumeConfig | default dict).aclEnable) }}
  99. 01-permissions:
  100. mountPath: /mnt/directories/config
  101. {{- end }}
  102. gitea-temp:
  103. enabled: true
  104. type: emptyDir
  105. targetSelector:
  106. gitea:
  107. gitea:
  108. mountPath: /tmp/gitea
  109. {{- range $idx, $storage := .Values.giteaStorage.additionalStorages }}
  110. {{ printf "gitea-%v:" (int $idx) }}
  111. enabled: true
  112. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  113. targetSelector:
  114. gitea:
  115. gitea:
  116. mountPath: {{ $storage.mountPath }}
  117. {{- if and (eq $storage.type "ixVolume") (not ($storage.ixVolumeConfig | default dict).aclEnable) }}
  118. 01-permissions:
  119. mountPath: /mnt/directories{{ $storage.mountPath }}
  120. {{- end }}
  121. {{- end }}
  122. {{ if .Values.giteaNetwork.certificateID }}
  123. cert:
  124. enabled: true
  125. type: secret
  126. objectName: gitea-cert
  127. defaultMode: "0600"
  128. items:
  129. - key: tls.key
  130. path: private.key
  131. - key: tls.crt
  132. path: public.crt
  133. targetSelector:
  134. gitea:
  135. gitea:
  136. mountPath: /etc/certs/gitea
  137. readOnly: true
  138. {{ end }}
  139. {{- end -}}