Compare commits

...

2 Commits

6 changed files with 72 additions and 66 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: donetick name: donetick
description: Donetick helm chart for Kubernetes description: Donetick helm chart for Kubernetes
type: application type: application
version: 1.0.2 version: 1.0.4
appVersion: "v0.1.60" appVersion: "v0.1.60"
maintainers: maintainers:
- name: Richard Tomik - name: Richard Tomik

View File

@ -107,11 +107,18 @@ config:
type: "postgres" type: "postgres"
host: "postgresql.database.svc.cluster.local" host: "postgresql.database.svc.cluster.local"
port: 5432 port: 5432
user: "donetick"
name: "donetick" name: "donetick"
# Use existing secret for database credentials
existingSecret: "donetick-db-secret" # Use existing secret for postgres credentials
passwordKey: "postgresql-password" database:
type: "postgres"
host: "postgresql.database.svc.cluster.local"
port: 5432
name: "donetick"
secrets:
existingSecret: "donetick-postgres-secret"
userKey: "username"
passwordKey: "password"
# Use existing secret for JWT # Use existing secret for JWT
jwt: jwt:
@ -179,9 +186,10 @@ ingress:
Create the required secrets: Create the required secrets:
```bash ```bash
# Database secret # Postgres secret
kubectl create secret generic donetick-db-secret \ kubectl create secret generic donetick-postgres-secret \
--from-literal=postgresql-password='your-secure-db-password' --from-literal=username='donetick' \
--from-literal=password='your-secure-db-password'
# JWT secret # JWT secret
kubectl create secret generic donetick-jwt-secret \ kubectl create secret generic donetick-jwt-secret \
@ -234,12 +242,9 @@ helm uninstall donetick
| `config.oauth2.existingSecret` | Name of existing secret for OAuth2 credentials | `""` | | `config.oauth2.existingSecret` | Name of existing secret for OAuth2 credentials | `""` |
| `config.oauth2.clientIdKey` | Key in the existing secret for OAuth2 client ID | `"client-id"` | | `config.oauth2.clientIdKey` | Key in the existing secret for OAuth2 client ID | `"client-id"` |
| `config.oauth2.clientSecretKey` | Key in the existing secret for OAuth2 client secret | `"client-secret"` | | `config.oauth2.clientSecretKey` | Key in the existing secret for OAuth2 client secret | `"client-secret"` |
| `config.database.existingSecret` | Name of existing secret for database credentials | `""` | | `config.database.secrets.existingSecret` | Name of existing secret for postgres credentials | `""` |
| `config.database.hostKey` | Key in the existing secret for database host | `"db-host"` | | `config.database.secrets.userKey` | Key in the existing secret for postgres username | `"username"` |
| `config.database.portKey` | Key in the existing secret for database port | `"db-port"` | | `config.database.secrets.passwordKey` | Key in the existing secret for postgres password | `"password"` |
| `config.database.userKey` | Key in the existing secret for database user | `"db-user"` |
| `config.database.passwordKey` | Key in the existing secret for database password | `"db-password"` |
| `config.database.nameKey` | Key in the existing secret for database name | `"db-name"` |
### Deployment parameters ### Deployment parameters

View File

@ -22,15 +22,18 @@ data:
{{- if .Values.config.database.migration_retry }} {{- if .Values.config.database.migration_retry }}
migration_retry: {{ .Values.config.database.migration_retry }} migration_retry: {{ .Values.config.database.migration_retry }}
{{- end }} {{- end }}
migration_timeout: {{ .Values.config.database.migration_timeout | default "300s" | quote }}
{{- if eq .Values.config.database.type "postgres" }} {{- if eq .Values.config.database.type "postgres" }}
{{- if not .Values.config.database.existingSecret }}
host: {{ .Values.config.database.host | quote }} host: {{ .Values.config.database.host | quote }}
port: {{ .Values.config.database.port }} port: {{ .Values.config.database.port }}
name: {{ .Values.config.database.name | quote }}
{{- if not .Values.config.database.secrets.existingSecret }}
user: {{ .Values.config.database.user | quote }} user: {{ .Values.config.database.user | quote }}
password: {{ .Values.config.database.password | quote }} password: {{ .Values.config.database.password | quote }}
name: {{ .Values.config.database.name | quote }}
{{- else }} {{- else }}
# Database credentials will be injected via environment variables from Secret # Reference environment variables for database credentials
user: "$DT_DATABASE_USER"
password: "$DT_DATABASE_PASSWORD"
{{- end }} {{- end }}
{{- end }} {{- end }}
jwt: jwt:

View File

@ -88,15 +88,44 @@ spec:
- name: {{ .name }} - name: {{ .name }}
value: {{ .value | quote }} value: {{ .value | quote }}
{{- end }} {{- end }}
{{- if or .Values.config.jwt.existingSecret .Values.config.oauth2.existingSecret .Values.config.database.existingSecret }} # Database configuration environment variables
# Secret-based environment variables {{- if eq .Values.config.database.type "postgres" }}
- name: DT_DATABASE_TYPE
value: "postgres"
- name: DT_DATABASE_HOST
value: {{ .Values.config.database.host | quote }}
- name: DT_DATABASE_PORT
value: {{ .Values.config.database.port | quote }}
- name: DT_DATABASE_NAME
value: {{ .Values.config.database.name | quote }}
{{- if .Values.config.database.secrets.existingSecret }}
- name: DT_DATABASE_USER
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.secrets.existingSecret }}
key: {{ .Values.config.database.secrets.userKey }}
- name: DT_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.secrets.existingSecret }}
key: {{ .Values.config.database.secrets.passwordKey }}
{{- end }}
{{- else }}
- name: DT_DATABASE_TYPE
value: {{ .Values.config.database.type | quote }}
{{- end }}
# JWT configuration
{{- if .Values.config.jwt.existingSecret }} {{- if .Values.config.jwt.existingSecret }}
- name: DT_JWT_SECRET - name: DT_JWT_SECRET
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ .Values.config.jwt.existingSecret }} name: {{ .Values.config.jwt.existingSecret }}
key: {{ .Values.config.jwt.secretKey }} key: {{ .Values.config.jwt.secretKey }}
{{- else }}
- name: DT_JWT_SECRET
value: {{ .Values.config.jwt.secret | quote }}
{{- end }} {{- end }}
# OAuth2 configuration
{{- if .Values.config.oauth2.existingSecret }} {{- if .Values.config.oauth2.existingSecret }}
- name: DT_OAUTH2_CLIENT_ID - name: DT_OAUTH2_CLIENT_ID
valueFrom: valueFrom:
@ -109,34 +138,6 @@ spec:
name: {{ .Values.config.oauth2.existingSecret }} name: {{ .Values.config.oauth2.existingSecret }}
key: {{ .Values.config.oauth2.clientSecretKey }} key: {{ .Values.config.oauth2.clientSecretKey }}
{{- end }} {{- end }}
{{- if and .Values.config.database.existingSecret (eq .Values.config.database.type "postgres") }}
- name: DT_DB_HOST
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.existingSecret }}
key: {{ .Values.config.database.hostKey }}
- name: DT_DB_PORT
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.existingSecret }}
key: {{ .Values.config.database.portKey }}
- name: DT_DB_USER
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.existingSecret }}
key: {{ .Values.config.database.userKey }}
- name: DT_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.existingSecret }}
key: {{ .Values.config.database.passwordKey }}
- name: DT_DB_NAME
valueFrom:
secretKeyRef:
name: {{ .Values.config.database.existingSecret }}
key: {{ .Values.config.database.nameKey }}
{{- end }}
{{- end }}
{{- with .Values.extraEnv }} {{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}

View File

@ -1,4 +1,4 @@
{{- if or (not .Values.config.jwt.existingSecret) (and (not .Values.config.oauth2.existingSecret) (or .Values.config.oauth2.client_id .Values.config.oauth2.client_secret)) (and (eq .Values.config.database.type "postgres") (not .Values.config.database.existingSecret)) }} {{- if or (not .Values.config.jwt.existingSecret) (and (not .Values.config.oauth2.existingSecret) (or .Values.config.oauth2.client_id .Values.config.oauth2.client_secret)) (and (eq .Values.config.database.type "postgres") (not .Values.config.database.secrets.existingSecret)) }}
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
@ -10,8 +10,8 @@ data:
{{- if not .Values.config.jwt.existingSecret }} {{- if not .Values.config.jwt.existingSecret }}
{{ .Values.config.jwt.secretKey }}: {{ .Values.config.jwt.secret | b64enc }} {{ .Values.config.jwt.secretKey }}: {{ .Values.config.jwt.secret | b64enc }}
{{- end }} {{- end }}
{{- if and (eq .Values.config.database.type "postgres") (not .Values.config.database.existingSecret) }} {{- if and (eq .Values.config.database.type "postgres") (not .Values.config.database.secrets.existingSecret) }}
{{ .Values.config.database.passwordKey }}: {{ .Values.config.database.password | b64enc }} {{ .Values.config.database.secrets.passwordKey }}: {{ .Values.config.database.password | b64enc }}
{{- end }} {{- end }}
{{- if and (not .Values.config.oauth2.existingSecret) .Values.config.oauth2.client_id }} {{- if and (not .Values.config.oauth2.existingSecret) .Values.config.oauth2.client_id }}
{{ .Values.config.oauth2.clientIdKey }}: {{ .Values.config.oauth2.client_id | b64enc }} {{ .Values.config.oauth2.clientIdKey }}: {{ .Values.config.oauth2.client_id | b64enc }}

View File

@ -107,10 +107,10 @@ resources: {}
probes: probes:
startup: startup:
enabled: true enabled: true
initialDelaySeconds: 10 initialDelaySeconds: 30
periodSeconds: 10 periodSeconds: 15
timeoutSeconds: 5 timeoutSeconds: 15
failureThreshold: 30 failureThreshold: 80
successThreshold: 1 successThreshold: 1
path: /health path: /health
liveness: liveness:
@ -157,21 +157,18 @@ config:
# Migration options # Migration options
migration_skip: false # Set to true to skip database migrations migration_skip: false # Set to true to skip database migrations
migration_retry: 3 # Number of retries for failed migrations migration_retry: 3 # Number of retries for failed migrations
migration_timeout: "600s" # Timeout for database migrations (default: 10 minutes)
# These are only required for postgres - direct configuration
# These are only required for postgres
host: "" host: ""
port: 5432 port: 5432
user: ""
password: ""
name: "" name: ""
# Secret configuration for database credentials # Secret configuration for postgres credentials
existingSecret: "" # Name of existing Kubernetes secret secrets:
hostKey: "db-host" # Key in the secret for database host existingSecret: "" # Name of existing Kubernetes secret containing postgres credentials
portKey: "db-port" # Key in the secret for database port userKey: "username" # Key in the secret for database username
userKey: "db-user" # Key in the secret for database user passwordKey: "password" # Key in the secret for database password
passwordKey: "db-password" # Key in the secret for database password
nameKey: "db-name" # Key in the secret for database name
# Security settings # Security settings
# For production, use a generated secret and store in a Kubernetes Secret # For production, use a generated secret and store in a Kubernetes Secret