mirror of
https://github.com/rtomik/helm-charts.git
synced 2026-07-16 16:25:16 +00:00
resolved [Bug][Paperless] Redis password from secret isn't working #5
This commit is contained in:
@ -2,7 +2,7 @@ apiVersion: v2
|
|||||||
name: paperless-ngx
|
name: paperless-ngx
|
||||||
description: Paperless-ngx helm chart for Kubernetes
|
description: Paperless-ngx helm chart for Kubernetes
|
||||||
type: application
|
type: application
|
||||||
version: 0.0.4
|
version: 0.0.5
|
||||||
appVersion: "2.20.3"
|
appVersion: "2.20.3"
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: Richard Tomik
|
- name: Richard Tomik
|
||||||
|
|||||||
@ -89,30 +89,42 @@ Redis port
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Redis URL
|
Redis URL (for non-authenticated Redis)
|
||||||
Constructs the Redis URL with optional authentication.
|
Constructs the Redis URL without authentication.
|
||||||
Format: redis://[username]:[password]@host:port/database
|
Format: redis://host:port/database
|
||||||
When existingSecret is configured, uses environment variable placeholder for password.
|
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "paperless-ngx.redis.url" -}}
|
{{- define "paperless-ngx.redis.url.noauth" -}}
|
||||||
|
{{- $host := include "paperless-ngx.redis.host" . }}
|
||||||
|
{{- $port := include "paperless-ngx.redis.port" . }}
|
||||||
|
{{- $database := .Values.redis.external.database | toString }}
|
||||||
|
{{- printf "redis://%s:%s/%s" $host $port $database }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Check if Redis authentication is configured
|
||||||
|
Returns true if either existingSecret or password is set
|
||||||
|
*/}}
|
||||||
|
{{- define "paperless-ngx.redis.hasAuth" -}}
|
||||||
|
{{- if or .Values.redis.external.existingSecret .Values.redis.external.password }}
|
||||||
|
{{- "true" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Redis URL with authentication (for secret generation)
|
||||||
|
Constructs the Redis URL with password interpolation for use in secrets.
|
||||||
|
This uses the actual password value when building the secret.
|
||||||
|
Format: redis://[username]:[password]@host:port/database
|
||||||
|
*/}}
|
||||||
|
{{- define "paperless-ngx.redis.url.withPassword" -}}
|
||||||
{{- $host := include "paperless-ngx.redis.host" . }}
|
{{- $host := include "paperless-ngx.redis.host" . }}
|
||||||
{{- $port := include "paperless-ngx.redis.port" . }}
|
{{- $port := include "paperless-ngx.redis.port" . }}
|
||||||
{{- $database := .Values.redis.external.database | toString }}
|
{{- $database := .Values.redis.external.database | toString }}
|
||||||
{{- $username := .Values.redis.external.username | default "" }}
|
{{- $username := .Values.redis.external.username | default "" }}
|
||||||
{{- if .Values.redis.external.existingSecret }}
|
{{- $password := .Values.redis.external.password | default "" }}
|
||||||
{{- if $username }}
|
|
||||||
{{- printf "redis://%s:$REDIS_PASSWORD@%s:%s/%s" $username $host $port $database }}
|
|
||||||
{{- else }}
|
|
||||||
{{- printf "redis://:$REDIS_PASSWORD@%s:%s/%s" $host $port $database }}
|
|
||||||
{{- end }}
|
|
||||||
{{- else if .Values.redis.external.password }}
|
|
||||||
{{- $password := .Values.redis.external.password }}
|
|
||||||
{{- if $username }}
|
{{- if $username }}
|
||||||
{{- printf "redis://%s:%s@%s:%s/%s" $username $password $host $port $database }}
|
{{- printf "redis://%s:%s@%s:%s/%s" $username $password $host $port $database }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- printf "redis://:%s@%s:%s/%s" $password $host $port $database }}
|
{{- printf "redis://:%s@%s:%s/%s" $password $host $port $database }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
|
||||||
{{- printf "redis://%s:%s/%s" $host $port $database }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@ -67,20 +67,21 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
# Required services
|
# Required services
|
||||||
|
{{- if include "paperless-ngx.redis.hasAuth" . }}
|
||||||
|
# When Redis has authentication, read the full URL from secret
|
||||||
- name: PAPERLESS_REDIS
|
- name: PAPERLESS_REDIS
|
||||||
value: {{ include "paperless-ngx.redis.url" . | quote }}
|
|
||||||
{{- if .Values.redis.external.prefix }}
|
|
||||||
- name: PAPERLESS_REDIS_PREFIX
|
|
||||||
value: {{ .Values.redis.external.prefix | quote }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
# Redis password from secret (if configured)
|
|
||||||
{{- if or .Values.redis.external.existingSecret .Values.redis.external.password }}
|
|
||||||
- name: REDIS_PASSWORD
|
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ .Values.redis.external.existingSecret | default (printf "%s-secrets" (include "paperless-ngx.fullname" .)) }}
|
name: {{ .Values.redis.external.existingSecret | default (printf "%s-secrets" (include "paperless-ngx.fullname" .)) }}
|
||||||
key: {{ .Values.redis.external.passwordKey | default "redis-password" }}
|
key: {{ .Values.redis.external.urlKey | default "redis-url" }}
|
||||||
|
{{- else }}
|
||||||
|
# When Redis has no authentication, use the simple URL
|
||||||
|
- name: PAPERLESS_REDIS
|
||||||
|
value: {{ include "paperless-ngx.redis.url.noauth" . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.external.prefix }}
|
||||||
|
- name: PAPERLESS_REDIS_PREFIX
|
||||||
|
value: {{ .Values.redis.external.prefix | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
- name: PAPERLESS_DBHOST
|
- name: PAPERLESS_DBHOST
|
||||||
|
|||||||
@ -32,6 +32,7 @@ data:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and .Values.redis.external.password (not .Values.redis.external.existingSecret) }}
|
{{- if and .Values.redis.external.password (not .Values.redis.external.existingSecret) }}
|
||||||
{{ .Values.redis.external.passwordKey | default "redis-password" }}: {{ .Values.redis.external.password | b64enc }}
|
{{ .Values.redis.external.passwordKey | default "redis-password" }}: {{ .Values.redis.external.password | b64enc }}
|
||||||
|
{{ .Values.redis.external.urlKey | default "redis-url" }}: {{ include "paperless-ngx.redis.url.withPassword" . | b64enc }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and .Values.config.admin.user (not .Values.config.admin.existingSecret) }}
|
{{- if and .Values.config.admin.user (not .Values.config.admin.existingSecret) }}
|
||||||
{{ .Values.config.admin.userKey | default "admin-user" }}: {{ .Values.config.admin.user | b64enc }}
|
{{ .Values.config.admin.userKey | default "admin-user" }}: {{ .Values.config.admin.user | b64enc }}
|
||||||
|
|||||||
@ -165,9 +165,13 @@ redis:
|
|||||||
# Authentication (leave empty if Redis has no auth)
|
# Authentication (leave empty if Redis has no auth)
|
||||||
username: "" # Optional: Redis username (Redis 6.0+)
|
username: "" # Optional: Redis username (Redis 6.0+)
|
||||||
# Use existingSecret for credentials if Redis has auth
|
# Use existingSecret for credentials if Redis has auth
|
||||||
|
# NOTE: When using existingSecret, the secret MUST contain a key with the full Redis URL
|
||||||
|
# Format: redis://[username]:[password]@host:port/database
|
||||||
existingSecret: ""
|
existingSecret: ""
|
||||||
passwordKey: "redis-password"
|
urlKey: "redis-url" # Key in existingSecret containing the full Redis URL
|
||||||
|
passwordKey: "redis-password" # Key in existingSecret for password (for compatibility)
|
||||||
# Or set password directly (leave empty if no auth)
|
# Or set password directly (leave empty if no auth)
|
||||||
|
# When using plain password, the full Redis URL will be auto-generated in the secret
|
||||||
password: ""
|
password: ""
|
||||||
# Optional: Prefix for Redis keys and channels
|
# Optional: Prefix for Redis keys and channels
|
||||||
# Useful for sharing one Redis server among multiple Paperless instances
|
# Useful for sharing one Redis server among multiple Paperless instances
|
||||||
|
|||||||
Reference in New Issue
Block a user