Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove-pgbouncer and upgrade MAAS to 3.5 #54

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,5 @@ And `juju login` as usual.
- MAAS Region: <https://charmhub.io/maas-region>
- MAAS Region: <https://charmhub.io/maas-agent>
- PostgreSQL: <https://charmhub.io/postgresql>
- PgBouncer: <https://charmhub.io/pgbouncer>
- HAProxy: <https://charmhub.io/haproxy>
- Keepalived: <https://charmhub.io/keepalived>
2 changes: 1 addition & 1 deletion anvil-python/anvil/commands/maas_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion anvil-python/anvil/commands/upgrades/inter_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def __init__(
jhelper,
manifest,
model,
["maas-region", "pgbouncer"],
["maas-region"],
"maas-region-plan",
MAASREGION_CONFIG_KEY,
MAASREGION_UNIT_TIMEOUT,
Expand Down
11 changes: 2 additions & 9 deletions anvil-python/anvil/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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] = {}
Expand All @@ -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",
},
}
}

Expand Down
36 changes: 2 additions & 34 deletions cloud/etc/deploy-maas-region/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -93,7 +61,7 @@ resource "juju_integration" "maas-region-pgbouncer" {
}

application {
name = juju_application.pgbouncer.name
name = "postgresql"
endpoint = "database"
}
}
Expand Down
26 changes: 1 addition & 25 deletions cloud/etc/deploy-maas-region/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
}
}
Loading