gotify: migrate to envFrom with per-container InfisicalSecrets

Stores the fully assembled database DSN in Infisical instead of building it from three helper vars with $() interpolation, which envFrom cannot feed.
This commit is contained in:
2026-08-23 23:38:16 +02:00
parent f382c87f58
commit 3c24cd4b9d
7 changed files with 74 additions and 85 deletions
@@ -1,63 +0,0 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: gotify
namespace: gotify
spec:
replicas: 1
selector:
matchLabels:
app: gotify
serviceName: gotify
template:
metadata:
labels:
app: gotify
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 10
containers:
- name: gotify
image: gotify/server:2.9.1
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
ports:
- containerPort: 80
name: http
env:
- name: GOTIFY_DEFAULTUSER_PASS
valueFrom:
secretKeyRef:
name: gotify-secrets
key: default_user_pass
- name: GOTIFY_DATABASE_DIALECT
value: postgres
- name: DB_USER
valueFrom:
secretKeyRef:
name: gotify-secrets
key: db_user
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: gotify-secrets
key: db_password
- name: DB_NAME
valueFrom:
secretKeyRef:
name: gotify-secrets
key: db_name
- name: GOTIFY_DATABASE_CONNECTION
value: "host=gotify-postgresql port=5432 user=$(DB_USER) dbname=$(DB_NAME) password=$(DB_PASSWORD) sslmode=disable"
volumeMounts:
- name: data
mountPath: /app/data
volumes:
- name: data
persistentVolumeClaim:
claimName: gotify-data-pvc
@@ -1,7 +1,7 @@
apiVersion: secrets.infisical.com/v1alpha1 apiVersion: secrets.infisical.com/v1alpha1
kind: InfisicalSecret kind: InfisicalSecret
metadata: metadata:
name: gotify-secrets name: gotify-app-secrets
namespace: infisical namespace: infisical
spec: spec:
hostAPI: https://infisical.jsme.be hostAPI: https://infisical.jsme.be
@@ -16,9 +16,10 @@ spec:
secretsScope: secretsScope:
projectSlug: "kubernetes" projectSlug: "kubernetes"
envSlug: "prod" envSlug: "prod"
secretsPath: "/gotify" secretsPath: "/gotify/gotify"
recursive: true # Non-recursive: keys are already named as the container expects.
recursive: false
managedSecretReference: managedSecretReference:
secretName: gotify-secrets secretName: gotify-app-secrets
secretNamespace: gotify secretNamespace: gotify
secretType: Opaque secretType: Opaque
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: gotify
namespace: gotify
spec:
replicas: 1
selector:
matchLabels:
app: gotify
serviceName: gotify
template:
metadata:
labels:
app: gotify
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 10
containers:
- name: gotify
image: gotify/server:2.9.1
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
ports:
- containerPort: 80
name: http
envFrom:
- secretRef:
name: gotify-app-secrets
volumeMounts:
- name: data
mountPath: /app/data
volumes:
- name: data
persistentVolumeClaim:
claimName: gotify-data-pvc
@@ -31,24 +31,9 @@ spec:
volumeMounts: volumeMounts:
- name: gotify-postgresql-database - name: gotify-postgresql-database
mountPath: /var/lib/postgresql/pgdata mountPath: /var/lib/postgresql/pgdata
env: envFrom:
- name: PGDATA - secretRef:
value: /var/lib/postgresql/pgdata/data name: gotify-postgres-secrets
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: gotify-secrets
key: db_password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: gotify-secrets
key: db_user
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: gotify-secrets
key: db_name
volumes: volumes:
- name: gotify-postgresql-database - name: gotify-postgresql-database
persistentVolumeClaim: persistentVolumeClaim:
@@ -0,0 +1,25 @@
apiVersion: secrets.infisical.com/v1alpha1
kind: InfisicalSecret
metadata:
name: gotify-postgres-secrets
namespace: infisical
spec:
hostAPI: https://infisical.jsme.be
resyncInterval: 30
authentication:
kubernetesAuth:
identityId: "5458def7-7c63-40d2-95da-41c614d0933a"
serviceAccountRef:
name: infisical-auth
namespace: infisical
autoCreateServiceAccountToken: true
secretsScope:
projectSlug: "kubernetes"
envSlug: "prod"
secretsPath: "/gotify/postgres"
# Non-recursive: keys are already named as the container expects.
recursive: false
managedSecretReference:
secretName: gotify-postgres-secrets
secretNamespace: gotify
secretType: Opaque