Refactor environment variables in deployment template
The environment variables for the Paperless-NGX deployment have been refactored and moved into the main container section within the Kubernetes deployment manifest. This change organizes the environment variable definitions, enhancing readability and maintainability. Key modifications include: - Moved the `env` section under `containers.main`, allowing for a clearer structure. - Retained the logic for PostgreSQL, MariaDB, and Redis database configuration while ensuring environment variables are set within the context of the main application container. This change does not introduce any breaking functionality, but it does improve the clarity and intent of the configuration.
This commit is contained in:
@@ -1,48 +1,53 @@
|
|||||||
{{/* Append the hardcoded settings */}}
|
{{/* Append the hardcoded settings */}}
|
||||||
{{- define "healthchecks.harcodedValues" -}}
|
{{- define "healthchecks.harcodedValues" -}}
|
||||||
env:
|
controllers:
|
||||||
PAPERLESS_TIME_ZONE: {{ .Values.env.TZ }}
|
main:
|
||||||
PAPERLESS_PORT: {{ quote .Values.service.main.ports.http.port }}
|
type: deployment
|
||||||
|
containers:
|
||||||
{{- with .Values.ingress.main }}
|
main:
|
||||||
{{- if and .enabled .hosts }}
|
env:
|
||||||
PAPERLESS_URL: http{{ if .tls }}s{{ end }}://{{ (first .hosts).host }}
|
PAPERLESS_TIME_ZONE: {{ .Values.env.TZ }}
|
||||||
{{- end }}
|
PAPERLESS_PORT: {{ quote .Values.service.main.ports.http.port }}
|
||||||
{{- end }}
|
|
||||||
|
{{- with .Values.ingress.main }}
|
||||||
{{- if .Values.postgresql.enabled }}
|
{{- if and .enabled .hosts }}
|
||||||
{{- with .Values.postgresql }}
|
PAPERLESS_URL: http{{ if .tls }}s{{ end }}://{{ (first .hosts).host }}
|
||||||
PAPERLESS_DBENGINE: postgresql
|
{{- end }}
|
||||||
PAPERLESS_DBHOST: {{ $.Release.Name }}-postgresql
|
{{- end }}
|
||||||
PAPERLESS_DBNAME: {{ .auth.database }}
|
|
||||||
PAPERLESS_DBUSER: {{ default "postgres" .auth.username }}
|
{{- if .Values.postgresql.enabled }}
|
||||||
PAPERLESS_DBPASS:
|
{{- with .Values.postgresql }}
|
||||||
secretKeyRef:
|
PAPERLESS_DBENGINE: postgresql
|
||||||
name: {{ .auth.existingSecret | default (printf "%s-postgresql" $.Release.Name) }}
|
PAPERLESS_DBHOST: {{ $.Release.Name }}-postgresql
|
||||||
key: {{ if not .auth.password }}postgres-{{ end }}password
|
PAPERLESS_DBNAME: {{ .auth.database }}
|
||||||
{{- end }}
|
PAPERLESS_DBUSER: {{ default "postgres" .auth.username }}
|
||||||
{{- else if .Values.mariadb.enabled }}
|
PAPERLESS_DBPASS:
|
||||||
{{- with .Values.mariadb}}
|
secretKeyRef:
|
||||||
PAPERLESS_DBENGINE: mariadb
|
name: {{ .auth.existingSecret | default (printf "%s-postgresql" $.Release.Name) }}
|
||||||
PAPERLESS_DBHOST: {{ $.Release.Name }}-mariadb
|
key: {{ if not .auth.password }}postgres-{{ end }}password
|
||||||
PAPERLESS_DBNAME: {{ .auth.database }}
|
{{- end }}
|
||||||
PAPERLESS_DBUSER: {{ .auth.username }}
|
{{- else if .Values.mariadb.enabled }}
|
||||||
PAPERLESS_DBPASS:
|
{{- with .Values.mariadb}}
|
||||||
secretKeyRef:
|
PAPERLESS_DBENGINE: mariadb
|
||||||
name: {{ .auth.existingSecret | default (printf "%s-mariadb" $.Release.Name) }}
|
PAPERLESS_DBHOST: {{ $.Release.Name }}-mariadb
|
||||||
key: mariadb-password
|
PAPERLESS_DBNAME: {{ .auth.database }}
|
||||||
{{- end }}
|
PAPERLESS_DBUSER: {{ .auth.username }}
|
||||||
{{- end }}
|
PAPERLESS_DBPASS:
|
||||||
|
secretKeyRef:
|
||||||
{{- if .Values.redis.enabled }}
|
name: {{ .auth.existingSecret | default (printf "%s-mariadb" $.Release.Name) }}
|
||||||
{{- with .Values.redis }}
|
key: mariadb-password
|
||||||
A_REDIS_PASSWORD:
|
{{- end }}
|
||||||
secretKeyRef:
|
{{- end }}
|
||||||
name: {{ .auth.existingSecret | default (printf "%s-redis" $.Release.Name) }}
|
|
||||||
key: {{ .auth.existingSecretPasswordKey | default "redis-password" }}
|
{{- if .Values.redis.enabled }}
|
||||||
PAPERLESS_REDIS: redis://{{ .auth.username }}:$(A_REDIS_PASSWORD)@{{ $.Release.Name }}-redis-master
|
{{- with .Values.redis }}
|
||||||
{{- end }}
|
A_REDIS_PASSWORD:
|
||||||
{{- end }}
|
secretKeyRef:
|
||||||
|
name: {{ .auth.existingSecret | default (printf "%s-redis" $.Release.Name) }}
|
||||||
|
key: {{ .auth.existingSecretPasswordKey | default "redis-password" }}
|
||||||
|
PAPERLESS_REDIS: redis://{{ .auth.username }}:$(A_REDIS_PASSWORD)@{{ $.Release.Name }}-redis-master
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $_ := merge .Values (include "healthchecks.harcodedValues" . | fromYaml) -}}
|
{{- $_ := merge .Values (include "healthchecks.harcodedValues" . | fromYaml) -}}
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,10 @@ controllers:
|
|||||||
# @default -- See [values.yaml](./values.yaml)
|
# @default -- See [values.yaml](./values.yaml)
|
||||||
# -- Set the resource requests / limits for the container.
|
# -- Set the resource requests / limits for the container.
|
||||||
resources: {}
|
resources: {}
|
||||||
|
env:
|
||||||
env:
|
# -- Set the container timezone
|
||||||
# -- Set the container timezone
|
TZ: UTC
|
||||||
TZ: UTC
|
# PAPERLESS_SECRET_KEY: ""
|
||||||
# PAPERLESS_SECRET_KEY: ""
|
|
||||||
|
|
||||||
service:
|
service:
|
||||||
# -- Configures service settings for the chart.
|
# -- Configures service settings for the chart.
|
||||||
|
|||||||
Reference in New Issue
Block a user