-
Notifications
You must be signed in to change notification settings - Fork 687
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
Emissary creating duplicate mapping routes in ir.json and econf.json #5702
Comments
Hello, In other words, is it intended to fix something more generic than |
@juanjoku Thanks for your response. I have tried with precedence configuration also. |
1 similar comment
Hello @sekar-saravanan. Yes I have looked at PR, but I'm not the appropriate person to evaluate it properly (I've been using Emissary for years, but until now I didn't need to look at the source code :-( ) Thx |
OK, I was able to talk over this with @sekar-saravanan (thanks! 🙂) and wow, I'm kind of amazed that this duplicate-route didn't show up before this year. 😐 Nice catch figuring out what's happening, @sekar-saravanan! What's happening is that the weight-normalization code has been assuming that the different Mappings it's working with are different Mappings. If we have multiple Mappings that are identical except for their (If a Mapping in the duplicated set has a missing
then that'll become
which would then be forced to 100%, which is fine. But if your Group has
then I think it makes more sense to end up with
than anything else. Opinions welcome.) @sekar-saravanan, I'd be delighted if you could tweak your PR for this! thanks for jumping in to help. 🙂 |
@kflynn It looks, modifying inside IRBaseMappingGroup.normalize_weights_in_mappings method will be bit critical, because this method will be called finally after processing all the mappings with respected groups. https://github.com/emissary-ingress/emissary/blob/master/python/ambassador/ir/ir.py#L464 It can be more better, if we could avoid generating groups with duplicate mappings while processing itself, because we will have more flexibility to avoid the creation of duplicate mapping while processing. https://github.com/emissary-ingress/emissary/blob/master/python/ambassador/ir/ir.py#L459 Let's take same example, Each mapping can point to different route (cluster) for canary release purpose.
In this case, I need to maintain all the mappings with respected weights for canary purpose. PR: 5705 - Here, we can make sure that, it will only add the mapping into the group only if already does not exists. (we are checking the mapping with rkey, and I hope it will be always unique <mapping_name>.) Looking forward to your opinions / suggestions. |
I was initially thinking that you might not have the information you need while the groups are being built, but the more I think about it, the more you likely will, so go for it! I also suspect that the |
Hey @kflynn - I understand what you are trying to achieve. Fix 1: If more than 1 mappings has same target (cluster_key) in a group (same host, path, etc.. - link), needs to remove the duplicates with the least weights. For example, if your Group has
then that'll become
There is no impact on envoy behaviour having these duplicate mappings. This behaviour will occurred, when we are creating more than 1 mapping resource with same host, path, target intentionally / unintentionally. Actually, this is not a bug. If we are maintaining correct mapping resources, this will never happen. Fix 2: But, this fix is used for avoid creating duplicate mappings based on same mapping resource. If we are creating 2 mappings with same host, path, different target and different weight, it creates duplicate mappings multiple time of same mapping resource. Steps to reproduce.
Even if we are maintaining correct mapping resource, this behaviour will occur. This is a bug. Looking forward to your opinions / suggestions. |
@sekar-saravanan That's a really superb rundown of this issue, nice catch! Branch make python-virtual-environment
source venv/bin/activate
rm -rf /tmp/mock
go test -count=1 -v -run '^TestUnrelatedMappings$' ./cmd/entrypoint and after the test runs, you'll find all the configuration files produced during the test in @AliceProxy, @tenshinhigashi, @the-wondersmith, there's a |
@kflynn I have executed the test case as you described and test has been passed after adding the fix mentioned in the PR. |
Describe the bug
Emissary creating duplicate mapping routes in ir.json and econf.json while adding weight for canary release
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Emissary should not create duplicate routes in ir.json and econf.json for canary release
Versions (please complete the following information):
Additional context
Have attached the deployment.yaml, service.yaml, mappings.yaml, host.yaml and ir.json and econf.json with duplicate routes.
Duplicate routes presents under,
ir.json: -> groups -> mappings
econf.json: -> listeners -> filter_chains -> filters -> route_config -> virtual_hosts -> routes
docs.zip
What is the Impact ?
No impacts on traffic.
Other Imapcts:
The text was updated successfully, but these errors were encountered: