Skip to content

Commit

Permalink
issue-5702 - Duplicate mapping route | ENVOY CONFIG MISMATCH issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sekar-saravanan committed Jul 2, 2024
1 parent 2947049 commit aefabda
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ it will be removed; but as it won't be user-visible this isn't considered a brea
- Change: Upgraded Emissary-ingress to the latest release of Golang as part of our general
dependency upgrade process.

- Bugfix: Emissary creating duplicate mapping in ir.json and econf.json while adding weight for canary
release. This leads to getting IR MISMATCH & ENVOY CONFIG MISMATCH error frequently in the logs and
also consumes more cpu. We have introduced a condition that, it will add the mapping only if the mapping
is not already present in the group.

[#5702]: https://github.com/emissary-ingress/emissary/issues/5702

## [3.9.0] November 13, 2023
[3.9.0]: https://github.com/emissary-ingress/emissary/compare/v3.8.0...v3.9.0

Expand Down
11 changes: 10 additions & 1 deletion python/ambassador/ir/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,16 @@ def add_mapping(self, aconf: Config, mapping: IRBaseMapping) -> Optional[IRBaseM
else:
self.logger.debug(f"IR: already have group for {mapping.name}")
group = self.groups[mapping.group_id]
group.add_mapping(aconf, mapping)
is_mapping_present = False
try:
existing_mapping_keys = [ group_mapping["rkey"] for group_mapping in group["mappings"] ]
is_mapping_present = True if mapping["rkey"] in existing_mapping_keys else False
except Exception as e:
self.logger.error(f"IR: Exception occurred {e} when checking {mapping.name} already presents in {mapping.group_id}")

if not is_mapping_present:
self.logger.debug(f"IR: mapping {mapping.name} is not exists. adding it into the group.")
group.add_mapping(aconf, mapping)

self.cache_add(mapping)
self.cache_add(group)
Expand Down
2 changes: 1 addition & 1 deletion python/ambassador_diag/diagd.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def check_cache(self) -> bool:
result = False
self.logger.error("CACHE: ENVOY CONFIG MISMATCH")
errors += "econf diffs:\n"
errors += self.json_diff("econf", i1, i2)
errors += self.json_diff("econf", e1, e2)

if not result:
err_path = os.path.join(self.snapshot_path, "diff-tmp.txt")
Expand Down

0 comments on commit aefabda

Please sign in to comment.