Skip to content

Commit

Permalink
integration to use the endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
SK1Y101 committed Jun 27, 2024
1 parent 1c8f539 commit 5374baa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 2 additions & 0 deletions anvil-python/anvil/commands/haproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def prompt(self, console: Console | None = None) -> None:
LOG.debug(self.variables)
write_answers(self.client, CONFIG_KEY, self.variables)



def extra_tfvars(self) -> dict[str, Any]:
return self.variables

Expand Down
11 changes: 0 additions & 11 deletions anvil-python/anvil/provider/local/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,12 @@ def deployment_type(self) -> tuple[str, type[Deployment]]:
help="Specify additional roles, region or agent, for the "
"bootstrap node. Defaults to the database role.",
)
@click.option(
"--vip",
type=click.STRING,
callback=validate_ip_address,
help="Specify the Virtual IP address.",
)
@click.pass_context
def bootstrap(
ctx: click.Context,
roles: List[Role],
manifest: Path | None = None,
accept_defaults: bool = False,
vip: str | None = None,
) -> None:
"""Bootstrap the local node.
Expand Down Expand Up @@ -210,10 +203,6 @@ def bootstrap(
if Role.DATABASE not in roles:
LOG.debug("Enabling database role for bootstrap")
roles.append(Role.DATABASE)
# VIP functionality requires haproxy
if Role.HAPROXY not in roles and vip:
LOG.debug("Enabling haproxy for VIP")
roles.append(Role.HAPROXY)
is_region_node = any(role.is_region_node() for role in roles)
is_agent_node = any(role.is_agent_node() for role in roles)
is_haproxy_node = any(role.is_haproxy_node() for role in roles)
Expand Down
22 changes: 16 additions & 6 deletions cloud/etc/deploy-haproxy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "juju_application" "haproxy" {
}

resource "juju_application" "keepalived" {
count = var.virtual_ip != "" ? 1 : 0
count = length(var.virtual_ip) > 0 ? 1 : 0
name = "keepalived"
model = data.juju_model.machine_model.name

Expand All @@ -57,12 +57,22 @@ resource "juju_application" "keepalived" {
base = "ubuntu@22.04"
}

config = var.charm_haproxy_config
config = {
"virtual_ip": var.virtual_ip,
}
}

resource "juju_integration" "haproxy_keepalived" {
count = var.virtual_ip != "" ? 1 : 0
resource "juju_integration" "maas-region-haproxy" {
count = length(var.virtual_ip) > 0 ? 1 : 0
model = data.juju_model.machine_model.name
application_one = juju_application.haproxy.name
application_two = juju_application.keepalived[0].name

application {
name = juju_application.haproxy.name
endpoint = "juju-info"
}

application {
name = juju_application.keepalived.name
endpoint = "juju-info"
}
}

0 comments on commit 5374baa

Please sign in to comment.