Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
28e94f96e3 | ||
|
b5ab7201d1 | ||
|
4ad5cf1d19 | ||
|
7f828e87f6 | ||
|
57479bdf37 | ||
|
0c8f226f1f | ||
|
daba777e24 | ||
|
54cc78b43a | ||
|
94ee162ad5 | ||
|
9b2e76c9cf | ||
|
2c066d7c9e |
@ -41,19 +41,19 @@ trigger:
|
||||
|
||||
steps:
|
||||
- name: generate-chart
|
||||
pull: default
|
||||
pull: always
|
||||
image: alpine:3.12
|
||||
commands:
|
||||
- apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm
|
||||
- helm dependency update
|
||||
- helm package ./
|
||||
- helm package --version "${DRONE_TAG##v}" ./
|
||||
- mkdir gitea
|
||||
- mv gitea*.tgz gitea/
|
||||
- wget -O gitea/index.yaml https://dl.gitea.io/charts/index.yaml
|
||||
- helm repo index gitea/ --url https://dl.gitea.io/charts --merge gitea/index.yaml
|
||||
|
||||
- name: upload-chart
|
||||
pull: default
|
||||
pull: always
|
||||
image: plugins/s3:latest
|
||||
settings:
|
||||
bucket: releases
|
||||
|
@ -2,8 +2,8 @@ apiVersion: v2
|
||||
name: gitea
|
||||
description: Gitea Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 2.1.3
|
||||
appVersion: 1.13.0
|
||||
version: 0.0.0
|
||||
appVersion: 1.13.2
|
||||
icon: https://docs.gitea.io/images/gitea.png
|
||||
|
||||
keywords:
|
||||
|
67
README.md
67
README.md
@ -4,9 +4,9 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
This helm chart has taken some inspiration from https://github.com/jfelten/gitea-helm-chart
|
||||
This helm chart has taken some inspiration from <https://github.com/jfelten/gitea-helm-chart>
|
||||
But takes a completly different approach in providing database and cache with dependencies.
|
||||
Also this chart provides ldap and admin user configuration with values as well as it is deployed as statefulset to retain stored repositories.
|
||||
Also this chart provides LDAP and admin user configuration with values as well as it is deployed as statefulset to retain stored repositories.
|
||||
|
||||
## Dependencies
|
||||
|
||||
@ -21,7 +21,7 @@ Dependencies:
|
||||
|
||||
## Installing
|
||||
|
||||
```
|
||||
```sh
|
||||
helm repo add gitea-charts https://dl.gitea.io/charts/
|
||||
helm install gitea gitea-charts/gitea
|
||||
```
|
||||
@ -60,7 +60,7 @@ INSTALL_LOCK is always set to true, since we want to configure gitea with this h
|
||||
|
||||
If a builtIn database is enabled the database configuration is set automatically. For example postgresql builtIn which will appear in the app.ini as:
|
||||
|
||||
```
|
||||
```ini
|
||||
[database]
|
||||
DB_TYPE = postgres
|
||||
HOST = RELEASE-NAME-postgresql.default.svc.cluster.local:5432
|
||||
@ -73,7 +73,7 @@ USER = gitea
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
```ini
|
||||
[cache]
|
||||
ADAPTER = memcache
|
||||
ENABLED = true
|
||||
@ -85,7 +85,7 @@ HOST = RELEASE-NAME-memcached.default.svc.cluster.local:11211
|
||||
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.
|
||||
|
||||
```
|
||||
```ini
|
||||
[server]
|
||||
APP_DATA_PATH = /data
|
||||
DOMAIN = git.example.com
|
||||
@ -95,6 +95,16 @@ ROOT_URL = http://git.example.com
|
||||
SSH_DOMAIN = git.example.com
|
||||
SSH_LISTEN_PORT = 22
|
||||
SSH_PORT = 22
|
||||
ENABLE_PPROF = false
|
||||
```
|
||||
|
||||
#### Metrics defaults
|
||||
|
||||
The Prometheus `/metrics` endpoint is disabled by default.
|
||||
|
||||
```ini
|
||||
[metrics]
|
||||
ENABLED = false
|
||||
```
|
||||
|
||||
### External Database
|
||||
@ -188,9 +198,9 @@ If the built in cache should not be used simply configure the cache in gitea.con
|
||||
Gitea will be deployed as a statefulset. By simply enabling the persistence and setting the storage class according to your cluster
|
||||
everything else will be taken care of. The following example will create a PVC as a part of the statefulset. This PVC will not be deleted
|
||||
even if you uninstall the chart.
|
||||
When using Postgresql as dependency, this will also be deployed as a statefulset by default.
|
||||
When using Postgresql as dependency, this will also be deployed as a statefulset by default.
|
||||
|
||||
If you want to manage your own PVC you can simply pass the PVC name to the chart.
|
||||
If you want to manage your own PVC you can simply pass the PVC name to the chart.
|
||||
|
||||
```yaml
|
||||
persistence:
|
||||
@ -200,7 +210,7 @@ If you want to manage your own PVC you can simply pass the PVC name to the chart
|
||||
|
||||
In case that peristence has been disabled it will simply use an empty dir volume.
|
||||
|
||||
Postgresql handles the persistence in the exact same way.
|
||||
Postgresql handles the persistence in the exact same way.
|
||||
You can interact with the postgres settings as displayed in the following example:
|
||||
|
||||
```yaml
|
||||
@ -224,6 +234,7 @@ You can interact with the postgres settings as displayed in the following exampl
|
||||
|
||||
This chart enables you to create a default admin user. It is also possible to update the password for this user by upgrading or redeloying the chart.
|
||||
It is not possible to delete an admin user after it has been created. This has to be done in the ui.
|
||||
You cannot use `admin` as username.
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
@ -235,8 +246,8 @@ 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.
|
||||
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:
|
||||
@ -256,6 +267,7 @@ camelCase:
|
||||
bindDn: CN=ldap read,OU=Spezial,DC=example,DC=com
|
||||
bindPassword: JustAnotherBindPw
|
||||
usernameAttribute: CN
|
||||
sshPublicKeyAttribute: sshPublicKey
|
||||
```
|
||||
|
||||
kebab-case:
|
||||
@ -277,6 +289,24 @@ kebab-case:
|
||||
username-attribute: CN
|
||||
```
|
||||
|
||||
### Metrics and profiling
|
||||
|
||||
A Prometheus `/metrics` endpoint on the `HTTP_PORT` and `pprof` profiling endpoints on port 6060 can be enabled under `gitea`. Beware that the metrics endpoint is exposed via the ingress, manage access using ingress annotations for example.
|
||||
|
||||
To deploy the `ServiceMonitor`, you first need to ensure that you have deployed `prometheus-operator` and its CRDs: https://github.com/prometheus-operator/prometheus-operator#customresourcedefinitions.
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
metrics:
|
||||
enabled: true
|
||||
serviceMonitor:
|
||||
enabled: true
|
||||
|
||||
config:
|
||||
server:
|
||||
PPROF_ENABLED: true
|
||||
```
|
||||
|
||||
### Pod Annotations
|
||||
|
||||
Annotations can be added to the Gitea pod.
|
||||
@ -290,17 +320,20 @@ Annotations can be added to the Gitea pod.
|
||||
|
||||
### Others
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|---------------------|-----------------------------------|------------------------------|
|
||||
|statefulset.terminationGracePeriodSeconds| Image to start for this pod | gitea/gitea |
|
||||
|statefulset.env | Additional environment variables to pass to containers | [] |
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|--------------------------------------------------------|-------------|
|
||||
| statefulset.terminationGracePeriodSeconds | Image to start for this pod | gitea/gitea |
|
||||
| statefulset.env | Additional environment variables to pass to containers | [] |
|
||||
| extraVolumes | Additional volumes to mount to the Gitea statefulset | {} |
|
||||
| extraVolumeMounts | Additional volumes mounts for the Gitea containers | {} |
|
||||
| initPreScript | Bash script copied verbatim to start of init container | |
|
||||
|
||||
### Image
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|---------------------|-----------------------------------|------------------------------|
|
||||
|image.repository| Image to start for this pod | gitea/gitea |
|
||||
|image.version| Image Version | 1.13.0 |
|
||||
|image.tag| [Image tag](https://hub.docker.com/r/gitea/gitea/tags?page=1&ordering=last_updated) | 1.13.2 |
|
||||
|image.pullPolicy| Image pull policy | Always |
|
||||
|
||||
### Persistence
|
||||
@ -312,6 +345,8 @@ Annotations can be added to the Gitea pod.
|
||||
|persistence.size| Size for persistence to store repo information | 10Gi |
|
||||
|persistence.accessModes|AccessMode for persistence||
|
||||
|persistence.storageClass|Storage class for repository persistence||
|
||||
|persistence.labels|Labels for the persistence volume claim to be created|{}|
|
||||
|persistence.annotations|Annotations for the persistence volume claim to be created|{}|
|
||||
|
||||
### Ingress
|
||||
|
||||
|
@ -99,7 +99,7 @@ app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- range $key, $val := .Values.gitea.ldap -}}
|
||||
{{- if ne $key "enabled" -}}
|
||||
{{- if eq $key "port" -}}
|
||||
{{- printf "--%s %s " ($key | kebabcase) $val -}}
|
||||
{{- printf "--%s %d " ($key | kebabcase) ($val | int) -}}
|
||||
{{- else -}}
|
||||
{{- printf "--%s %s " ($key | kebabcase) ($val | quote) -}}
|
||||
{{- end -}}
|
||||
|
@ -15,6 +15,10 @@ stringData:
|
||||
{{- $_ := set .Values.gitea.config "server" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey .Values.gitea.config "metrics") -}}
|
||||
{{- $_ := set .Values.gitea.config "metrics" dict -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (hasKey .Values.gitea.config "database") -}}
|
||||
{{- $_ := set .Values.gitea.config "database" dict -}}
|
||||
{{- end -}}
|
||||
@ -65,6 +69,14 @@ stringData:
|
||||
{{- if not (hasKey .Values.gitea.config.server "APP_DATA_PATH") -}}
|
||||
{{- $_ := set .Values.gitea.config.server "APP_DATA_PATH" "/data" -}}
|
||||
{{- end -}}
|
||||
{{- if not (hasKey .Values.gitea.config.server "PPROF_ENABLED") -}}
|
||||
{{- $_ := set .Values.gitea.config.server "PPROF_ENABLED" false -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* metrics default settings */ -}}
|
||||
{{- if not (hasKey .Values.gitea.config.metrics "ENABLED") -}}
|
||||
{{- $_ := set .Values.gitea.config.metrics "ENABLED" .Values.gitea.metrics.enabled -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* database default settings */ -}}
|
||||
{{- if .Values.gitea.database.builtIn.postgresql.enabled -}}
|
||||
|
@ -8,6 +8,14 @@ type: Opaque
|
||||
stringData:
|
||||
init_gitea.sh: |-
|
||||
#!/bin/bash
|
||||
{{- if .Values.initPreScript }}
|
||||
# BEGIN: initPreScript
|
||||
{{- with .Values.initPreScript -}}
|
||||
{{ . | nindent 4}}
|
||||
{{- end -}}
|
||||
# END: initPreScript
|
||||
{{- end }}
|
||||
|
||||
mkdir -p /data/git/.ssh
|
||||
chmod -R 700 /data/git/.ssh
|
||||
mkdir -p /data/gitea/conf
|
||||
@ -32,4 +40,4 @@ stringData:
|
||||
{{- include "gitea.ldap_settings" . | nindent 6 }} \
|
||||
) \
|
||||
{{- end }}
|
||||
'
|
||||
'
|
||||
|
14
templates/gitea/servicemonitor.yaml
Normal file
14
templates/gitea/servicemonitor.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- if .Values.gitea.metrics.serviceMonitor.enabled -}}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "gitea.fullname" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "gitea.selectorLabels" . | nindent 6 }}
|
||||
endpoints:
|
||||
- port: http
|
||||
{{- end -}}
|
@ -8,8 +8,16 @@ metadata:
|
||||
{{- 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") }}
|
||||
{{- if eq .Values.service.ssh.type "LoadBalancer" }}
|
||||
{{- if .Values.service.ssh.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.service.ssh.loadBalancerIP }}
|
||||
{{- end -}}
|
||||
{{- if .Values.service.ssh.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{- range .Values.service.ssh.loadBalancerSourceRanges }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.service.ssh.clusterIP (eq .Values.service.ssh.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.service.ssh.clusterIP }}
|
||||
|
@ -14,6 +14,7 @@ spec:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/gitea/config.yaml") . | sha256sum }}
|
||||
checksum/ldap: {{ include "gitea.ldap_settings" . | sha256sum }}
|
||||
{{- with .Values.gitea.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
@ -28,8 +29,13 @@ spec:
|
||||
fsGroup: 1000
|
||||
initContainers:
|
||||
- name: init
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
|
||||
image: "{{ .Values.image.repository }}:{{ ternary .Values.image.version .Values.image.tag (hasKey .Values.image "version") }}"
|
||||
command: ["/usr/sbin/init_gitea.sh"]
|
||||
env:
|
||||
{{- range .Values.statefulset.env }}
|
||||
- name: {{ .name | quote | nospace }}
|
||||
value: {{ .value | quote }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: init
|
||||
mountPath: /usr/sbin
|
||||
@ -37,10 +43,13 @@ spec:
|
||||
mountPath: /etc/gitea/conf
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.statefulset.terminationGracePeriodSeconds }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
|
||||
image: "{{ .Values.image.repository }}:{{ ternary .Values.image.version .Values.image.tag (hasKey .Values.image "version") }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
# SSH Port values have to be set here as well for openssh configuration
|
||||
@ -57,6 +66,10 @@ spec:
|
||||
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
|
||||
- name: http
|
||||
containerPort: {{ .Values.gitea.config.server.HTTP_PORT }}
|
||||
{{- if .Values.gitea.config.server.PPROF_ENABLED }}
|
||||
- name: profiler
|
||||
containerPort: 6060
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
@ -77,6 +90,9 @@ spec:
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
@ -97,6 +113,9 @@ spec:
|
||||
- name: config
|
||||
secret:
|
||||
secretName: {{ include "gitea.fullname" . }}
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{- toYaml .Values.extraVolumes | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
@ -108,6 +127,18 @@ spec:
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.persistence.labels }}
|
||||
labels:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
|
64
values.yaml
64
values.yaml
@ -8,7 +8,7 @@ clusterDomain: cluster.local
|
||||
|
||||
image:
|
||||
repository: gitea/gitea
|
||||
version: 1.13.0
|
||||
tag: 1.13.2
|
||||
pullPolicy: Always
|
||||
|
||||
imagePullSecrets: []
|
||||
@ -29,6 +29,7 @@ service:
|
||||
#nodePort:
|
||||
#externalTrafficPolicy:
|
||||
#externalIPs:
|
||||
loadBalancerSourceRanges: []
|
||||
annotations:
|
||||
|
||||
ingress:
|
||||
@ -69,10 +70,37 @@ statefulset:
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
# existingClaim:
|
||||
# existingClaim:
|
||||
size: 10Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
labels: {}
|
||||
annotations: {}
|
||||
|
||||
# additional volumes to add to the Gitea statefulset.
|
||||
extraVolumes:
|
||||
# - name: postgres-ssl-vol
|
||||
# secret:
|
||||
# secretName: gitea-postgres-ssl
|
||||
|
||||
|
||||
# additional volumes to mount, both to the init container and to the main
|
||||
# container. As an example, can be used to mount a client cert when connecting
|
||||
# to an external Postgres server.
|
||||
extraVolumeMounts:
|
||||
# - name: postgres-ssl-vol
|
||||
# readOnly: true
|
||||
# mountPath: "/pg-ssl"
|
||||
|
||||
# bash shell script copied verbatim to the start of the init-container.
|
||||
initPreScript: ""
|
||||
#
|
||||
# initPreScript: |
|
||||
# mkdir -p /data/git/.postgresql
|
||||
# cp /pg-ssl/* /data/git/.postgresql/
|
||||
# chown -R git:git /data/git/.postgresql/
|
||||
# chmod 400 /data/git/.postgresql/postgresql.key
|
||||
|
||||
|
||||
gitea:
|
||||
admin:
|
||||
@ -80,24 +108,30 @@ gitea:
|
||||
password: r8sA8CPHD9!bt6d
|
||||
email: "gitea@local.domain"
|
||||
|
||||
metrics:
|
||||
enabled: false
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
|
||||
ldap:
|
||||
enabled: false
|
||||
name: ""
|
||||
securityProtocol: ""
|
||||
host: ""
|
||||
port: ""
|
||||
userSearchBase: ""
|
||||
userFilter: ""
|
||||
adminFilter: ""
|
||||
emailAttribute: ""
|
||||
bindDn: ""
|
||||
bindPassword: ""
|
||||
usernameAttribute: ""
|
||||
#name:
|
||||
#securityProtocol:
|
||||
#host:
|
||||
#port:
|
||||
#userSearchBase:
|
||||
#userFilter:
|
||||
#adminFilter:
|
||||
#emailAttribute:
|
||||
#bindDn:
|
||||
#bindPassword:
|
||||
#usernameAttribute:
|
||||
#sshPublicKeyAttribute:
|
||||
|
||||
config: {}
|
||||
# APP_NAME: "Gitea: Git with a cup of tea"
|
||||
# RUN_MODE: dev
|
||||
#
|
||||
# RUN_MODE: dev
|
||||
#
|
||||
# server:
|
||||
# SSH_PORT: 22
|
||||
#
|
||||
|
Reference in New Issue
Block a user