diff --git a/kube/postgres.libsonnet b/kube/postgres.libsonnet index a80c2360..edb1cae3 100644 --- a/kube/postgres.libsonnet +++ b/kube/postgres.libsonnet @@ -24,6 +24,11 @@ local kube = import "kube.libsonnet"; # Changing this option in already existing deployments will not affect # existing database. initdbArgs: null, + + # Extra postgres configuration options passed on startup. Accepts only + # string values. + # Example: { max_connections: "300" } + opts: {}, }, makeName(suffix):: cfg.prefix + suffix, @@ -72,6 +77,12 @@ local kube = import "kube.libsonnet"; } + if cfg.initdbArgs != null then { POSTGRES_INITDB_ARGS: cfg.initdbArgs, } else {}, + + args: std.flatMap( + function(k) ["-c", "%s=%s" % [k, cfg.opts[k]]], + std.objectFields(cfg.opts), + ), + volumeMounts_: { data: { mountPath: "/var/lib/postgresql/data" }, },