kube/postgres: disable bouncer by default
Change-Id: I29b3be1394545998409cf11cc1702d9976be0f5c
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1790
Reviewed-by: informatic <informatic@hackerspace.pl>
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/app/inventory/prod.jsonnet b/app/inventory/prod.jsonnet
index 1b81c97..5b94e53 100644
--- a/app/inventory/prod.jsonnet
+++ b/app/inventory/prod.jsonnet
@@ -77,7 +77,6 @@
password: top.secretRefs.postgres,
versionedNames: true,
},
- bouncer: {},
},
service: ns.Contain(kube.Service(cfg.name)) {
diff --git a/hswaw/kube/pretalx.libsonnet b/hswaw/kube/pretalx.libsonnet
index 9025a9e..d0d18d4 100644
--- a/hswaw/kube/pretalx.libsonnet
+++ b/hswaw/kube/pretalx.libsonnet
@@ -188,7 +188,7 @@
name: "pretalx",
user: "pretalx",
// password: ... // provided by environment variable from secret
- host: pretalx.postgres.bouncer.svc.host,
+ host: pretalx.postgres.bouncer.host,
//port: 5432
},
mail: {
@@ -217,6 +217,9 @@
database: "pretalx",
username: "pretalx",
password: pretalx.cfg.pgpass,
+ bouncer: {
+ enable: true,
+ },
},
},
diff --git a/hswaw/paperless/paperless.libsonnet b/hswaw/paperless/paperless.libsonnet
index c24f264..3b8114b 100644
--- a/hswaw/paperless/paperless.libsonnet
+++ b/hswaw/paperless/paperless.libsonnet
@@ -64,7 +64,6 @@
from: "10",
},
},
- bouncer: {},
},
dataVolume: ns.Contain(kube.PersistentVolumeClaim("paperless-data")) {
diff --git a/kube/postgres.libsonnet b/kube/postgres.libsonnet
index 9ae1ccf..a3c6415 100644
--- a/kube/postgres.libsonnet
+++ b/kube/postgres.libsonnet
@@ -56,6 +56,13 @@
to: std.native('regexSubst')("^[^:]+:([^.]+).*$", cfg.image, "${1}"),
},
+ # Optional pgbouncer
+ # if enabled, use `postgres.bouncer.host` as database host
+ bouncer: {
+ enable: false,
+ image: "edoburu/pgbouncer:1.11.0",
+ },
+
# If set to true, resources will be suffixed with postgres version (and will have versioned labels)
# This exists solely for backwards compatibility with old postgres_v libsonnet
# and should not be used in new deployments
@@ -189,7 +196,7 @@
},
},
- bouncer: {
+ bouncer: if cfg.bouncer.enable then {
deployment: kube.Deployment(postgres.makeName("bouncer")) {
metadata+: postgres.metadata {
labels+: {
@@ -202,7 +209,7 @@
spec+: {
containers_: {
bouncer: kube.Container(postgres.makeName("bouncer")) {
- image: "edoburu/pgbouncer:1.11.0",
+ image: cfg.bouncer.image,
ports_: {
client: { containerPort: 5432 },
},
@@ -216,6 +223,7 @@
},
},
},
+ host:: self.svc.host,
svc: kube.Service(postgres.makeName("bouncer")) {
metadata+: postgres.metadata {
labels+: {
@@ -230,5 +238,5 @@
type: "ClusterIP",
},
},
- },
+ } else {},
}