From 85bef02ae334264141db6f380b5e28306445b782 Mon Sep 17 00:00:00 2001
From: Mart van Santen <mart@greenhost.nl>
Date: Thu, 14 Oct 2021 17:20:49 +0200
Subject: [PATCH] Attempt to use kratos helm chart

---
 docker-compose.yml                         | 10 ++++------
 helmchart/single-sign-on/Chart.yaml        |  2 +-
 helmchart/single-sign-on/requirements.yaml | 19 +++++++++++++++++++
 helmchart/single-sign-on/values.yaml       | 21 +++++++++++++++++++++
 4 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/docker-compose.yml b/docker-compose.yml
index 4ab66e1..2c04ce9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -109,14 +109,12 @@ services:
       - DSN=postgres://kratos:secret@kratos-db:5433/kratos?sslmode=disable
     command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
   kratos-db:
-    image: postgres:13
+    image: postgres:11
     environment:
-      - POSTGRES_USER=kratos
-      - POSTGRES_DB=kratos
-      - POSTGRES_PASSWORD=secret
+      - POSTGRES_PASSWORD=kratossecret
     ports:
       - "5433:5433"
-    volumes:
-      - .local/kratos/psql:/var/lib/postgresql/data
+    #volumes:
+    #  - .local/kratos/psql:/var/lib/postgresql/data
     # change port via command https://github.com/docker-library/postgres/issues/196
     command: -p 5433
diff --git a/helmchart/single-sign-on/Chart.yaml b/helmchart/single-sign-on/Chart.yaml
index 681a7d2..429d2e1 100644
--- a/helmchart/single-sign-on/Chart.yaml
+++ b/helmchart/single-sign-on/Chart.yaml
@@ -1,4 +1,4 @@
 apiVersion: v1
-description: A Helm chart for OpenAppStack's Signle sign-on components
+description: A Helm chart for OpenAppStack's Single sign-on components
 name: single-sign-on
 version: 0.2.11
diff --git a/helmchart/single-sign-on/requirements.yaml b/helmchart/single-sign-on/requirements.yaml
index c6c61d7..28ca3a5 100644
--- a/helmchart/single-sign-on/requirements.yaml
+++ b/helmchart/single-sign-on/requirements.yaml
@@ -1,6 +1,25 @@
+# Documentation: https://k8s.ory.sh/helm/kratos.html
 dependencies:
   - name: hydra
     version: 0.0.48
     repository: "https://k8s.ory.sh/helm/charts"
     tags:
       - single-sign-on
+
+
+# https://github.com/bitnami/charts/tree/master/bitnami/postgresql
+  - name: postgresql
+    version: 8.6.4 
+    repository: "https://charts.bitnami.com/bitnami"
+    tags:
+      - single-sign-on
+
+
+# https://k8s.ory.sh/helm/kratos.html
+  - name: kratos
+    version: 0.19.5
+    repository: "https://k8s.ory.sh/helm/charts"
+    tags:
+      - single-sign-on
+
+
diff --git a/helmchart/single-sign-on/values.yaml b/helmchart/single-sign-on/values.yaml
index 84dabeb..00fad5e 100644
--- a/helmchart/single-sign-on/values.yaml
+++ b/helmchart/single-sign-on/values.yaml
@@ -69,6 +69,27 @@ userbackend:
   podLabels: {}
   podAnnotations: {}
 
+
+postgresql:
+  persistence:
+    enabled: true
+    size: 2Gi
+    storageClass: "-"
+    annotations: {}
+  postgresqlDatabase: kratos
+  postgresqlUsername: kratos
+  postgresqlPassword: kratos
+  servicePort: 5433
+
+kratos:
+  kratos:
+    config:
+      dsn: postgres://kratos:kratos@{{ .Release.Name }}-postgresql:5433/kratos
+      secrets:
+        session:
+          - a password goes here
+          - a secred goes here
+
 hydra:
   maester:
     # hydra.maester.enabled instal hydra-maester which is enabled by default
-- 
GitLab