Skip to content

Commit 015dc24

Browse files
issue-5702 - Duplicate mapping route | ENVOY CONFIG MISMATCH issue fixed
Signed-off-by: Sekar Saravanan <[email protected]>
1 parent 2947049 commit 015dc24

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ it will be removed; but as it won't be user-visible this isn't considered a brea
103103
- Change: Upgraded Emissary-ingress to the latest release of Golang as part of our general
104104
dependency upgrade process.
105105

106+
- Bugfix: Emissary creating duplicate mapping in ir.json and econf.json while adding weight for canary
107+
release. This leads to getting IR MISMATCH & ENVOY CONFIG MISMATCH error frequently in the logs and
108+
also consumes more cpu. We have introduced a condition that, it will add the mapping only if the mapping
109+
is not already present in the group.
110+
111+
[#5702]: https://github.com/emissary-ingress/emissary/issues/5702
112+
106113
## [3.9.0] November 13, 2023
107114
[3.9.0]: https://github.com/emissary-ingress/emissary/compare/v3.8.0...v3.9.0
108115

python/ambassador/ir/ir.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,10 @@ def add_mapping(self, aconf: Config, mapping: IRBaseMapping) -> Optional[IRBaseM
10081008
else:
10091009
self.logger.debug(f"IR: already have group for {mapping.name}")
10101010
group = self.groups[mapping.group_id]
1011-
group.add_mapping(aconf, mapping)
1011+
existing_mapping_cache_keys = [ group_mapping["_cache_key"] for group_mapping in group["mappings"] ]
1012+
if mapping["_cache_key"] not in existing_mapping_cache_keys:
1013+
self.logger.debug(f"IR: mapping {mapping.name} is not exists. adding it into the group.")
1014+
group.add_mapping(aconf, mapping)
10121015

10131016
self.cache_add(mapping)
10141017
self.cache_add(group)

python/ambassador_diag/diagd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def check_cache(self) -> bool:
550550
result = False
551551
self.logger.error("CACHE: ENVOY CONFIG MISMATCH")
552552
errors += "econf diffs:\n"
553-
errors += self.json_diff("econf", i1, i2)
553+
errors += self.json_diff("econf", e1, e2)
554554

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

0 commit comments

Comments
 (0)