From d83d0767d63895f6a7125a06021f32d3a4d20b40 Mon Sep 17 00:00:00 2001 From: Stamatis Katsaounis Date: Fri, 23 Aug 2024 14:22:47 +0300 Subject: [PATCH] feat: remove-pgbouncer --- README.md | 1 - anvil-python/anvil/commands/maas_region.py | 2 +- .../anvil/commands/upgrades/inter_channel.py | 2 +- anvil-python/anvil/versions.py | 11 ++---- cloud/etc/deploy-maas-region/main.tf | 36 ++----------------- cloud/etc/deploy-maas-region/variables.tf | 26 +------------- 6 files changed, 7 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 8951879..87841c5 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,5 @@ And `juju login` as usual. - MAAS Region: - MAAS Region: - PostgreSQL: -- PgBouncer: - HAProxy: - Keepalived: diff --git a/anvil-python/anvil/commands/maas_region.py b/anvil-python/anvil/commands/maas_region.py index b1497eb..210e282 100644 --- a/anvil-python/anvil/commands/maas_region.py +++ b/anvil-python/anvil/commands/maas_region.py @@ -76,7 +76,7 @@ def extra_tfvars(self) -> dict[str, Any]: haproxy_vars: dict[str, Any] = questions.load_answers( self.client, HAPROXY_CONFIG_KEY ) - if enable_haproxy and "ssl_cert" in haproxy_vars: + if enable_haproxy and haproxy_vars.get("ssl_cert", "") != "": variables["tls_mode"] = "termination" return variables diff --git a/anvil-python/anvil/commands/upgrades/inter_channel.py b/anvil-python/anvil/commands/upgrades/inter_channel.py index 6d6bdb3..857d700 100644 --- a/anvil-python/anvil/commands/upgrades/inter_channel.py +++ b/anvil-python/anvil/commands/upgrades/inter_channel.py @@ -198,7 +198,7 @@ def __init__( jhelper, manifest, model, - ["maas-region", "pgbouncer"], + ["maas-region"], "maas-region-plan", MAASREGION_CONFIG_KEY, MAASREGION_UNIT_TIMEOUT, diff --git a/anvil-python/anvil/versions.py b/anvil-python/anvil/versions.py index e50b0c5..d8a6f5e 100644 --- a/anvil-python/anvil/versions.py +++ b/anvil-python/anvil/versions.py @@ -13,10 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -MAAS_REGION_CHANNEL = "3.4/edge" -MAAS_AGENT_CHANNEL = "3.4/edge" +MAAS_REGION_CHANNEL = "3.5/edge" +MAAS_AGENT_CHANNEL = "3.5/edge" POSTGRESQL_CHANNEL = "14/stable" -PGBOUNCER_CHANNEL = "1/stable" HAPROXY_CHANNEL = "latest/stable" KEEPALIVED_CHANNEL = "latest/stable" @@ -25,7 +24,6 @@ "maas-agent": MAAS_AGENT_CHANNEL, "haproxy": HAPROXY_CHANNEL, "postgresql": POSTGRESQL_CHANNEL, - "pgbouncer": PGBOUNCER_CHANNEL, "keepalived": KEEPALIVED_CHANNEL, } K8S_CHARMS: dict[str, str] = {} @@ -48,11 +46,6 @@ "revision": "charm_maas_region_revision", "config": "charm_maas_region_config", }, - "pgbouncer": { - "channel": "charm_pgbouncer_channel", - "revision": "charm_pgbouncer_revision", - "config": "charm_pgbouncer_config", - }, } } diff --git a/cloud/etc/deploy-maas-region/main.tf b/cloud/etc/deploy-maas-region/main.tf index 95baab0..8c734be 100644 --- a/cloud/etc/deploy-maas-region/main.tf +++ b/cloud/etc/deploy-maas-region/main.tf @@ -52,39 +52,7 @@ resource "juju_application" "maas-region" { ) } -resource "juju_application" "pgbouncer" { - name = "pgbouncer" - model = data.juju_model.machine_model.name - units = 0 # it is a subordinate charm - - charm { - name = "pgbouncer" - channel = var.charm_pgbouncer_channel - revision = var.charm_pgbouncer_revision - base = "ubuntu@22.04" - } - - config = merge({ - pool_mode = "session" - max_db_connections = var.max_connections_per_region - }, var.charm_pgbouncer_config) -} - -resource "juju_integration" "postgresql-pgbouncer" { - model = data.juju_model.machine_model.name - - application { - name = "postgresql" - endpoint = "database" - } - - application { - name = juju_application.pgbouncer.name - endpoint = "backend-database" - } -} - -resource "juju_integration" "maas-region-pgbouncer" { +resource "juju_integration" "maas-region-postgresql" { model = data.juju_model.machine_model.name application { @@ -93,7 +61,7 @@ resource "juju_integration" "maas-region-pgbouncer" { } application { - name = juju_application.pgbouncer.name + name = "postgresql" endpoint = "database" } } diff --git a/cloud/etc/deploy-maas-region/variables.tf b/cloud/etc/deploy-maas-region/variables.tf index 3a617fb..6d794fa 100644 --- a/cloud/etc/deploy-maas-region/variables.tf +++ b/cloud/etc/deploy-maas-region/variables.tf @@ -48,32 +48,8 @@ variable "enable_haproxy" { default = false } -variable "charm_pgbouncer_channel" { - description = "Operator channel for PgBouncer deployment" - type = string - default = "1/stable" -} - -variable "charm_pgbouncer_revision" { - description = "Operator channel revision for PgBouncer deployment" - type = number - default = null -} - -variable "charm_pgbouncer_config" { - description = "Operator config for PgBouncer deployment" - type = map(string) - default = {} -} - -variable "max_connections_per_region" { - description = "Maximum number of concurrent connections to allow to the database server per region" - type = number - default = 50 -} - variable "tls_mode" { description = "TLS Mode for MAAS Region charm ('', 'termination', or 'passthrough')" type = string default = "" -} \ No newline at end of file +}