apiVersion: apps/v1 kind: Deployment metadata: name: sogo namespace: sogo labels: app: sogo spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: sogo template: metadata: labels: app: sogo spec: initContainers: - name: config-init image: alpine:latest command: - sh - -c - | apk add --no-cache python3 ENCODED_PASSWORD=$(python3 -c "import urllib.parse; print(urllib.parse.quote('${POSTGRES_PASSWORD}', safe=''))") export POSTGRES_PASSWORD="${ENCODED_PASSWORD}" cat /config-template/sogo.yaml | sed "s|\${POSTGRES_PASSWORD}|${POSTGRES_PASSWORD}|g" > /config/sogo.yaml echo "Configuration file prepared with URL-encoded password" env: - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: sogo-postgres-credentials key: password volumeMounts: - name: config-template mountPath: /config-template - name: config mountPath: /config containers: - name: sogo image: sonroyaalmerol/docker-sogo:latest ports: - containerPort: 80 name: http env: - name: TZ value: "Europe/Amsterdam" volumeMounts: - name: config mountPath: /etc/sogo/sogo.conf.d/ - name: data mountPath: /srv/lib/sogo resources: requests: memory: "512Mi" cpu: "200m" limits: memory: "1Gi" cpu: "1000m" livenessProbe: httpGet: path: /SOGo port: 80 initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 5 readinessProbe: httpGet: path: /SOGo port: 80 initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 volumes: - name: config-template configMap: name: sogo-config - name: config emptyDir: {} - name: data persistentVolumeClaim: claimName: sogo-data