From b456d07c45a670db2f95ae0a2e88de03e662fdc1 Mon Sep 17 00:00:00 2001 From: Lucas Hahn Date: Fri, 9 Jul 2021 15:24:16 +0200 Subject: [PATCH] Add gitea ha support --- Chart.yaml | 8 ++++++++ pvc.yaml | 11 +++++++++++ templates/_helpers.tpl | 12 ++++++++++++ values.yaml | 39 +++++++++++++++++++++++++++++++-------- 4 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 pvc.yaml diff --git a/Chart.yaml b/Chart.yaml index b28898d..325ffad 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -34,6 +34,10 @@ dependencies: repository: https://charts.bitnami.com/bitnami version: 5.9.0 condition: memcached.enabled +- name: redis-cluster + repository: https://charts.bitnami.com/bitnami + version: 6.2.3 + condition: redis-cluster.enabled - name: mysql repository: https://charts.bitnami.com/bitnami version: 6.14.10 @@ -42,6 +46,10 @@ dependencies: repository: https://charts.bitnami.com/bitnami version: 10.3.17 condition: postgresql.enabled +- name: postgresql-ha + repository: https://charts.bitnami.com/bitnami + version: 7.7.3 + condition: postgresql-ha.enabled - name: mariadb repository: https://charts.bitnami.com/bitnami version: 9.3.6 diff --git a/pvc.yaml b/pvc.yaml new file mode 100644 index 0000000..c79c103 --- /dev/null +++ b/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gitea-data-test + namespace: ndo +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 10Gi \ No newline at end of file diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index e7d98ea..4182bf1 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -66,6 +66,8 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- define "db.servicename" -}} {{- if .Values.postgresql.enabled -}} {{- printf "%s-postgresql" .Release.Name -}} +{{- else if (index .Values "postgresql-ha").enabled -}} +{{- printf "%s-postgresql-ha-pgpool" .Release.Name -}} {{- else if .Values.mysql.enabled -}} {{- printf "%s-mysql" .Release.Name -}} {{- else if .Values.mariadb.enabled -}} @@ -79,6 +81,8 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- define "db.port" -}} {{- if .Values.postgresql.enabled -}} {{ .Values.postgresql.global.postgresql.servicePort }} +{{- else if (index .Values "postgresql-ha").enabled -}} +{{ (index .Values "postgresql-ha").service.port }} {{- else if .Values.mysql.enabled -}} {{ .Values.mysql.service.port }} {{- else if .Values.mariadb.enabled -}} @@ -88,7 +92,11 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} {{- define "postgresql.dns" -}} +{{- if .Values.postgresql.enabled -}} {{- printf "%s-postgresql.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.postgresql.global.postgresql.servicePort -}} +{{- else if (index .Values "postgresql-ha").enabled -}} +{{- printf "%s-postgresql-ha-pgpool.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "postgresql-ha").service.port -}} +{{- end -}} {{- end -}} {{- define "mysql.dns" -}} @@ -103,6 +111,10 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- printf "%s-memcached.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.memcached.service.port | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "redis.dns" -}} +{{- printf "redis://%s-redis-cluster.%s.svc.%s:%g/0?pool_size=100&idle_timeout=180s" .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "redis-cluster").service.port -}} +{{- end -}} + {{- define "gitea.default_domain" -}} {{- printf "%s-gitea.%s.svc.%s" (include "gitea.fullname" .) .Release.Namespace .Values.clusterDomain | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/values.yaml b/values.yaml index 18a8f20..17325eb 100644 --- a/values.yaml +++ b/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 1 +replicaCount: 2 clusterDomain: cluster.local @@ -114,12 +114,7 @@ statefulset: persistence: enabled: true - # existingClaim: - size: 10Gi - accessModes: - - ReadWriteOnce - labels: {} - annotations: {} + existingClaim: gitea-data-test # storageClass: # subPath: @@ -195,7 +190,9 @@ gitea: # customProfileUrl: # customEmailUrl: - config: {} + config: + indexer: + ISSUE_INDEXER_TYPE: db # APP_NAME: "Gitea: Git with a cup of tea" # RUN_MODE: dev # @@ -248,6 +245,17 @@ memcached: service: port: 11211 +redis-cluster: + enabled: false + global: + redis: + password: gitea + cluster: + nodes: 6 + replicas: 1 + service: + port: 6379 + postgresql: enabled: true global: @@ -259,6 +267,21 @@ postgresql: persistence: size: 10Gi +postgresql-ha: + enabled: false + global: + postgresql: + database: gitea + username: gitea + password: gitea + repmgrPassword: postgresql + repmgrUsername: postgresql + repmgrDatabase: repr + service: + port: 5432 + persistence: + size: 10Gi + mysql: enabled: false root: