kube/postgres: add versioned library

also use in mastodon-qa

Change-Id: I628293fcfe9081c350087572ecda9e51ee18238f
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1422
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/app/mastodon/kube/mastodon.libsonnet b/app/mastodon/kube/mastodon.libsonnet
index 383c3ae..383e081 100644
--- a/app/mastodon/kube/mastodon.libsonnet
+++ b/app/mastodon/kube/mastodon.libsonnet
@@ -1,5 +1,6 @@
 local kube = import "../../../kube/kube.libsonnet";
 local postgres = import "../../../kube/postgres.libsonnet";
+local postgres_v = import "../../../kube/postgres_v.libsonnet";
 local redis = import "../../../kube/redis.libsonnet";
 
 {
@@ -126,6 +127,23 @@
             password: kube.SecretKeyRef(app.config, "postgres-pass"),
             storageClassName: "waw-hdd-redundant-3",
             storageSize: "100Gi",
+            opts: { wal_level: "logical" },
+        },
+    },
+
+    #TODO(implr) remove above and replace with this post migration
+    postgresNew: postgres_v {
+        cfg+: {
+            version: "13.9",
+            namespace: cfg.namespace,
+            appName: "mastodon",
+            database: "mastodon",
+            username: "mastodon",
+            prefix: "waw3-",
+            password: kube.SecretKeyRef(app.config, "postgres-pass"),
+            storageClassName: "waw-hdd-redundant-3",
+            storageSize: "100Gi",
+            opts: { wal_level: "logical" },
         },
     },