Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
4c17cc839e | |||
d1fac6ce7d | |||
37bc343ca9 | |||
b96da586db | |||
0877cc81ca | |||
4a618f245e | |||
cd982e5fcd | |||
1f95ae962c | |||
f7faa6699a | |||
ffd6e5f92c | |||
39d6d9b9d5 | |||
068d1aafa0 | |||
2082d67ec8 |
15
.drone.yml
15
.drone.yml
@ -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
|
||||||
|
12
Chart.yaml
12
Chart.yaml
@ -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.7
|
version: 1.5.5
|
||||||
appVersion: 1.12.4
|
appVersion: 1.12.5
|
||||||
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
|
||||||
|
79
README.md
79
README.md
@ -47,6 +47,56 @@ Gitea offers lots of configuration. This is fully described in the [Gitea Cheat
|
|||||||
repository.pull-request:
|
repository.pull-request:
|
||||||
WORK_IN_PROGRESS_PREFIXES: "WIP:,[WIP]:"
|
WORK_IN_PROGRESS_PREFIXES: "WIP:,[WIP]:"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Default Configuration
|
||||||
|
|
||||||
|
This chart will set a few defaults in the gitea configuration based on the service and ingress settings. All defaults can be overwritten in gitea.config.
|
||||||
|
|
||||||
|
INSTALL_LOCK is always set to true, since we want to configure gitea with this helm chart and everything is taken care of.
|
||||||
|
|
||||||
|
*All default settings are made directly in the generated app.ini, not in the Values.*
|
||||||
|
|
||||||
|
#### Database defaults
|
||||||
|
|
||||||
|
If a builtIn database is enabled the database configuration is set automatically. For example postgresql builtIn which will appear in the app.ini as:
|
||||||
|
|
||||||
|
```
|
||||||
|
[database]
|
||||||
|
DB_TYPE = postgres
|
||||||
|
HOST = RELEASE-NAME-postgresql.default.svc.cluster.local:5432
|
||||||
|
NAME = gitea
|
||||||
|
PASSWD = gitea
|
||||||
|
USER = gitea
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Memcached defaults
|
||||||
|
|
||||||
|
Memcached is handled the exakt same way as database builtIn. Once memcached builtIn is enabled, this chart will generate the following part in the app.ini:
|
||||||
|
|
||||||
|
```
|
||||||
|
[cache]
|
||||||
|
ADAPTER = memcache
|
||||||
|
ENABLED = true
|
||||||
|
HOST = RELEASE-NAME-memcached.default.svc.cluster.local:11211
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Server defaults
|
||||||
|
|
||||||
|
The server defaults are a bit more complex.
|
||||||
|
If ingress is enabled, the ROOT_URL, DOMAIN and SSH_DOMAIN will be set accordingly. HTTP_PORT always defaults to 3000 as well as SSH_PORT to 22.
|
||||||
|
|
||||||
|
```
|
||||||
|
[server]
|
||||||
|
APP_DATA_PATH = /data
|
||||||
|
DOMAIN = git.example.com
|
||||||
|
HTTP_PORT = 3000
|
||||||
|
PROTOCOL = http
|
||||||
|
ROOT_URL = http://git.example.com
|
||||||
|
SSH_DOMAIN = git.example.com
|
||||||
|
SSH_LISTEN_PORT = 22
|
||||||
|
SSH_PORT = 22
|
||||||
|
```
|
||||||
|
|
||||||
### External Database
|
### External Database
|
||||||
|
|
||||||
An external Database can be used instead of builtIn postgresql or mysql.
|
An external Database can be used instead of builtIn postgresql or mysql.
|
||||||
@ -65,7 +115,7 @@ An external Database can be used instead of builtIn postgresql or mysql.
|
|||||||
NAME: gitea
|
NAME: gitea
|
||||||
USER: root
|
USER: root
|
||||||
PASSWD: gitea
|
PASSWD: gitea
|
||||||
SCHEMA: gitea
|
SCHEMA: gitea
|
||||||
```
|
```
|
||||||
|
|
||||||
### Ports and external url
|
### Ports and external url
|
||||||
@ -104,6 +154,7 @@ If the built in cache should not be used simply configure the cache in gitea.con
|
|||||||
INTERVAL: 60
|
INTERVAL: 60
|
||||||
HOST: 127.0.0.1:9090
|
HOST: 127.0.0.1:9090
|
||||||
```
|
```
|
||||||
|
|
||||||
### Persistence
|
### Persistence
|
||||||
|
|
||||||
Gitea will be deployed as a statefulset. By simply enabling the persistence and setting the storage class according to your cluster
|
Gitea will be deployed as a statefulset. By simply enabling the persistence and setting the storage class according to your cluster
|
||||||
@ -175,6 +226,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
|
||||||
@ -184,7 +244,6 @@ Like the admin user the ldap settings can be updated but also disabled or delete
|
|||||||
|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 | [] |
|
|statefulset.env | Additional environment variables to pass to containers | [] |
|
||||||
|
|
||||||
|
|
||||||
### Image
|
### Image
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
@ -253,7 +312,7 @@ The following parameters are the defaults set by this chart
|
|||||||
|mysql.mysqlPassword|Password for the new user. Ignored if existing secret is provided|gitea|
|
|mysql.mysqlPassword|Password for the new user. Ignored if existing secret is provided|gitea|
|
||||||
|mysql.mysqlDatabase|Name for new database to create.|gitea|
|
|mysql.mysqlDatabase|Name for new database to create.|gitea|
|
||||||
|mysql.service.port|Port to connect to mysql service|3306|
|
|mysql.service.port|Port to connect to mysql service|3306|
|
||||||
|mysql.persistence|Persistence size for mysql |10Gi|
|
|mysql.persistence.size|Persistence size for mysql |10Gi|
|
||||||
|
|
||||||
### Postgresql BuiltIn
|
### Postgresql BuiltIn
|
||||||
|
|
||||||
@ -268,3 +327,17 @@ The following parameters are the defaults set by this chart
|
|||||||
|postgresql.global.postgresql.postgresqlPassword| PostgreSQL admin password (overrides postgresqlPassword)|gitea|
|
|postgresql.global.postgresql.postgresqlPassword| PostgreSQL admin password (overrides postgresqlPassword)|gitea|
|
||||||
|postgresql.global.postgresql.servicePort|PostgreSQL port (overrides service.port)|5432|
|
|postgresql.global.postgresql.servicePort|PostgreSQL port (overrides service.port)|5432|
|
||||||
|postgresql.persistence.size| PVC Storage Request for PostgreSQL volume |10Gi|
|
|postgresql.persistence.size| PVC Storage Request for PostgreSQL volume |10Gi|
|
||||||
|
|
||||||
|
### MariaDB BuiltIn
|
||||||
|
|
||||||
|
MariaDB is loaded as a dependency from bitnami. Configuration can be found from this [Bitnami](https://github.com/bitnami/charts/tree/master/bitnami/mariadb)
|
||||||
|
|
||||||
|
The following parameters are the defaults set by this chart
|
||||||
|
|
||||||
|
| Parameter | Description | Default |
|
||||||
|
|---------------------|-----------------------------------|------------------------------|
|
||||||
|
|mariadb.db.user |Username of new user to create.|gitea|
|
||||||
|
|mariadb.db.password|Password for the new user. Ignored if existing secret is provided|gitea|
|
||||||
|
|mariadb.db.name|Name for new database to create.|gitea|
|
||||||
|
|mariadb.service.port|Port to connect to mariadb service|3306|
|
||||||
|
|mariadb.master.persistence.size|Persistence size for mysql |10Gi|
|
||||||
|
@ -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 }}
|
||||||
|
@ -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 -}}
|
||||||
|
@ -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 -}}
|
||||||
@ -61,6 +62,9 @@ data:
|
|||||||
{{- if not (hasKey .Values.gitea.config.server "SSH_LISTEN_PORT") -}}
|
{{- if not (hasKey .Values.gitea.config.server "SSH_LISTEN_PORT") -}}
|
||||||
{{- $_ := set .Values.gitea.config.server "SSH_LISTEN_PORT" .Values.gitea.config.server.SSH_PORT -}}
|
{{- $_ := set .Values.gitea.config.server "SSH_LISTEN_PORT" .Values.gitea.config.server.SSH_PORT -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- if not (hasKey .Values.gitea.config.server "APP_DATA_PATH") -}}
|
||||||
|
{{- $_ := set .Values.gitea.config.server "APP_DATA_PATH" "/data" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* database default settings */ -}}
|
{{- /* database default settings */ -}}
|
||||||
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
||||||
@ -79,6 +83,14 @@ data:
|
|||||||
{{- $_ := 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 */ -}}
|
||||||
|
57
templates/gitea/init.yaml
Normal file
57
templates/gitea/init.yaml
Normal 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 }}
|
||||||
|
'
|
@ -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 }}
|
||||||
|
@ -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,58 +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/git/.ssh
|
|
||||||
chmod 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 }}
|
|
||||||
'
|
|
||||||
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
|
||||||
@ -131,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:
|
||||||
|
17
values.yaml
17
values.yaml
@ -6,7 +6,7 @@ replicaCount: 1
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
repository: gitea/gitea
|
repository: gitea/gitea
|
||||||
version: 1.12.4
|
version: 1.12.5
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
|
|
||||||
imagePullSecrets: []
|
imagePullSecrets: []
|
||||||
@ -98,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:
|
||||||
@ -134,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
|
Reference in New Issue
Block a user