Skip to content

Commit

Permalink
Add support for user-provided default network ACL
Browse files Browse the repository at this point in the history
Signed-off-by: henrick <[email protected]>
  • Loading branch information
henrick committed Nov 5, 2024
1 parent 9597662 commit ffb92d5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def run(
subnet_ids = scenario_config["subnet_id"]
duration = scenario_config["duration"]
cloud_type = scenario_config["cloud_type"]
# Add support for user-provided default network ACL
default_acl_id = scenario_config.get("default_acl_id")
ids = {}
acl_ids_created = []

Expand Down Expand Up @@ -58,15 +60,22 @@ def run(
"Network association ids associated with "
"the subnet %s: %s" % (subnet_id, network_association_ids)
)
acl_id = cloud_object.create_default_network_acl(vpc_id)

# Use provided default ACL if available, otherwise create a new one
if default_acl_id:
acl_id = default_acl_id
# Don't add to acl_id since we didn't create it
else:
acl_id = cloud_object.create_default_network_acl(vpc_id)
acl_ids_created.append(acl_id)

new_association_id = cloud_object.replace_network_acl_association(
network_association_ids[0], acl_id
)

# capture the orginal_acl_id, created_acl_id and
# new association_id to use during the recovery
ids[new_association_id] = original_acl_id
acl_ids_created.append(acl_id)

# wait for the specified duration
logging.info(
Expand Down

0 comments on commit ffb92d5

Please sign in to comment.