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

FIX: Use subnet cidr for member secgroup rules to support amphora VRRP_IP #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions lib/charms/layer/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ def __init__(self, app_name, port, subnet, algorithm, fip_net, manage_secgrps):
self.member_sg_id = None
self.fip = None
self.address = None
self.subnet_cidr = None
self.members = set()
self.is_created = False
self._impl = self._get_impl()
Expand Down Expand Up @@ -541,6 +542,7 @@ def create(self):
log("Created load balancer {} ({})", self.name, lb_info["id"])
self._wait_lb_not_pending()
self.address = lb_info["vip_address"]
self.subnet_cidr = self._impl.get_subnet_cidr(self.subnet)

if self.manage_secgrps:
sg_id = self._impl.find_secgrp(self.name)
Expand Down Expand Up @@ -743,8 +745,8 @@ def _add_member_sg(self, member):
not in _openstack("port", "show", port_id)["security_group_ids"]
):
self._impl.set_port_secgrp(port_id, self.member_sg_id)
if not self._find_matching_sg_rule(self.member_sg_id, self.address, port):
self._impl.create_sg_rule(self.member_sg_id, self.address, port)
if not self._find_matching_sg_rule(self.member_sg_id, self.subnet_cidr, port):
self._impl.create_sg_rule(self.member_sg_id, self.subnet_cidr, port)

def delete(self):
"""Delete this loadbalancer and all of its resources."""
Expand Down
Loading