From 96146fe0f3a615e404b7255008870a05507446cf Mon Sep 17 00:00:00 2001 From: Wei Quan Date: Fri, 3 Jul 2026 10:48:24 +0200 Subject: [PATCH] Add configurable CCDB connection parameters Expose ccdb.connection_parameters as an optional BOSH property on both cloud_controller_ng and cloud_controller_worker jobs. Operators can use this to configure PostgreSQL session parameters (statement_timeout, idle_in_transaction_session_timeout) and TCP keepalive settings (keepalives, keepalives_idle, keepalives_interval, keepalives_count) from the BOSH manifest instead of requiring DB-level configuration. --- jobs/cloud_controller_ng/spec | 3 +++ .../templates/cloud_controller_ng.yml.erb | 8 ++++++++ jobs/cloud_controller_worker/spec | 3 +++ .../templates/cloud_controller_ng.yml.erb | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/jobs/cloud_controller_ng/spec b/jobs/cloud_controller_ng/spec index ff0a3e61b5..df17b25859 100644 --- a/jobs/cloud_controller_ng/spec +++ b/jobs/cloud_controller_ng/spec @@ -783,6 +783,9 @@ properties: description: "The period in seconds after which connections are expired (omit to never expire connections), passed directly to the Sequel gem - see https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_expiration_rb.html for details" ccdb.connection_expiration_random_delay: description: "The random delay in seconds to the expiration timeout (to prevent all connections being recreated simultaneously), passed directly to the Sequel gem - see https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_expiration_rb.html for details" + ccdb.connection_parameters: + description: "Hash of PostgreSQL connection parameters passed directly to the database driver (e.g. statement_timeout, idle_in_transaction_session_timeout, keepalives, keepalives_idle, keepalives_interval, keepalives_count)" + default: {} ccdb.max_connections_per_local_worker: description: "Maximum database connections per cc local worker, if not set the ccng value is used (default)" ccdb.enable_paginate_window: diff --git a/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb b/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb index 0d0b95ef16..450197854f 100644 --- a/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb +++ b/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb @@ -241,6 +241,14 @@ db: &db migration_psql_worker_memory_kb: <%= psql_worker_memory_kb %> <% end %> enable_paginate_window: <%= p("ccdb.enable_paginate_window") %> +<% if_p("ccdb.connection_parameters") do |connection_parameters| %> +<% unless connection_parameters.empty? %> + connection_parameters: +<% connection_parameters.each do |key, value| %> + <%= key %>: <%= value %> +<% end %> +<% end %> +<% end %> <% scheme = p("login.protocol") system_domain = p("system_domain") %> diff --git a/jobs/cloud_controller_worker/spec b/jobs/cloud_controller_worker/spec index 12860c8eb5..66fa7bc851 100644 --- a/jobs/cloud_controller_worker/spec +++ b/jobs/cloud_controller_worker/spec @@ -377,6 +377,9 @@ properties: description: "The period in seconds after which connections are expired (omit to never expire connections), passed directly to the Sequel gem - see https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_expiration_rb.html for details" ccdb.connection_expiration_random_delay: description: "The random delay in seconds to the expiration timeout (to prevent all connections being recreated simultaneously), passed directly to the Sequel gem - see https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_expiration_rb.html for details" + ccdb.connection_parameters: + description: "Hash of PostgreSQL connection parameters passed directly to the database driver (e.g. statement_timeout, idle_in_transaction_session_timeout, keepalives, keepalives_idle, keepalives_interval, keepalives_count)" + default: {} cc.database_encryption.keys: default: {} diff --git a/jobs/cloud_controller_worker/templates/cloud_controller_ng.yml.erb b/jobs/cloud_controller_worker/templates/cloud_controller_ng.yml.erb index 3506b48d4d..7fbb2fb1f8 100644 --- a/jobs/cloud_controller_worker/templates/cloud_controller_ng.yml.erb +++ b/jobs/cloud_controller_worker/templates/cloud_controller_ng.yml.erb @@ -134,6 +134,14 @@ db: &db <% if_p("ccdb.connection_expiration_random_delay") do |expiration_delay| %> connection_expiration_random_delay: <%= expiration_delay %> <% end %> +<% if_p("ccdb.connection_parameters") do |connection_parameters| %> +<% unless connection_parameters.empty? %> + connection_parameters: +<% connection_parameters.each do |key, value| %> + <%= key %>: <%= value %> +<% end %> +<% end %> +<% end %> <% system_domain = p("system_domain") %>