Skip to content

Commit

Permalink
Fix the default database host value (#8)
Browse files Browse the repository at this point in the history
The default config for db.host is "invidious-postgresql" which only
works when the chart is installed with a release name of "invidious".

Changed the default db.host value to "${release_name}-postgresql".
  • Loading branch information
alindt authored Jan 21, 2025
1 parent b6e254c commit 28dbdb7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions invidious/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Invidious is an alternative front-end to YouTube

type: application

version: 2.0.4
version: 2.0.5
appVersion: v2.20240427

dependencies:
Expand All @@ -20,7 +20,7 @@ keywords:
- proxy
- video
- privacy

home: https://invidious.io
icon: https://raw.githubusercontent.com/iv-org/invidious/05988c1c49851b7d0094fca16aeaf6382a7f64ab/assets/favicon-32x32.png

Expand Down
17 changes: 17 additions & 0 deletions invidious/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@ Selector labels
app.kubernetes.io/name: {{ include "invidious.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Initialize default values and validate database configuration
*/}}
{{- define "invidious.init-defaults" -}}
{{/* Set default PostgreSQL host if using in-chart PostgreSQL */}}
{{- if .Values.postgresql.enabled }}
{{- if not .Values.config.db.host }}
{{- $_ := set .Values.config.db "host" (printf "%s-postgresql" .Release.Name) }}
{{- end }}
{{- else }}
{{/* Fail if external database host is not provided when in-chart PostgreSQL is disabled */}}
{{- if not .Values.config.db.host }}
{{- fail "config.db.host must be set when postgresql.enabled is false" }}
{{- end }}
{{- end }}
{{- end -}}
1 change: 1 addition & 0 deletions invidious/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- include "invidious.init-defaults" . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions invidious/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- include "invidious.init-defaults" . }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
2 changes: 1 addition & 1 deletion invidious/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ config:
db:
user: kemal
password: kemal
host: invidious-postgresql
host: ""
port: 5432
dbname: invidious
port: 3000
Expand Down

0 comments on commit 28dbdb7

Please sign in to comment.