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

Improve traffic handling #497

Closed
wants to merge 9 commits into from
Closed

Improve traffic handling #497

wants to merge 9 commits into from

Conversation

jmcs
Copy link
Member

@jmcs jmcs commented Jan 16, 2018

Fixes #490

@jmcs jmcs requested a review from erthalion January 16, 2018 10:33
@coveralls
Copy link

coveralls commented Jan 16, 2018

Coverage Status

Coverage decreased (-0.1%) to 89.475% when pulling 3fc0df1 on fix-traffic into 3be07b3 on master.

@coveralls
Copy link

coveralls commented Jan 16, 2018

Coverage Status

Coverage increased (+0.05%) to 89.664% when pulling 91746ff on fix-traffic into 3be07b3 on master.

@zalando-stups zalando-stups deleted a comment Jan 16, 2018
@zalando-stups zalando-stups deleted a comment Jan 16, 2018
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 89.664% when pulling 2dc74b7 on fix-traffic into 3be07b3 on master.

@coveralls
Copy link

coveralls commented Jan 16, 2018

Coverage Status

Coverage increased (+0.05%) to 89.664% when pulling 2dc74b7 on fix-traffic into 3be07b3 on master.

@zalando-stups zalando-stups deleted a comment Jan 16, 2018
@zalando-stups zalando-stups deleted a comment Jan 16, 2018
@@ -592,10 +593,13 @@ def health(region, stack_ref, all, output, field, w, watch):
help='Ignore failing validation checks')
@click.option('--update-if-exists', is_flag=True,
help='Updates the the stack if it exists')
@click.option('--ensure-no-traffic', is_flag=True,
help="Don't create a stack if it would automatically receive "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this phrase fails to deliver the idea that it's happening because of 0 traffic weight - maybe something like "Don't create a stack if it has no traffic and would automatically receive it after the change". What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New stacks never have traffic so "if it has no traffic" is always true.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to fail when you create the very first version of a stack?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a1exsh good question..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the flag is off by default, so you can just omit the flag the first time. I made the behaviour like this to prevent any unexcepted results, specially for Continuous Delivery pipelines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmcs I'm not sure if this buys us a lot if the flag is not enabled by default. It's easy to forget and if you don't already know about the issue, you have no chance.

Can we do this w/o a flag? Like always avoid creating a new stack version if there are some existing versions and all of them have "0%" traffic assigned?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a1exsh do you want to collect some other users upvoting your idea? It would definitely break compatibility, but maybe that's what most Senza users want, so I would be fine with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjacobs @jmcs Well, I was reluctant to suggest this in the first place, but maybe the better response is to make sure senza delete doesn't mess up the traffic weights?

Then you can keep semantics of senza create as they are currently and no incompatible change is needed.

Of course one may intentionally set the traffic of the only stack version to 0 and then deploy a second stack, but there is no much sense trying to prevent that. This will then work as documented by AWS: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-values-weighted.html#rrsets-values-weighted-weight

If you set Weight to 0 for all of the records in the group, traffic is routed to all resources with equal probability. This ensures that you don't accidentally disable routing for a group of weighted records.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the "safe by default" approach way better as well. Having an optional flag will require quite some knowledge.

From my experience so far, use cases where the current behavior is desired of the new behavior are rather few actually. Therefore I would be really in favor of a solution which optimises for the 80% even though it would break compatibility. Especially as the broken functionality should be quite obvious (compared to the "broken" behaviour)

senza/traffic.py Outdated
@@ -26,14 +26,10 @@
DNS_ZONE_CACHE = {}


def get_weights(dns_names: list, identifier: str, all_identifiers) -> ({str: int}, int, int):
def get_weights_for_dns(dns_names):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type hint for dns_names ?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 89.664% when pulling 7c01fed on fix-traffic into 3be07b3 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 89.664% when pulling 7c01fed on fix-traffic into 3be07b3 on master.

@erthalion
Copy link

👍

@jmcs jmcs closed this Apr 26, 2019
@a1exsh
Copy link
Contributor

a1exsh commented Apr 29, 2019

@jmcs is this a "won't fix" now? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stacks may end up with weight of 0 in Route 53
6 participants