Merge "kube/postgres: add extra options configuration option"
diff --git a/kube/postgres.libsonnet b/kube/postgres.libsonnet
index a80c236..edb1cae 100644
--- a/kube/postgres.libsonnet
+++ b/kube/postgres.libsonnet
@@ -24,6 +24,11 @@
         # 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 @@
                             } + 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" },
                             },