Add Chart Helm Gitea
This commit is contained in:
commit
85307016b1
23
.helmignore
Normal file
23
.helmignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
6
Chart.yaml
Normal file
6
Chart.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: gitea
|
||||
description: Un chart Helm simple pour déployer Gitea avec PostgreSQL.
|
||||
type: application
|
||||
version: 0.1.0 # Version de votre chart
|
||||
appVersion: "1.23.6" # Version de Gitea que vous ciblez (vérifiez la dernière version stable)
|
94
README.md
Normal file
94
README.md
Normal file
@ -0,0 +1,94 @@
|
||||
# Chart Helm pour Gitea
|
||||
|
||||
Ce dépôt contient un Chart Helm pour déployer [Gitea](https://gitea.io/), un service Git auto-hébergé simple et léger, sur un cluster Kubernetes.
|
||||
|
||||
## Description
|
||||
|
||||
Gitea offre une solution similaire à GitHub, GitLab ou Bitbucket, mais avec des besoins en ressources beaucoup plus faibles. Ce chart Helm facilite son déploiement et sa configuration dans un environnement Kubernetes.
|
||||
|
||||
**Note:** Il s'agit d'un chart communautaire / personnel et non du chart officiel maintenu par l'équipe Gitea (s'il en existe un que vous n'utilisez pas).
|
||||
|
||||
## Prérequis
|
||||
|
||||
* Cluster Kubernetes (v1.19+ recommandé)
|
||||
* [Helm](https://helm.sh/) v3.0+ installé et configuré
|
||||
* `kubectl` configuré pour interagir avec votre cluster
|
||||
* Un provisionneur de volumes persistants (StorageClass) si vous souhaitez activer la persistance des données (fortement recommandé).
|
||||
|
||||
## Installation du Chart
|
||||
|
||||
1. **Ajouter le dépôt Helm (si vous en hébergez un) :**
|
||||
Remplacez `<nom-du-repo>` par le nom que vous voulez donner à votre dépôt localement et `<url-du-repo>` par l'URL où votre chart est hébergé (par exemple, une page GitHub Pages).
|
||||
|
||||
```bash
|
||||
helm repo add <nom-du-repo> <url-du-repo>
|
||||
helm repo update
|
||||
```
|
||||
|
||||
Si vous utilisez le chart directement depuis ce dépôt Git cloné, vous pouvez sauter cette étape.
|
||||
|
||||
2. **Installer le Chart :**
|
||||
Remplacez `<nom-release>` par le nom que vous souhaitez donner à cette instance de Gitea (par exemple `my-gitea`).
|
||||
|
||||
* **Depuis le dépôt Git local :**
|
||||
Naviguez jusqu'au répertoire où se trouve ce README.md.
|
||||
|
||||
```bash
|
||||
# Installation simple dans le namespace 'default'
|
||||
helm install <nom-release> .
|
||||
|
||||
# Installation dans un namespace spécifique (recommandé)
|
||||
helm install <nom-release> . --namespace gitea --create-namespace
|
||||
|
||||
# Installation avec des valeurs personnalisées
|
||||
helm install <nom-release> . -f mes-valeurs.yaml --namespace gitea --create-namespace
|
||||
```
|
||||
|
||||
Après l'installation, Gitea devrait être accessible via le Service Kubernetes créé (ClusterIP, NodePort, ou LoadBalancer) ou via l'Ingress si configuré. Utilisez `kubectl get svc,ing -n <namespace>` pour vérifier.
|
||||
|
||||
## Configuration
|
||||
|
||||
Les paramètres de configuration principaux sont disponibles dans le fichier `values.yaml`. Vous pouvez les surcharger en utilisant l'option `-f` lors de l'installation ou `--set` pour des valeurs spécifiques.
|
||||
|
||||
Voici quelques paramètres clés :
|
||||
|
||||
| Paramètre | Description | Défaut |
|
||||
| :------------------------------- | :-------------------------------------------------------------------------- |:---------------------------|
|
||||
| `image.repository` | Image Docker Gitea à utiliser | `gitea/gitea` |
|
||||
| `image.tag` | Tag de l'image Gitea | `<dernière_version>` |
|
||||
| `service.type` | Type de service Kubernetes (ClusterIP, NodePort, LoadBalancer) | `ClusterIP` |
|
||||
| `service.port` | Port HTTP du service | `3000` |
|
||||
| `ingress.enabled` | Activer/désactiver la création d'une ressource Ingress | `true` |
|
||||
| `ingress.className` | Classe Ingress à utiliser (si nécessaire, ex: `nginx`, `traefik`) | `""` |
|
||||
| `ingress.hosts[0].host` | Nom d'hôte pour l'accès via Ingress (ex: `gitea.mondomaine.com`) | `chart-example.local` |
|
||||
| `ingress.hosts[0].paths[0].path`| Chemin pour l'Ingress | `/` |
|
||||
| `ingress.tls` | Configuration TLS pour l'Ingress (voir `values.yaml` pour la structure) | `[]` |
|
||||
| `persistence.enabled` | Activer/désactiver la persistance des données Gitea | `true` |
|
||||
| `persistence.storageClass` | StorageClass à utiliser pour le PVC (si `"-"`, utilise la classe par défaut) | `"-"` |
|
||||
| `persistence.size` | Taille du volume persistant (ex: `10Gi`) | `10Gi` |
|
||||
| `gitea.admin.username` | Nom d'utilisateur de l'administrateur initial Gitea | `gitea_admin` |
|
||||
| `gitea.admin.password` | Mot de passe de l'administrateur initial Gitea ( **IMPORTANT:** à changer!) | `<mot_de_passe_aléatoire>` |
|
||||
| `gitea.config` | Permet de surcharger des clés de configuration `app.ini` de Gitea | `{}` |
|
||||
| `database.type` | Type de base de données (`sqlite3`, `postgres`, `mysql`) | `postgresql` |
|
||||
| `database.host` | Hôte de la base de données (si externe) | `""` |
|
||||
| `database.name` | Nom de la base de données (si externe) | `gitea` |
|
||||
| `database.user` | Utilisateur de la base de données (si externe) | `gitea` |
|
||||
| `database.password` | Mot de passe de la base de données (si externe, utiliser un secret !) | `""` |
|
||||
| `database.existingSecret` | Nom d'un secret Kubernetes existant contenant les identifiants DB | `""` |
|
||||
|
||||
**Note sur la base de données :** Par défaut, le chart utilise PostgreSql avec les données stockées sur le volume persistant. Configurez les paramètres `database.*` en conséquence et assurez-vous que Gitea puisse y accéder depuis le cluster.
|
||||
|
||||
Consultez le fichier `values.yaml` pour voir toutes les options de configuration disponibles.
|
||||
|
||||
## Mise à jour
|
||||
|
||||
Pour mettre à jour une release existante avec une nouvelle version du chart ou de nouvelles valeurs :
|
||||
|
||||
```bash
|
||||
# Mettre à jour le dépôt (si utilisé)
|
||||
helm repo update
|
||||
|
||||
# Mettre à jour la release
|
||||
helm upgrade <nom-release> <nom-du-repo>/gitea --namespace <namespace> -f nouvelles-valeurs.yaml
|
||||
# Ou depuis le dépôt local:
|
||||
# helm upgrade <nom-release> . --namespace <namespace> -f nouvelles-valeurs.yaml
|
20
templates/NOTES.txt
Normal file
20
templates/NOTES.txt
Normal file
@ -0,0 +1,20 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.gitea.ingress.enabled }}
|
||||
{{- range $host := .Values.gitea.ingress.hosts }}
|
||||
http{{ if $.Values.gitea.ingress.tls }}s{{ end }}://{{ $host }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.gitea.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gitea.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.gitea.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "gitea.fullname" . }}'
|
||||
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.gitea.service.httpPort }}
|
||||
{{- else if contains "ClusterIP" .Values.gitea.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "gitea.fullname" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
45
templates/_helpers.tpl
Normal file
45
templates/_helpers.tpl
Normal file
@ -0,0 +1,45 @@
|
||||
{{/* vim: set filetype=gotpl: */}}
|
||||
{{- define "gitea.fullname" -}}
|
||||
{{- printf "%s-%s" .Release.Name "gitea" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "postgresql.fullname" -}}
|
||||
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Labels communs */}}
|
||||
{{- define "gitea.labels" -}}
|
||||
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote }}
|
||||
{{ include "gitea.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Labels sélecteurs pour Gitea */}}
|
||||
{{- define "gitea.selectorLabels" -}}
|
||||
app.kubernetes.io/name: gitea
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Labels sélecteurs pour PostgreSQL */}}
|
||||
{{- define "postgresql.selectorLabels" -}}
|
||||
app.kubernetes.io/name: postgresql
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Nom du Secret PostgreSQL */}}
|
||||
{{- define "postgresql.secretName" -}}
|
||||
{{ template "postgresql.fullname" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Nom du Service PostgreSQL */}}
|
||||
{{- define "postgresql.serviceName" -}}
|
||||
{{ template "postgresql.fullname" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Nom du PVC Gitea */}}
|
||||
{{- define "gitea.pvcName" -}}
|
||||
{{ template "gitea.fullname" . }}-data
|
||||
{{- end -}}
|
114
templates/gitea-deployment.yaml
Normal file
114
templates/gitea-deployment.yaml
Normal file
@ -0,0 +1,114 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "gitea.fullname" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: application
|
||||
spec:
|
||||
replicas: {{ .Values.gitea.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "gitea.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: application
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "gitea.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: application
|
||||
spec:
|
||||
containers:
|
||||
- name: gitea
|
||||
image: "{{ .Values.gitea.image.repository }}:{{ .Values.gitea.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.gitea.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.gitea.service.httpPort }}
|
||||
protocol: TCP
|
||||
- name: ssh
|
||||
containerPort: {{ .Values.gitea.service.sshPort }} # Port SSH interne Gitea (par défaut 22, mais l'image l'expose souvent sur 2222 pour éviter conflit)
|
||||
protocol: TCP # Vérifiez la doc de l'image Docker Gitea pour le port SSH interne exact si besoin
|
||||
env:
|
||||
# Configuration de base Gitea
|
||||
- name: USER
|
||||
value: git # L'utilisateur sous lequel Gitea tourne dans le conteneur (souvent 'git')
|
||||
- name: GITEA__database__DB_TYPE
|
||||
value: {{ .Values.gitea.config.database.DB_TYPE }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: GITEA__database__HOST
|
||||
value: {{ template "postgresql.serviceName" . }}:{{ .Values.postgresql.service.port }}
|
||||
- name: GITEA__database__NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: database
|
||||
- name: GITEA__database__USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: username
|
||||
- name: GITEA__database__PASSWD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: password
|
||||
{{- else }}
|
||||
# Si postgresql.enabled est false, vous devez fournir ces valeurs autrement (ex: via values.yaml ou un autre secret)
|
||||
# - name: GITEA__database__HOST
|
||||
# value: <votre_host_postgres_externe>:<port>
|
||||
# - name: GITEA__database__NAME
|
||||
# value: <votre_db_name>
|
||||
# - name: GITEA__database__USER
|
||||
# value: <votre_user>
|
||||
# - name: GITEA__database__PASSWD
|
||||
# valueFrom:
|
||||
# secretKeyRef:
|
||||
# name: <votre_secret_db_externe>
|
||||
# key: password
|
||||
{{- end }}
|
||||
- name: GITEA__server__DOMAIN
|
||||
value: {{ .Values.gitea.ingress.host }}
|
||||
- name: GITEA__server__ROOT_URL
|
||||
{{- if .Values.gitea.ingress.tls.enabled }}
|
||||
value: "https://{{ .Values.gitea.ingress.host }}"
|
||||
{{- else }}
|
||||
value: "http://{{ .Values.gitea.ingress.host }}"
|
||||
{{- end }}
|
||||
- name: GITEA__server__SSH_DOMAIN
|
||||
value: {{ .Values.gitea.ingress.host }} # Ou un domaine différent si SSH est exposé autrement
|
||||
- name: GITEA__server__HTTP_PORT
|
||||
value: "{{ .Values.gitea.service.httpPort }}"
|
||||
- name: GITEA__server__SSH_PORT # Port sur lequel le serveur SSH Gitea écoute à l'intérieur du conteneur
|
||||
value: "{{ .Values.gitea.service.sshPort }}"
|
||||
# - name: GITEA__security__INSTALL_LOCK # Décommentez et mettez à true après la première config via l'UI
|
||||
# value: "true"
|
||||
# - name: GITEA__service__DISABLE_REGISTRATION # Décommentez pour désactiver l'enregistrement public
|
||||
# value: "true"
|
||||
# Ajoutez d'autres variables GITEA__<section>__<clé> ici si nécessaire
|
||||
{{- if .Values.gitea.persistence.enabled }}
|
||||
volumeMounts:
|
||||
- name: gitea-data
|
||||
mountPath: {{ .Values.gitea.persistence.mountPath }}
|
||||
{{- end }}
|
||||
# Ajouter Liveness/Readiness Probes pour Gitea est une bonne pratique
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
volumes:
|
||||
{{- if .Values.gitea.persistence.enabled }}
|
||||
- name: gitea-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "gitea.pvcName" . }}
|
||||
{{- else }}
|
||||
- name: gitea-data # Volume éphémère si persistance désactivée
|
||||
emptyDir: {}
|
||||
{{- end }}
|
30
templates/gitea-ingress.yaml
Normal file
30
templates/gitea-ingress.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
{{- if .Values.gitea.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ template "gitea.fullname" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
{{- with .Values.gitea.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.gitea.ingress.tls.enabled }}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ .Values.gitea.ingress.host | quote }}
|
||||
secretName: {{ .Values.gitea.ingress.host | quote }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.gitea.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ template "gitea.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.gitea.service.httpPort }}
|
||||
{{- end }}
|
22
templates/gitea-pvc.yaml
Normal file
22
templates/gitea-pvc.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
{{- if .Values.gitea.persistence.enabled }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "gitea.pvcName" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: application-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce # Généralement suffisant pour Gitea
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.gitea.persistence.size }}
|
||||
{{- if .Values.gitea.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.gitea.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.gitea.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
23
templates/gitea-service.yaml
Normal file
23
templates/gitea-service.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "gitea.fullname" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: application
|
||||
spec:
|
||||
type: {{ .Values.gitea.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.gitea.service.httpPort }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
# Si vous voulez exposer SSH via un service (ex: LoadBalancer), ajoutez un port ici.
|
||||
# Sinon, l'Ingress ne gère que HTTP/S. Pour SSH, une config différente est nécessaire (Service Type LoadBalancer sur le port SSH, ou NodePort)
|
||||
# - port: 22 # Port externe pour SSH
|
||||
# targetPort: ssh # Le nom du port dans le pod Gitea
|
||||
# protocol: TCP
|
||||
# name: ssh
|
||||
selector:
|
||||
{{- include "gitea.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: application
|
16
templates/issuer.yaml
Normal file
16
templates/issuer.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Issuer
|
||||
metadata:
|
||||
name: letsencrypt-issuer-gitea
|
||||
spec:
|
||||
acme:
|
||||
server: https://acme-v02.api.letsencrypt.org/directory
|
||||
email: matthieu.lmr@lm-imanager.com
|
||||
privateKeySecretRef:
|
||||
name: key-cert-gitea-tls
|
||||
solvers:
|
||||
- selector: {}
|
||||
http01:
|
||||
ingress:
|
||||
class: nginx
|
14
templates/postgresql-secret.yaml
Normal file
14
templates/postgresql-secret.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
# Note: Les valeurs de secret doivent être encodées en base64
|
||||
username: {{ .Values.postgresql.auth.username | b64enc | quote }}
|
||||
password: {{ .Values.postgresql.auth.password | b64enc | quote }}
|
||||
database: {{ .Values.postgresql.auth.database | b64enc | quote }}
|
||||
{{- end }}
|
19
templates/postgresql-service.yaml
Normal file
19
templates/postgresql-service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "postgresql.serviceName" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: database
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.postgresql.service.port }}
|
||||
targetPort: postgresql
|
||||
protocol: TCP
|
||||
name: postgresql
|
||||
selector:
|
||||
{{- include "postgresql.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: database
|
||||
{{- end }}
|
92
templates/postgresql-statefulset.yaml
Normal file
92
templates/postgresql-statefulset.yaml
Normal file
@ -0,0 +1,92 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "gitea.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: database
|
||||
spec:
|
||||
serviceName: {{ template "postgresql.serviceName" . }}
|
||||
replicas: 1 # Un seul pod pour une base simple
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "postgresql.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: database
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "postgresql.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: database
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 10
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
|
||||
ports:
|
||||
- name: postgresql
|
||||
containerPort: {{ .Values.postgresql.service.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: database
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: username
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: password
|
||||
# PGDATA est important pour indiquer où stocker les données
|
||||
- name: PGDATA
|
||||
value: {{ .Values.postgresql.persistence.mountPath }}/pgdata
|
||||
{{- if .Values.postgresql.persistence.enabled }}
|
||||
volumeMounts:
|
||||
- name: postgresql-data
|
||||
mountPath: {{ .Values.postgresql.persistence.mountPath }}
|
||||
{{- end }}
|
||||
# Ajouter des Liveness/Readiness Probes est recommandé en production
|
||||
livenessProbe:
|
||||
exec:
|
||||
command: ["pg_isready", "-U", "$(POSTGRES_USER)", "-d", "$(POSTGRES_DB)", "-h", "127.0.0.1", "-p", "{{ .Values.postgresql.service.port }}"]
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
exec:
|
||||
command: ["pg_isready", "-U", "$(POSTGRES_USER)", "-d", "$(POSTGRES_DB)", "-h", "127.0.0.1", "-p", "{{ .Values.postgresql.service.port }}"]
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
{{- if not .Values.postgresql.persistence.enabled }}
|
||||
volumes:
|
||||
- name: postgresql-data # Volume éphémère si persistance désactivée
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: postgresql-data
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgresql.persistence.size }}
|
||||
{{- if .Values.postgresql.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.postgresql.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.postgresql.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
73
values.yaml
Normal file
73
values.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
# Valeurs pour Gitea
|
||||
gitea:
|
||||
replicaCount: 1
|
||||
image:
|
||||
repository: gitea/gitea
|
||||
tag: "1.23.6" # Assurez-vous que cette version est compatible avec la config
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
httpPort: 3000
|
||||
sshPort: 22 # Port SSH interne au pod Gitea
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
# className: nginx # Important: Spécifiez la classe de votre contrôleur Ingress (nginx, traefik, etc.)
|
||||
host: gitea.lm-imanager.com
|
||||
tls:
|
||||
enabled: true
|
||||
# Important: Vous DEVEZ créer ce secret manuellement AVANT d'installer le chart.
|
||||
# kubectl create secret tls gitea-tls --cert=path/to/tls.crt --key=path/to/tls.key -n <namespace>
|
||||
secretName: key-cert-gitea-tls
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
cert-manager.io/issuer: letsencrypt-issuer-gitea
|
||||
acme.cert-manager.io/http01-edit-in-place: "true"
|
||||
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: 40m
|
||||
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
# storageClass: "" # Décommentez et spécifiez si vous n'utilisez pas la storage class par défaut
|
||||
size: 10Gi # Taille du volume pour les données Gitea (repos, etc.)
|
||||
mountPath: /data
|
||||
|
||||
# Configuration Gitea via variables d'environnement
|
||||
# Voir https://docs.gitea.com/administration/config-cheat-sheet
|
||||
config:
|
||||
# server:
|
||||
# ROOT_URL: "https://gitea.lm-imanager.com" # Sera généré automatiquement dans le template
|
||||
database:
|
||||
DB_TYPE: postgres
|
||||
# Les autres valeurs (HOST, NAME, USER, PASSWD) seront prises depuis le secret postgresql
|
||||
# security:
|
||||
INSTALL_LOCK: true # Mettre à true APRÈS la première installation via l'interface web
|
||||
# SECRET_KEY: "" # Généré par Gitea si vide, ou spécifiez une longue chaîne aléatoire
|
||||
# service:
|
||||
# DISABLE_REGISTRATION: false # Mettre à true pour désactiver l'auto-enregistrement des utilisateurs
|
||||
|
||||
# Valeurs pour PostgreSQL (déploiement interne)
|
||||
postgresql:
|
||||
enabled: true # Mettre à false si vous utilisez une base de données externe
|
||||
|
||||
image:
|
||||
repository: postgres
|
||||
tag: "14" # Choisissez une version de PostgreSQL supportée par Gitea
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
# Attention: Changez ces mots de passe pour la production !
|
||||
auth:
|
||||
username: gitea
|
||||
password: "change-me-in-production"
|
||||
database: gitea
|
||||
|
||||
service:
|
||||
port: 5432
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
# storageClass: "" # Décommentez et spécifiez si vous n'utilisez pas la storage class par défaut
|
||||
size: 8Gi
|
||||
mountPath: /var/lib/postgresql/data
|
Loading…
x
Reference in New Issue
Block a user