Simplifying secret management

This commit is contained in:
Jansen Fuller
2026-05-01 11:22:55 -06:00
committed by Dustin J. Mitchell
parent c58bb4800d
commit 84c06475c6
4 changed files with 14 additions and 20 deletions

View File

@ -43,18 +43,17 @@ Reference it via `clientIdSecret: "my-client-ids"`.
### PostgreSQL Secret ### PostgreSQL Secret
```yaml For PostgreSQL, the chart can automatically create a secret with the connection string, or use an existing secret.
apiVersion: v1
kind: Secret
metadata:
name: my-postgres-creds
type: Opaque
data:
connection: <base64-encoded LibPQ connection URI>
password: <base64-encoded password>
```
Reference it via `postgres.existingSecret: "my-postgres-creds"`. **Automatic Secret Creation**:
- When `postgres.existingSecret` is empty (default), the chart automatically creates a secret
- Secret is named using Helm naming convention: `release-name-taskchampion-sync-server`
- Secret contains only a `connection` key with the built connection string
**Existing Secret Usage**:
- When `postgres.existingSecret` is provided, the chart uses that secret
- The secret **must** contain a `connection` key with the PostgreSQL connection string
- If the secret doesn't have a `connection` key, the deployment will fail with a clear error
## Configuration ## Configuration

View File

@ -3,7 +3,6 @@ sqlite:
postgres: postgres:
enabled: true enabled: true
existingSecret: "taskchampion-postgres-creds"
database: taskchampion database: taskchampion
host: postgres-primary host: postgres-primary
username: taskchampion-user username: taskchampion-user

View File

@ -67,9 +67,5 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end -}}
{{- define "taskchampion-sync-server.postgres-secret-name" -}} {{- define "taskchampion-sync-server.postgres-secret-name" -}}
{{- if .Values.postgres.existingSecret -}} {{- printf "%s-connection" .Release.Name -}}
{{- .Values.postgres.existingSecret -}}
{{- else -}}
{{- include "taskchampion-sync-server.fullname" . -}}
{{- end }}
{{- end -}} {{- end -}}

View File

@ -1,11 +1,11 @@
{{- if and .Values.postgres.enabled (eq .Values.postgres.existingSecret "") -}} {{- if .Values.postgres.enabled }}
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ include "taskchampion-sync-server.fullname" . }} name: {{ include "taskchampion-sync-server.postgres-secret-name" . }}
labels: labels:
{{- include "taskchampion-sync-server.labels" . | nindent 4 }} {{- include "taskchampion-sync-server.labels" . | nindent 4 }}
type: Opaque type: Opaque
data: data:
connection: {{ include "taskchampion-sync-server.postgres-connection" . | b64enc }} connection: {{ include "taskchampion-sync-server.postgres-connection" . | b64enc }}
{{- end -}} {{- end }}