chore: build
ci-api / test (push) Successful in 23m32s
ci-web / test (push) Successful in 14m7s

This commit is contained in:
Xor290
2026-09-20 18:52:09 +02:00
parent 9e11f01c2c
commit 8d857faa45
66 changed files with 3673 additions and 1564 deletions
@@ -0,0 +1,6 @@
apiVersion: v2
name: vitrine-postgresql
description: PostgreSQL 16 — gestion-commande
type: application
version: 0.1.0
appVersion: "16"
@@ -0,0 +1,20 @@
{{- define "postgresql.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-postgresql" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- define "postgresql.labels" -}}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "postgresql.selectorLabels" -}}
app.kubernetes.io/name: postgresql
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "postgresql.fullname" . }}-config
labels:
{{- include "postgresql.labels" . | nindent 4 }}
data:
postgresql.conf: |
max_connections = {{ .Values.config.maxConnections }}
shared_buffers = {{ .Values.config.sharedBuffers }}
effective_cache_size = {{ .Values.config.effectiveCacheSize }}
maintenance_work_mem = {{ .Values.config.maintenanceWorkMem }}
wal_buffers = {{ .Values.config.walBuffers }}
default_statistics_target = {{ .Values.config.defaultStatisticsTarget }}
random_page_cost = {{ .Values.config.randomPageCost }}
log_min_duration_statement = {{ .Values.config.logMinDurationStatement }}
log_timezone = 'UTC'
timezone = 'UTC'
# Connexions sécurisées uniquement depuis le réseau interne cluster
listen_addresses = '*'
@@ -0,0 +1,17 @@
{{- if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "postgresql.fullname" . }}-data
labels:
{{- include "postgresql.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
{{- end }}
@@ -0,0 +1,14 @@
{{- if not .Values.auth.password }}
{{- fail "auth.password is required (--set-string auth.password=...)" }}
{{- end }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "postgresql.fullname" . }}
labels:
{{- include "postgresql.labels" . | nindent 4 }}
type: Opaque
stringData:
POSTGRES_PASSWORD: {{ .Values.auth.password | quote }}
POSTGRES_USER: {{ .Values.auth.username | quote }}
POSTGRES_DB: {{ .Values.auth.database | quote }}
@@ -0,0 +1,32 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "postgresql.fullname" . }}
labels:
{{- include "postgresql.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
selector:
{{- include "postgresql.selectorLabels" . | nindent 4 }}
ports:
- name: postgresql
port: {{ .Values.service.port }}
targetPort: postgresql
protocol: TCP
---
# Service headless pour le StatefulSet
apiVersion: v1
kind: Service
metadata:
name: {{ include "postgresql.fullname" . }}-headless
labels:
{{- include "postgresql.labels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
selector:
{{- include "postgresql.selectorLabels" . | nindent 4 }}
ports:
- name: postgresql
port: {{ .Values.service.port }}
targetPort: postgresql
@@ -0,0 +1,78 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "postgresql.fullname" . }}
labels:
{{- include "postgresql.labels" . | nindent 4 }}
spec:
serviceName: {{ include "postgresql.fullname" . }}-headless
replicas: 1
selector:
matchLabels:
{{- include "postgresql.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "postgresql.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: postgresql
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
ports:
- name: postgresql
containerPort: 5432
protocol: TCP
envFrom:
- secretRef:
name: {{ include "postgresql.fullname" . }}
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
- name: config
mountPath: /etc/postgresql/postgresql.conf
subPath: postgresql.conf
args:
- "-c"
- "config_file=/etc/postgresql/postgresql.conf"
livenessProbe:
exec:
command:
- sh
- -c
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
readinessProbe:
exec:
command:
- sh
- -c
- pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
initialDelaySeconds: 5
periodSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "postgresql.fullname" . }}-data
{{- else }}
emptyDir: {}
{{- end }}
- name: config
configMap:
name: {{ include "postgresql.fullname" . }}-config
@@ -0,0 +1,65 @@
# Nom des ressources (dont le Service ClusterIP joint par le backend).
# "postgres" = valeur attendue par backend/values.yaml (database.host / redis.host).
fullnameOverride: "postgres"
image:
repository: postgres
tag: "16-alpine"
pullPolicy: IfNotPresent
# Injecté par le provisioner (voir deploy/chart-gestion/registry-credentials)
# si un compte Docker Hub authentifié est configuré — évite le rate-limit de
# pull anonyme partagé par IP de nœud. Vide = pull anonyme (défaut).
imagePullSecrets: []
auth:
username: postgres
database: vitrine_db
# À surcharger via --set auth.password=xxx
password: ""
persistence:
enabled: true
size: 10Gi
# Répliqué sur 2 nœuds (Longhorn) : survit à la perte d'un nœud. Voir
# deploy/longhorn/storageclass.yml pour le prérequis d'installation.
storageClass: "longhorn-replicated"
accessMode: ReadWriteOnce
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: 1000m
memory: 1Gi
service:
type: ClusterIP
port: 5432
# Paramètres PostgreSQL (postgresql.conf)
config:
maxConnections: "200"
sharedBuffers: "256MB"
effectiveCacheSize: "768MB"
maintenanceWorkMem: "64MB"
walBuffers: "16MB"
defaultStatisticsTarget: "100"
randomPageCost: "1.1"
logMinDurationStatement: "1000"
podSecurityContext:
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
fsGroup: 999
seccompProfile:
type: RuntimeDefault
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
capabilities:
drop:
- ALL