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

Randomizing base number for LB rule to allow for updates #729

Merged
merged 1 commit into from
Jan 2, 2024
Merged
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
4 changes: 3 additions & 1 deletion ecs_composex/elbv2/elbv2_stack/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from __future__ import annotations

import random
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand Down Expand Up @@ -382,8 +383,9 @@ def define_listener_rules_actions(
Function to identify the Target definition and create the resulting rule appropriately.
"""
rules = []
offset = random.randint(1, 100)
for count, service_def in enumerate(left_services):
priority = count + 1
priority = count + 1 + offset
rule = ListenerRule(
f"{listener.title}{NONALPHANUM.sub('', service_def['name'])}Rule{count}",
ListenerArn=Ref(listener),
Expand Down