From 46718f2c0c3a837429dfaf48e5b11c0d9631f1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Compagnon?= Date: Mon, 7 Aug 2023 18:58:42 +0200 Subject: [PATCH] PostgreSQL is now optional + migration on every start --- kubernetes/Chart.lock | 6 +++--- kubernetes/Chart.yaml | 1 + kubernetes/templates/deployment.yaml | 15 +++++++++++++-- kubernetes/values.yaml | 6 +----- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/kubernetes/Chart.lock b/kubernetes/Chart.lock index cc76e920..50d3c638 100644 --- a/kubernetes/Chart.lock +++ b/kubernetes/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami/ - version: 12.1.9 -digest: sha256:71ff342a6c0a98bece3d7fe199983afb2113f8db65a3e3819de875af2c45add7 -generated: "2023-01-20T20:42:32.757707004Z" + version: 12.1.15 +digest: sha256:b42ad043e9315686145047ac5625e1cb83cd6cfd7abf935f1db5cc3336dadb7f +generated: "2023-07-24T12:08:45.084074+02:00" diff --git a/kubernetes/Chart.yaml b/kubernetes/Chart.yaml index 4e4295ba..7d9315ac 100644 --- a/kubernetes/Chart.yaml +++ b/kubernetes/Chart.yaml @@ -19,4 +19,5 @@ dependencies: - name: postgresql version: ~12.1.6 repository: "https://charts.bitnami.com/bitnami/" + condition: postgresql.enabled engine: gotpl diff --git a/kubernetes/templates/deployment.yaml b/kubernetes/templates/deployment.yaml index bb0b832f..4ef4fce4 100644 --- a/kubernetes/templates/deployment.yaml +++ b/kubernetes/templates/deployment.yaml @@ -30,6 +30,18 @@ spec: - /bin/sh - -c - until pg_isready -h {{ .Values.config.db.host }} -p {{ .Values.config.db.port }} -U {{ .Values.config.db.user }}; do echo waiting for database; sleep 2; done; + - name: db-migration + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: INVIDIOUS_CONFIG + valueFrom: + configMapKeyRef: + key: INVIDIOUS_CONFIG + name: {{ template "invidious.fullname" . }} + command: + - /invidious/invidious + - --migrate containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" @@ -47,8 +59,7 @@ spec: capabilities: drop: - ALL - resources: -{{ toYaml .Values.resources | indent 10 }} + resources: {{ toYaml .Values.resources | nindent 10 }} readinessProbe: httpGet: port: 3000 diff --git a/kubernetes/values.yaml b/kubernetes/values.yaml index 5000c2b6..20de6897 100644 --- a/kubernetes/values.yaml +++ b/kubernetes/values.yaml @@ -34,17 +34,13 @@ securityContext: # See https://github.com/bitnami/charts/tree/master/bitnami/postgresql postgresql: + enabled: true image: tag: 13 auth: username: kemal password: kemal database: invidious - primary: - initdb: - username: kemal - password: kemal - scriptsConfigMap: invidious-postgresql-init # Adapted from ../config/config.yml config: