Files
archify-vscode-ext-sync/charts/archify-sync/templates/postgresql.yaml
T
Oleg Lukasonok 99778d7489 Archify Sync server, Dockerfile and Helm chart
Rust server (axum, yrs, sqlx/PostgreSQL): live shared models over the y-websocket protocol, versions, browser sign-in with PKCE, invites, single sign-on through OIDC, metrics. Docker image on distroless, compose file, and a Helm chart with one pod, optional bundled PostgreSQL and secrets from existing Secrets.
2026-11-06 12:06:59 +02:00

112 lines
3.1 KiB
YAML

{{- if .Values.postgresql.enabled }}
{{- $name := printf "%s-postgresql" (include "archify-sync.fullname" .) }}
{{- $secret := .Values.postgresql.existingSecret | default $name }}
{{- if not .Values.postgresql.existingSecret }}
{{- $password := .Values.postgresql.password }}
{{- if not $password }}
{{- $existing := lookup "v1" "Secret" .Release.Namespace $name }}
{{- $password = $existing | dig "data" "password" "" | b64dec | default (randAlphaNum 32) }}
{{- end }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $name }}
labels:
{{- include "archify-sync.labels" . | nindent 4 }}
annotations:
helm.sh/resource-policy: keep
type: Opaque
stringData:
password: {{ $password | quote }}
url: {{ printf "postgres://archify:%s@%s:5432/archify" $password $name | quote }}
---
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ $name }}
labels:
{{- include "archify-sync.labels" . | nindent 4 }}
spec:
selector:
{{- include "archify-sync.dbSelector" . | nindent 4 }}
ports:
- name: postgres
port: 5432
targetPort: postgres
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ $name }}
labels:
{{- include "archify-sync.labels" . | nindent 4 }}
{{- include "archify-sync.dbSelector" . | nindent 4 }}
spec:
serviceName: {{ $name }}
replicas: 1
selector:
matchLabels:
{{- include "archify-sync.dbSelector" . | nindent 6 }}
template:
metadata:
labels:
{{- include "archify-sync.labels" . | nindent 8 }}
{{- include "archify-sync.dbSelector" . | nindent 8 }}
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 70
fsGroup: 70
seccompProfile:
type: RuntimeDefault
containers:
- name: postgres
image: {{ .Values.postgresql.image }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
env:
- name: POSTGRES_DB
value: archify
- name: POSTGRES_USER
value: archify
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ $secret }}
key: password
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
ports:
- name: postgres
containerPort: 5432
readinessProbe:
exec:
command: [pg_isready, -U, archify, -d, archify]
periodSeconds: 5
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
- name: run
mountPath: /var/run/postgresql
resources:
{{- toYaml .Values.postgresql.resources | nindent 12 }}
volumes:
- name: run
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ReadWriteOnce]
{{- with .Values.postgresql.storageClass }}
storageClassName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ .Values.postgresql.storage }}
{{- end }}