Compare commits

..

17 Commits

Author SHA1 Message Date
37bc343ca9 Use postgres v9.7.2 helm chart (#36)
Merge branch 'master' into postgres-version

Use postgres v9.7.2 helm chart

Co-authored-by: Matti R <matti@mdranta.net>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/36
Reviewed-by: lafriks <lafriks@noreply.gitea.io>
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
2020-09-29 17:15:00 +00:00
b96da586db use alpine package version of helm (#35)
use alpine package version of helm

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/35
Reviewed-by: lafriks <lafriks@noreply.gitea.io>
Reviewed-by: 6543 <6543@noreply.gitea.io>
2020-09-29 13:49:34 +00:00
0877cc81ca Update dependencies and add MariaDB builtIn (#33)
Update dependencies

- Update Postgres version from 8.6.4 to 9.7.3
- Update Mysql version from 6.14.8 to 6.14.10
- Add MariaDB as built in dependency

Co-authored-by: Lucas Hahn <lucas.hahn@novum-rgi.de>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/33
Reviewed-by: Jonas Franz <jonasfranz@noreply.gitea.io>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
2020-09-28 23:26:06 +00:00
4a618f245e Fix NodePort settings for ssh service (#32)
Fix NodePort settings for ssh service

Co-authored-by: Lucas Hahn <lucas.hahn@novum-rgi.de>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/32
Reviewed-by: lafriks <lafriks@noreply.gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
2020-09-28 14:31:35 +00:00
cd982e5fcd Fix indentation error inside of yaml example (#30)
Merge branch 'master' into fix-indentation

Merge branch 'master' into fix-indentation

Fix indentation error inside of yaml example

The `SCHEMA` key belongs to the `database` map. This commit fixes the
indindentation to properly reflect that.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Flavio Castelli <fcastelli@suse.com>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/30
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: Andrew Thornton <art27@cantab.net>
2020-09-25 20:00:46 +00:00
1f95ae962c Move all password related data to secrets (#28)
Bump Chart version

Move all password related data to secrets

Co-authored-by: Lucas Hahn <lucas.hahn@novum-rgi.de>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/28
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-25 13:37:55 +00:00
f7faa6699a 1.4.9 2020-09-24 16:33:09 +00:00
ffd6e5f92c Ability to add pod annotation to statefulset (#24)
ability to add pod annotation

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/24
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
2020-09-24 16:32:11 +00:00
39d6d9b9d5 1.4.8 2020-09-23 21:16:06 +00:00
068d1aafa0 Use recursive chmod for .ssh directory in init container (#26)
Use recursive chmod for .ssh directory in init container

Co-authored-by: Lucas Hahn <lucas.hahn@novum-rgi.de>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/26
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
2020-09-23 21:15:16 +00:00
2082d67ec8 utilize service for port forwarding in instructions (#22)
Merge branch 'master' into techknowlogick-patch-1

Merge branch 'master' into techknowlogick-patch-1

utilize service for port forwarding in instructions

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/22
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-23 04:28:56 +00:00
1a1a001656 Fix ssh permission denied(publickey) at reinstalling the chart without deleting pvc (#25)
Fix ssh permission denied(publickey) at reinstalling the chart without deleting pvc

Co-authored-by: Lucas Hahn <lucas.hahn@novum-rgi.de>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/25
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-23 03:22:20 +00:00
942312a973 1.4.6 2020-09-18 03:21:56 +00:00
c168d47181 Prevent custom HOST name from being overwritten in mysql, postgresql, cache (#23)
Adding same changes to cache

Deleted useDefaultHost value

no longer needed

Eliminated need for useDefaultHost value

Using whether gitea.config.database.HOST exists instead in the values file. If true, don't overwrite. If false, use "mysql/postgresql.dns"

Updated db host logic

Config map uses "postgresql/mysql.dns" when useDefaultHost is true, and the value from gitea.config.database.HOST when useDefaultHost is false.

Added useDefaultHost to built in database values.

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/23
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
2020-09-18 03:21:29 +00:00
8060d080db allow for additional container environment variables (#16)
Co-authored-by: Jasper Orschulko <Jasper.Orschulko@irisgmbh.de>
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/16
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-10 10:15:34 +00:00
9d25bc75d5 update readme to reference latest docker image 2020-09-07 23:32:46 +00:00
df27a3ff10 1.12.4 release of gitea 2020-09-03 21:19:17 -04:00
10 changed files with 150 additions and 75 deletions

View File

@ -4,19 +4,19 @@ name: lint
platform: platform:
os: linux os: linux
arch: amd64 arch: arm64
steps: steps:
- name: lint - name: lint
pull: always pull: always
image: pelotech/drone-helm3 image: alpine:3.12
settings: commands:
helm_command: lint - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm
chart: ./ - helm lint
- name: discord - name: discord
pull: always pull: always
image: appleboy/drone-discord:1.0.0 image: appleboy/drone-discord:1.2.4
environment: environment:
DISCORD_WEBHOOK_ID: DISCORD_WEBHOOK_ID:
from_secret: discord_webhook_id from_secret: discord_webhook_id
@ -44,8 +44,7 @@ steps:
pull: default pull: default
image: alpine:3.12 image: alpine:3.12
commands: commands:
- wget -q https://get.helm.sh/helm-v3.3.1-linux-arm64.tar.gz -O - | tar -xzO linux-arm64/helm > /usr/local/bin/helm - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm
- chmod +x /usr/local/bin/helm
- helm dependency update - helm dependency update
- helm package ./ - helm package ./
- mkdir gitea - mkdir gitea

View File

@ -2,8 +2,8 @@ apiVersion: v2
name: gitea name: gitea
description: Gitea Helm chart for Kubernetes description: Gitea Helm chart for Kubernetes
type: application type: application
version: 1.4.3 version: 1.5.3
appVersion: 1.12.3 appVersion: 1.12.4
icon: https://docs.gitea.io/images/gitea.png icon: https://docs.gitea.io/images/gitea.png
keywords: keywords:
@ -33,9 +33,13 @@ dependencies:
condition: gitea.cache.builtIn.enabled condition: gitea.cache.builtIn.enabled
- name: mysql - name: mysql
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
version: 6.14.8 version: 6.14.10
condition: gitea.database.builtIn.mysql.enabled condition: gitea.database.builtIn.mysql.enabled
- name: postgresql - name: postgresql
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
version: 8.6.4 version: 9.7.2
condition: gitea.database.builtIn.postgresql.enabled condition: gitea.database.builtIn.postgresql.enabled
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 7.10.2
condition: gitea.database.builtIn.mariadb.enabled

View File

@ -175,6 +175,15 @@ Like the admin user the ldap settings can be updated but also disabled or delete
usernameAttribute: CN usernameAttribute: CN
``` ```
### Pod Annotations
Annotations can be added to the Gitea pod.
```yaml
gitea:
podAnnotations: {}
```
## Configuration ## Configuration
### Others ### Others
@ -182,6 +191,7 @@ Like the admin user the ldap settings can be updated but also disabled or delete
| Parameter | Description | Default | | Parameter | Description | Default |
|---------------------|-----------------------------------|------------------------------| |---------------------|-----------------------------------|------------------------------|
|statefulset.terminationGracePeriodSeconds| Image to start for this pod | gitea/gitea | |statefulset.terminationGracePeriodSeconds| Image to start for this pod | gitea/gitea |
|statefulset.env | Additional environment variables to pass to containers | [] |
### Image ### Image
@ -189,7 +199,7 @@ Like the admin user the ldap settings can be updated but also disabled or delete
| Parameter | Description | Default | | Parameter | Description | Default |
|---------------------|-----------------------------------|------------------------------| |---------------------|-----------------------------------|------------------------------|
|image.repository| Image to start for this pod | gitea/gitea | |image.repository| Image to start for this pod | gitea/gitea |
|image.version| Image Version | 1.12.2 | |image.version| Image Version | 1.12.4 |
|image.pullPolicy| Image pull policy | Always | |image.pullPolicy| Image pull policy | Always |
### Persistence ### Persistence

View File

@ -13,7 +13,6 @@
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gitea.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gitea.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.http.type }} {{- else if contains "ClusterIP" .Values.service.http.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "gitea.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:{{ .Values.service.http.port }} to use your application" echo "Visit http://127.0.0.1:{{ .Values.service.http.port }} to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.service.http.port }}:{{ .Values.service.http.port }} kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ .Release.Name }}-http {{ .Values.service.http.port }}:{{ .Values.service.http.port }}
{{- end }} {{- end }}

View File

@ -51,15 +51,13 @@ app.kubernetes.io/name: {{ include "gitea.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end -}}
{{- define "postgresql.dns" -}}
{{- printf "%s-postgresql.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.postgresql.global.postgresql.servicePort -}}
{{- end -}}
{{- define "db.servicename" -}} {{- define "db.servicename" -}}
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}} {{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
{{- printf "%s-postgresql" .Release.Name -}} {{- printf "%s-postgresql" .Release.Name -}}
{{- else if .Values.gitea.database.builtIn.mysql.enabled -}} {{- else if .Values.gitea.database.builtIn.mysql.enabled -}}
{{- printf "%s-mysql" .Release.Name -}} {{- printf "%s-mysql" .Release.Name -}}
{{- else if .Values.gitea.database.builtIn.mariadb.enabled -}}
{{- printf "%s-mariadb" .Release.Name -}}
{{- else -}} {{- else -}}
{{- $parts := split ":" .Values.gitea.config.database.HOST -}} {{- $parts := split ":" .Values.gitea.config.database.HOST -}}
{{- printf "%s %s" $parts._0 $parts._1 -}} {{- printf "%s %s" $parts._0 $parts._1 -}}
@ -71,14 +69,24 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{ .Values.postgresql.global.postgresql.servicePort }} {{ .Values.postgresql.global.postgresql.servicePort }}
{{- else if .Values.gitea.database.builtIn.mysql.enabled -}} {{- else if .Values.gitea.database.builtIn.mysql.enabled -}}
{{ .Values.mysql.service.port }} {{ .Values.mysql.service.port }}
{{- else if .Values.gitea.database.builtIn.mariadb.enabled -}}
{{ .Values.mariadb.service.port }}
{{- else -}} {{- else -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "postgresql.dns" -}}
{{- printf "%s-postgresql.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.postgresql.global.postgresql.servicePort -}}
{{- end -}}
{{- define "mysql.dns" -}} {{- define "mysql.dns" -}}
{{- printf "%s-mysql.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.mysql.service.port | trunc 63 | trimSuffix "-" -}} {{- printf "%s-mysql.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.mysql.service.port | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{- define "mariadb.dns" -}}
{{- printf "%s-mariadb.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.mysql.service.port | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "memcached.dns" -}} {{- define "memcached.dns" -}}
{{- printf "%s-memcached.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.memcached.service.port | trunc 63 | trimSuffix "-" -}} {{- printf "%s-memcached.%s.svc.cluster.local:%g" .Release.Name .Release.Namespace .Values.memcached.service.port | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}

View File

@ -1,10 +1,11 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: {{ include "gitea.fullname" . }} name: {{ include "gitea.fullname" . }}
labels: labels:
{{- include "gitea.labels" . | nindent 4 }} {{- include "gitea.labels" . | nindent 4 }}
data: type: Opaque
stringData:
app.ini: |- app.ini: |-
{{- if not (hasKey .Values.gitea.config "cache") -}} {{- if not (hasKey .Values.gitea.config "cache") -}}
{{- $_ := set .Values.gitea.config "cache" dict -}} {{- $_ := set .Values.gitea.config "cache" dict -}}
@ -65,24 +66,38 @@ data:
{{- /* database default settings */ -}} {{- /* database default settings */ -}}
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}} {{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}} {{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}}
{{- if not (.Values.gitea.config.database.HOST) -}}
{{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql.dns" .) -}} {{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql.dns" .) -}}
{{- end -}}
{{- $_ := set .Values.gitea.config.database "NAME" .Values.postgresql.global.postgresql.postgresqlDatabase -}} {{- $_ := set .Values.gitea.config.database "NAME" .Values.postgresql.global.postgresql.postgresqlDatabase -}}
{{- $_ := set .Values.gitea.config.database "USER" .Values.postgresql.global.postgresql.postgresqlUsername -}} {{- $_ := set .Values.gitea.config.database "USER" .Values.postgresql.global.postgresql.postgresqlUsername -}}
{{- $_ := set .Values.gitea.config.database "PASSWD" .Values.postgresql.global.postgresql.postgresqlPassword -}} {{- $_ := set .Values.gitea.config.database "PASSWD" .Values.postgresql.global.postgresql.postgresqlPassword -}}
{{ else if .Values.gitea.database.builtIn.mysql.enabled -}} {{ else if .Values.gitea.database.builtIn.mysql.enabled -}}
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "mysql" -}} {{- $_ := set .Values.gitea.config.database "DB_TYPE" "mysql" -}}
{{- if not (.Values.gitea.config.database.HOST) -}}
{{- $_ := set .Values.gitea.config.database "HOST" (include "mysql.dns" .) -}} {{- $_ := set .Values.gitea.config.database "HOST" (include "mysql.dns" .) -}}
{{- end -}}
{{- $_ := set .Values.gitea.config.database "NAME" .Values.mysql.db.name -}} {{- $_ := set .Values.gitea.config.database "NAME" .Values.mysql.db.name -}}
{{- $_ := set .Values.gitea.config.database "USER" .Values.mysql.db.user -}} {{- $_ := set .Values.gitea.config.database "USER" .Values.mysql.db.user -}}
{{- $_ := set .Values.gitea.config.database "PASSWD" .Values.mysql.db.password -}} {{- $_ := set .Values.gitea.config.database "PASSWD" .Values.mysql.db.password -}}
{{ else if .Values.gitea.database.builtIn.mariadb.enabled -}}
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "mysql" -}}
{{- if not (.Values.gitea.config.database.HOST) -}}
{{- $_ := set .Values.gitea.config.database "HOST" (include "mariadb.dns" .) -}}
{{- end -}}
{{- $_ := set .Values.gitea.config.database "NAME" .Values.mariadb.db.name -}}
{{- $_ := set .Values.gitea.config.database "USER" .Values.mariadb.db.user -}}
{{- $_ := set .Values.gitea.config.database "PASSWD" .Values.mariadb.db.password -}}
{{- end -}} {{- end -}}
{{- /* cache default settings */ -}} {{- /* cache default settings */ -}}
{{- if .Values.gitea.cache.builtIn.enabled -}} {{- if .Values.gitea.cache.builtIn.enabled -}}
{{- $_ := set .Values.gitea.config.cache "ENABLED" "true" -}} {{- $_ := set .Values.gitea.config.cache "ENABLED" "true" -}}
{{- $_ := set .Values.gitea.config.cache "ADAPTER" "memcache" -}} {{- $_ := set .Values.gitea.config.cache "ADAPTER" "memcache" -}}
{{- if not (.Values.gitea.config.cache.HOST) -}}
{{- $_ := set .Values.gitea.config.cache "HOST" (include "memcached.dns" .) -}} {{- $_ := set .Values.gitea.config.cache "HOST" (include "memcached.dns" .) -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- /* autogenerate app.ini */ -}} {{- /* autogenerate app.ini */ -}}
{{- range $key, $value := .Values.gitea.config }} {{- range $key, $value := .Values.gitea.config }}

57
templates/gitea/init.yaml Normal file
View File

@ -0,0 +1,57 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "gitea.fullname" . }}-init
labels:
{{- include "gitea.labels" . | nindent 4 }}
type: Opaque
stringData:
init_gitea.sh: |-
#!/bin/bash
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 }}
gitea admin create-user --username {{ .Values.gitea.admin.username }} --password '{{ .Values.gitea.admin.password }}' --email {{ .Values.gitea.admin.email }} --admin \
|| \
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 \
--name {{ .Values.gitea.ldap.name | quote }} \
--security-protocol {{ .Values.gitea.ldap.securityProtocol | quote }} \
--host {{ .Values.gitea.ldap.host | quote }} \
--port {{ .Values.gitea.ldap.port | int}} \
--user-search-base {{ .Values.gitea.ldap.userSearchBase | quote }} \
--user-filter {{ .Values.gitea.ldap.userFilter | quote }} \
--admin-filter {{ .Values.gitea.ldap.adminFilter | quote }} \
--email-attribute {{ .Values.gitea.ldap.emailAttribute | quote }} \
--bind-dn {{ .Values.gitea.ldap.bindDn | quote }} \
--bind-password {{ .Values.gitea.ldap.bindPassword | quote }} \
--synchronize-users \
--username-attribute {{ .Values.gitea.ldap.usernameAttribute | quote }} \
|| \
( \
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} \
--name {{ .Values.gitea.ldap.name | quote }} \
--security-protocol {{ .Values.gitea.ldap.securityProtocol | quote }} \
--host {{ .Values.gitea.ldap.host | quote }} \
--port {{ .Values.gitea.ldap.port | int}} \
--user-search-base {{ .Values.gitea.ldap.userSearchBase | quote }} \
--user-filter {{ .Values.gitea.ldap.userFilter | quote }} \
--admin-filter {{ .Values.gitea.ldap.adminFilter | quote }} \
--email-attribute {{ .Values.gitea.ldap.emailAttribute | quote }} \
--bind-dn {{ .Values.gitea.ldap.bindDn | quote }} \
--bind-password {{ .Values.gitea.ldap.bindPassword | quote }} \
--synchronize-users \
--username-attribute {{ .Values.gitea.ldap.usernameAttribute | quote }} \
) \
{{- end }}
'

View File

@ -11,7 +11,7 @@ spec:
{{- if and .Values.service.ssh.loadBalancerIP (eq .Values.service.ssh.type "LoadBalancer") }} {{- if and .Values.service.ssh.loadBalancerIP (eq .Values.service.ssh.type "LoadBalancer") }}
loadBalancerIP: {{ .Values.service.ssh.loadBalancerIP }} loadBalancerIP: {{ .Values.service.ssh.loadBalancerIP }}
{{- end }} {{- end }}
{{- if ne .Values.service.ssh.type "LoadBalancer" }} {{- if eq .Values.service.ssh.type "ClusterIP" }}
clusterIP: None clusterIP: None
{{- end }} {{- end }}
{{- if .Values.service.ssh.externalIPs }} {{- if .Values.service.ssh.externalIPs }}

View File

@ -14,6 +14,9 @@ spec:
metadata: metadata:
annotations: annotations:
checksum/config: {{ include (print $.Template.BasePath "/gitea/config.yaml") . | sha256sum }} checksum/config: {{ include (print $.Template.BasePath "/gitea/config.yaml") . | sha256sum }}
{{- with .Values.gitea.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels: labels:
{{- include "gitea.selectorLabels" . | nindent 8 }} {{- include "gitea.selectorLabels" . | nindent 8 }}
spec: spec:
@ -22,56 +25,10 @@ spec:
initContainers: initContainers:
- name: init - name: init
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}" image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
env: command: ["/usr/sbin/init_gitea.sh"]
- name: SCRIPT
value: &script |-
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 }}
gitea admin create-user --username {{ .Values.gitea.admin.username }} --password '{{ .Values.gitea.admin.password }}' --email {{ .Values.gitea.admin.email }} --admin \
|| \
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 \
--name {{ .Values.gitea.ldap.name | quote }} \
--security-protocol {{ .Values.gitea.ldap.securityProtocol | quote }} \
--host {{ .Values.gitea.ldap.host | quote }} \
--port {{ .Values.gitea.ldap.port | int}} \
--user-search-base {{ .Values.gitea.ldap.userSearchBase | quote }} \
--user-filter {{ .Values.gitea.ldap.userFilter | quote }} \
--admin-filter {{ .Values.gitea.ldap.adminFilter | quote }} \
--email-attribute {{ .Values.gitea.ldap.emailAttribute | quote }} \
--bind-dn {{ .Values.gitea.ldap.bindDn | quote }} \
--bind-password {{ .Values.gitea.ldap.bindPassword | quote }} \
--synchronize-users \
--username-attribute {{ .Values.gitea.ldap.usernameAttribute | quote }} \
|| \
( \
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} \
--name {{ .Values.gitea.ldap.name | quote }} \
--security-protocol {{ .Values.gitea.ldap.securityProtocol | quote }} \
--host {{ .Values.gitea.ldap.host | quote }} \
--port {{ .Values.gitea.ldap.port | int}} \
--user-search-base {{ .Values.gitea.ldap.userSearchBase | quote }} \
--user-filter {{ .Values.gitea.ldap.userFilter | quote }} \
--admin-filter {{ .Values.gitea.ldap.adminFilter | quote }} \
--email-attribute {{ .Values.gitea.ldap.emailAttribute | quote }} \
--bind-dn {{ .Values.gitea.ldap.bindDn | quote }} \
--bind-password {{ .Values.gitea.ldap.bindPassword | quote }} \
--synchronize-users \
--username-attribute {{ .Values.gitea.ldap.usernameAttribute | quote }} \
) \
{{- end }}
'
command: ["/bin/sh",'-c', *script]
volumeMounts: volumeMounts:
- name: init
mountPath: /usr/sbin
- name: config - name: config
mountPath: /etc/gitea/conf mountPath: /etc/gitea/conf
- name: data - name: data
@ -87,6 +44,10 @@ spec:
value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }} value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }}
- name: SSH_PORT - name: SSH_PORT
value: {{ .Values.gitea.config.server.SSH_PORT | quote }} value: {{ .Values.gitea.config.server.SSH_PORT | quote }}
{{- range .Values.statefulset.env }}
- name: {{ .name | quote | nospace }}
value: {{ .value | quote }}
{{- end }}
ports: ports:
- name: ssh - name: ssh
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }} containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
@ -125,9 +86,13 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
- name: init
secret:
secretName: {{ include "gitea.fullname" . }}-init
defaultMode: 0777
- name: config - name: config
configMap: secret:
name: {{ include "gitea.fullname" . }} secretName: {{ include "gitea.fullname" . }}
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }} {{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:

View File

@ -6,7 +6,7 @@ replicaCount: 1
image: image:
repository: gitea/gitea repository: gitea/gitea
version: 1.12.3 version: 1.12.4
pullPolicy: Always pullPolicy: Always
imagePullSecrets: [] imagePullSecrets: []
@ -55,6 +55,9 @@ tolerations: []
affinity: {} affinity: {}
statefulset: statefulset:
env: []
# - name: VARIABLE
# value: my-value
terminationGracePeriodSeconds: 60 terminationGracePeriodSeconds: 60
persistence: persistence:
@ -95,12 +98,16 @@ gitea:
# security: # security:
# PASSWORD_COMPLEXITY: spec # PASSWORD_COMPLEXITY: spec
podAnnotations: {}
database: database:
builtIn: builtIn:
postgresql: postgresql:
enabled: true enabled: true
mysql: mysql:
enabled: false enabled: false
mariadb:
enabled: false
cache: cache:
builtIn: builtIn:
@ -131,3 +138,14 @@ mysql:
port: 3306 port: 3306
persistence: persistence:
size: 10Gi size: 10Gi
mariadb:
db:
name: gitea
user: gitea
password: gitea
service:
port: 3306
master:
persistence:
size: 10Gi