Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2826258cfc | ||
|
943eda6d5f | ||
|
5311243a6e | ||
|
1b21ce2810 | ||
|
4fdf4ef41b | ||
|
63bc10e393 | ||
|
fea1abddd9 | ||
|
33ee018b52 | ||
|
13e210c75f | ||
|
a26b4e10d1 | ||
|
76aee7b25b | ||
|
bf1f5601be | ||
|
729a412803 | ||
|
79690ee488 | ||
|
5398b99514 | ||
|
f62b82e956 | ||
|
ed0ce3d192 | ||
|
8f70a4b9a0 | ||
|
a4e5943ca5 | ||
|
fc9c49179f | ||
|
4c17cc839e | ||
|
d1fac6ce7d | ||
|
37bc343ca9 | ||
|
b96da586db | ||
|
0877cc81ca | ||
|
4a618f245e | ||
|
cd982e5fcd | ||
|
1f95ae962c | ||
|
f7faa6699a | ||
|
ffd6e5f92c | ||
|
39d6d9b9d5 | ||
|
068d1aafa0 | ||
|
2082d67ec8 | ||
|
1a1a001656 | ||
|
942312a973 | ||
|
c168d47181 | ||
|
8060d080db | ||
|
9d25bc75d5 |
15
.drone.yml
15
.drone.yml
@ -4,19 +4,19 @@ name: lint
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: lint
|
||||
pull: always
|
||||
image: pelotech/drone-helm3
|
||||
settings:
|
||||
helm_command: lint
|
||||
chart: ./
|
||||
image: alpine:3.12
|
||||
commands:
|
||||
- apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm
|
||||
- helm lint
|
||||
|
||||
- name: discord
|
||||
pull: always
|
||||
image: appleboy/drone-discord:1.0.0
|
||||
image: appleboy/drone-discord:1.2.4
|
||||
environment:
|
||||
DISCORD_WEBHOOK_ID:
|
||||
from_secret: discord_webhook_id
|
||||
@ -44,8 +44,7 @@ steps:
|
||||
pull: default
|
||||
image: alpine:3.12
|
||||
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
|
||||
- chmod +x /usr/local/bin/helm
|
||||
- apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm
|
||||
- helm dependency update
|
||||
- helm package ./
|
||||
- mkdir gitea
|
||||
|
13
Chart.yaml
13
Chart.yaml
@ -2,8 +2,8 @@ apiVersion: v2
|
||||
name: gitea
|
||||
description: Gitea Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 1.4.4
|
||||
appVersion: 1.12.4
|
||||
version: 2.1.3
|
||||
appVersion: 1.13.0
|
||||
icon: https://docs.gitea.io/images/gitea.png
|
||||
|
||||
keywords:
|
||||
@ -14,6 +14,7 @@ keywords:
|
||||
- gitea
|
||||
- gogs
|
||||
sources:
|
||||
- https://gitea.com/gitea/helm-chart
|
||||
- https://github.com/go-gitea/gitea
|
||||
- https://hub.docker.com/r/gitea/gitea/
|
||||
maintainers:
|
||||
@ -33,9 +34,13 @@ dependencies:
|
||||
condition: gitea.cache.builtIn.enabled
|
||||
- name: mysql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 6.14.8
|
||||
version: 6.14.10
|
||||
condition: gitea.database.builtIn.mysql.enabled
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 8.6.4
|
||||
version: 9.7.2
|
||||
condition: gitea.database.builtIn.postgresql.enabled
|
||||
- name: mariadb
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 8.0.0
|
||||
condition: gitea.database.builtIn.mariadb.enabled
|
||||
|
136
README.md
136
README.md
@ -47,6 +47,56 @@ Gitea offers lots of configuration. This is fully described in the [Gitea Cheat
|
||||
repository.pull-request:
|
||||
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
|
||||
|
||||
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
|
||||
USER: root
|
||||
PASSWD: gitea
|
||||
SCHEMA: gitea
|
||||
SCHEMA: gitea
|
||||
```
|
||||
|
||||
### Ports and external url
|
||||
@ -82,6 +132,34 @@ By default port 3000 is used for web traffic and 22 for ssh. Those can be change
|
||||
|
||||
This helmchart automatically configures the clone urls to use the correct ports. You can change these ports by hand using the gitea.config dict. However you should know what you're doing.
|
||||
|
||||
### ClusterIP
|
||||
|
||||
By default the clusterIP will be set to None, which is the default for headless services. However if you want to omit the clusterIP field in the service, use the following values:
|
||||
|
||||
```yaml
|
||||
service:
|
||||
http:
|
||||
type: ClusterIP
|
||||
port: 3000
|
||||
clusterIP:
|
||||
ssh:
|
||||
type: ClusterIP
|
||||
port: 22
|
||||
clusterIP:
|
||||
```
|
||||
|
||||
### SSH and Ingress
|
||||
|
||||
If you're using ingress and wan't to use SSH, keep in mind, that ingress is not able to forward SSH Ports.
|
||||
You will need a LoadBalancer like metallb and a setting in your ssh service annotations.
|
||||
|
||||
```yaml
|
||||
service:
|
||||
ssh:
|
||||
annotations:
|
||||
metallb.universe.tf/allow-shared-ip: test
|
||||
```
|
||||
|
||||
### Cache
|
||||
|
||||
This helm chart can use a built in cache. The default is memcached from bitnami.
|
||||
@ -104,6 +182,7 @@ If the built in cache should not be used simply configure the cache in gitea.con
|
||||
INTERVAL: 60
|
||||
HOST: 127.0.0.1:9090
|
||||
```
|
||||
|
||||
### Persistence
|
||||
|
||||
Gitea will be deployed as a statefulset. By simply enabling the persistence and setting the storage class according to your cluster
|
||||
@ -157,6 +236,10 @@ It is not possible to delete an admin user after it has been created. This has t
|
||||
### LDAP Settings
|
||||
|
||||
Like the admin user the ldap settings can be updated but also disabled or deleted.
|
||||
All ldap values from https://docs.gitea.io/en-us/command-line/#admin are available.
|
||||
You can either use them in camel case or kebab case.
|
||||
|
||||
camelCase:
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
@ -175,6 +258,34 @@ Like the admin user the ldap settings can be updated but also disabled or delete
|
||||
usernameAttribute: CN
|
||||
```
|
||||
|
||||
kebab-case:
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
ldap:
|
||||
enabled: true
|
||||
name: 'MyAwesomeGiteaLdap'
|
||||
security-protocol: unencrypted
|
||||
host: "127.0.0.1"
|
||||
port: "389"
|
||||
user-search-base: ou=Users,dc=example,dc=com
|
||||
user-filter: sAMAccountName=%s
|
||||
admin-filter: CN=Admin,CN=Group,DC=example,DC=com
|
||||
email-attribute: mail
|
||||
bind-dn: CN=ldap read,OU=Spezial,DC=example,DC=com
|
||||
bind-password: JustAnotherBindPw
|
||||
username-attribute: CN
|
||||
```
|
||||
|
||||
### Pod Annotations
|
||||
|
||||
Annotations can be added to the Gitea pod.
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
podAnnotations: {}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Others
|
||||
@ -182,14 +293,14 @@ Like the admin user the ldap settings can be updated but also disabled or delete
|
||||
| Parameter | Description | Default |
|
||||
|---------------------|-----------------------------------|------------------------------|
|
||||
|statefulset.terminationGracePeriodSeconds| Image to start for this pod | gitea/gitea |
|
||||
|
||||
|statefulset.env | Additional environment variables to pass to containers | [] |
|
||||
|
||||
### Image
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|---------------------|-----------------------------------|------------------------------|
|
||||
|image.repository| Image to start for this pod | gitea/gitea |
|
||||
|image.version| Image Version | 1.12.2 |
|
||||
|image.version| Image Version | 1.13.0 |
|
||||
|image.pullPolicy| Image pull policy | Always |
|
||||
|
||||
### Persistence
|
||||
@ -200,7 +311,7 @@ Like the admin user the ldap settings can be updated but also disabled or delete
|
||||
|persistence.existingClaim| Use an existing claim to store repository information | |
|
||||
|persistence.size| Size for persistence to store repo information | 10Gi |
|
||||
|persistence.accessModes|AccessMode for persistence||
|
||||
|persistence.storageClass|Storage class for repository persistence|standard|
|
||||
|persistence.storageClass|Storage class for repository persistence||
|
||||
|
||||
### Ingress
|
||||
|
||||
@ -252,7 +363,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.mysqlDatabase|Name for new database to create.|gitea|
|
||||
|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
|
||||
|
||||
@ -267,3 +378,18 @@ The following parameters are the defaults set by this chart
|
||||
|postgresql.global.postgresql.postgresqlPassword| PostgreSQL admin password (overrides postgresqlPassword)|gitea|
|
||||
|postgresql.global.postgresql.servicePort|PostgreSQL port (overrides service.port)|5432|
|
||||
|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.auth.username|Username of new user to create.|gitea|
|
||||
|mariadb.auth.password|Password for the new user. Ignored if existing secret is provided|gitea|
|
||||
|mariadb.auth.database|Name for new database to create.|gitea|
|
||||
|mariadb.auth.rootPassword|Password for the root user.|gitea|
|
||||
|mariadb.primary.service.port|Port to connect to mariadb service|3306|
|
||||
|mariadb.primary.persistence.size|Persistence size for mariadb |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 }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- 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"
|
||||
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 }}
|
||||
|
@ -51,15 +51,13 @@ app.kubernetes.io/name: {{ include "gitea.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- 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" -}}
|
||||
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
||||
{{- printf "%s-postgresql" .Release.Name -}}
|
||||
{{- else if .Values.gitea.database.builtIn.mysql.enabled -}}
|
||||
{{- printf "%s-mysql" .Release.Name -}}
|
||||
{{- else if .Values.gitea.database.builtIn.mariadb.enabled -}}
|
||||
{{- printf "%s-mariadb" .Release.Name -}}
|
||||
{{- else -}}
|
||||
{{- $parts := split ":" .Values.gitea.config.database.HOST -}}
|
||||
{{- printf "%s %s" $parts._0 $parts._1 -}}
|
||||
@ -71,19 +69,40 @@ app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{ .Values.postgresql.global.postgresql.servicePort }}
|
||||
{{- else if .Values.gitea.database.builtIn.mysql.enabled -}}
|
||||
{{ .Values.mysql.service.port }}
|
||||
{{- else if .Values.gitea.database.builtIn.mariadb.enabled -}}
|
||||
{{ .Values.mariadb.primary.service.port }}
|
||||
{{- else -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "postgresql.dns" -}}
|
||||
{{- printf "%s-postgresql.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.postgresql.global.postgresql.servicePort -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- 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.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.mysql.service.port | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mariadb.dns" -}}
|
||||
{{- printf "%s-mariadb.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.mariadb.primary.service.port | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- 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.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.memcached.service.port | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gitea.default_domain" -}}
|
||||
{{- printf "%s-gitea.%s.svc.cluster.local" (include "gitea.fullname" .) .Release.Namespace | trunc 63 | trimSuffix "-" -}}
|
||||
{{- printf "%s-gitea.%s.svc.%s" (include "gitea.fullname" .) .Release.Namespace .Values.clusterDomain | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "gitea.ldap_settings" -}}
|
||||
{{- range $key, $val := .Values.gitea.ldap -}}
|
||||
{{- if ne $key "enabled" -}}
|
||||
{{- if eq $key "port" -}}
|
||||
{{- printf "--%s %s " ($key | kebabcase) $val -}}
|
||||
{{- else -}}
|
||||
{{- printf "--%s %s " ($key | kebabcase) ($val | quote) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -1,10 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "gitea.fullname" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
data:
|
||||
type: Opaque
|
||||
stringData:
|
||||
app.ini: |-
|
||||
{{- if not (hasKey .Values.gitea.config "cache") -}}
|
||||
{{- $_ := set .Values.gitea.config "cache" dict -}}
|
||||
@ -61,28 +62,45 @@ data:
|
||||
{{- if not (hasKey .Values.gitea.config.server "SSH_LISTEN_PORT") -}}
|
||||
{{- $_ := set .Values.gitea.config.server "SSH_LISTEN_PORT" .Values.gitea.config.server.SSH_PORT -}}
|
||||
{{- end -}}
|
||||
{{- if not (hasKey .Values.gitea.config.server "APP_DATA_PATH") -}}
|
||||
{{- $_ := set .Values.gitea.config.server "APP_DATA_PATH" "/data" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* database default settings */ -}}
|
||||
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
||||
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}}
|
||||
{{- if not (.Values.gitea.config.database.HOST) -}}
|
||||
{{- $_ := 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 "USER" .Values.postgresql.global.postgresql.postgresqlUsername -}}
|
||||
{{- $_ := set .Values.gitea.config.database "PASSWD" .Values.postgresql.global.postgresql.postgresqlPassword -}}
|
||||
{{ else if .Values.gitea.database.builtIn.mysql.enabled -}}
|
||||
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "mysql" -}}
|
||||
{{- if not (.Values.gitea.config.database.HOST) -}}
|
||||
{{- $_ := 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 "USER" .Values.mysql.db.user -}}
|
||||
{{- $_ := 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.auth.database -}}
|
||||
{{- $_ := set .Values.gitea.config.database "USER" .Values.mariadb.auth.username -}}
|
||||
{{- $_ := set .Values.gitea.config.database "PASSWD" .Values.mariadb.auth.password -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* cache default settings */ -}}
|
||||
{{- if .Values.gitea.cache.builtIn.enabled -}}
|
||||
{{- $_ := set .Values.gitea.config.cache "ENABLED" "true" -}}
|
||||
{{- $_ := set .Values.gitea.config.cache "ADAPTER" "memcache" -}}
|
||||
{{- if not (.Values.gitea.config.cache.HOST) -}}
|
||||
{{- $_ := set .Values.gitea.config.cache "HOST" (include "memcached.dns" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* autogenerate app.ini */ -}}
|
||||
{{- range $key, $value := .Values.gitea.config }}
|
||||
|
@ -4,9 +4,16 @@ metadata:
|
||||
name: {{ include "gitea.fullname" . }}-http
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- toYaml .Values.service.http.annotations | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.http.type }}
|
||||
clusterIP: None
|
||||
{{- if and .Values.service.http.loadBalancerIP (eq .Values.service.http.type "LoadBalancer") }}
|
||||
loadBalancerIP: {{ .Values.service.http.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and .Values.service.http.clusterIP (eq .Values.service.http.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.service.http.clusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.http.port }}
|
||||
|
@ -1,7 +1,9 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "gitea.fullname" . -}}
|
||||
{{- $httpPort := .Values.service.http.port -}}
|
||||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
@ -32,8 +34,18 @@ spec:
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||
pathType: Prefix
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
|
||||
service:
|
||||
name: {{ $fullName }}-http
|
||||
port:
|
||||
number: {{ $httpPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}-http
|
||||
servicePort: {{ $httpPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
35
templates/gitea/init.yaml
Normal file
35
templates/gitea/init.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
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 --must-change-password=false \
|
||||
|| \
|
||||
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 \
|
||||
{{- include "gitea.ldap_settings" . | nindent 6 }} \
|
||||
|| \
|
||||
( \
|
||||
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} \
|
||||
{{- include "gitea.ldap_settings" . | nindent 6 }} \
|
||||
) \
|
||||
{{- end }}
|
||||
'
|
@ -5,18 +5,18 @@ metadata:
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{ toYaml .Values.service.ssh.annotations | indent 4 }}
|
||||
{{- toYaml .Values.service.ssh.annotations | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.ssh.type }}
|
||||
{{- if and .Values.service.ssh.loadBalancerIP (eq .Values.service.ssh.type "LoadBalancer") }}
|
||||
loadBalancerIP: {{ .Values.service.ssh.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.service.ssh.type "LoadBalancer" }}
|
||||
clusterIP: None
|
||||
{{- if and .Values.service.ssh.clusterIP (eq .Values.service.ssh.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.service.ssh.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.ssh.externalIPs }}
|
||||
externalIPs:
|
||||
{{ toYaml .Values.service.ssh.externalIPs | indent 4 }}
|
||||
{{- toYaml .Values.service.ssh.externalIPs | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.ssh.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ .Values.service.ssh.externalTrafficPolicy }}
|
||||
|
@ -14,64 +14,25 @@ spec:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/gitea/config.yaml") . | sha256sum }}
|
||||
{{- with .Values.gitea.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "gitea.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
initContainers:
|
||||
- name: init
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
|
||||
env:
|
||||
- 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]
|
||||
command: ["/usr/sbin/init_gitea.sh"]
|
||||
volumeMounts:
|
||||
- name: init
|
||||
mountPath: /usr/sbin
|
||||
- name: config
|
||||
mountPath: /etc/gitea/conf
|
||||
- name: data
|
||||
@ -87,6 +48,10 @@ spec:
|
||||
value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }}
|
||||
- name: SSH_PORT
|
||||
value: {{ .Values.gitea.config.server.SSH_PORT | quote }}
|
||||
{{- range .Values.statefulset.env }}
|
||||
- name: {{ .name | quote | nospace }}
|
||||
value: {{ .value | quote }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: ssh
|
||||
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
|
||||
@ -125,9 +90,13 @@ spec:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: init
|
||||
secret:
|
||||
secretName: {{ include "gitea.fullname" . }}-init
|
||||
defaultMode: 0777
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "gitea.fullname" . }}
|
||||
secret:
|
||||
secretName: {{ include "gitea.fullname" . }}
|
||||
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
@ -144,7 +113,9 @@ spec:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
storageClassName: {{ .Values.persistence.storageClass | default "standard" | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
storageClassName: {{ .Values.persistence.storageClass | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
|
@ -11,5 +11,5 @@ spec:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "gitea.fullname" . }}:{{ .Values.service.port }}']
|
||||
args: ['{{ include "gitea.fullname" . }}-http:{{ .Values.service.http.port }}']
|
||||
restartPolicy: Never
|
29
values.yaml
29
values.yaml
@ -4,9 +4,11 @@
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
clusterDomain: cluster.local
|
||||
|
||||
image:
|
||||
repository: gitea/gitea
|
||||
version: 1.12.4
|
||||
version: 1.13.0
|
||||
pullPolicy: Always
|
||||
|
||||
imagePullSecrets: []
|
||||
@ -15,9 +17,14 @@ service:
|
||||
http:
|
||||
type: ClusterIP
|
||||
port: 3000
|
||||
clusterIP: None
|
||||
#loadBalancerIP:
|
||||
#nodePort:
|
||||
annotations:
|
||||
ssh:
|
||||
type: ClusterIP
|
||||
port: 22
|
||||
clusterIP: None
|
||||
#loadBalancerIP:
|
||||
#nodePort:
|
||||
#externalTrafficPolicy:
|
||||
@ -55,6 +62,9 @@ tolerations: []
|
||||
affinity: {}
|
||||
|
||||
statefulset:
|
||||
env: []
|
||||
# - name: VARIABLE
|
||||
# value: my-value
|
||||
terminationGracePeriodSeconds: 60
|
||||
|
||||
persistence:
|
||||
@ -63,7 +73,6 @@ persistence:
|
||||
size: 10Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClass: standard
|
||||
|
||||
gitea:
|
||||
admin:
|
||||
@ -95,12 +104,16 @@ gitea:
|
||||
# security:
|
||||
# PASSWORD_COMPLEXITY: spec
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
database:
|
||||
builtIn:
|
||||
postgresql:
|
||||
enabled: true
|
||||
mysql:
|
||||
enabled: false
|
||||
mariadb:
|
||||
enabled: false
|
||||
|
||||
cache:
|
||||
builtIn:
|
||||
@ -131,3 +144,15 @@ mysql:
|
||||
port: 3306
|
||||
persistence:
|
||||
size: 10Gi
|
||||
|
||||
mariadb:
|
||||
auth:
|
||||
database: gitea
|
||||
username: gitea
|
||||
password: gitea
|
||||
rootPassword: gitea
|
||||
primary:
|
||||
service:
|
||||
port: 3306
|
||||
persistence:
|
||||
size: 10Gi
|
||||
|
Reference in New Issue
Block a user