Skip to content

Commit

Permalink
Merge pull request #5722 from sekar-saravanan/flynn/v4-5715
Browse files Browse the repository at this point in the history
issue-5702 - Multiple duplicate mappings generated for single mapping resource fixed
  • Loading branch information
kflynn authored Jul 19, 2024
2 parents 0d82d0e + f270233 commit 1d98849
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion python/ambassador/ir/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,13 @@ 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)

# Add mapping into the group only if the _cache_key doesn't exist in a group.
existing_mapping_cache_keys = [ group_mapping["_cache_key"] for group_mapping in group["mappings"] if "_cache_key" in group_mapping ]
if mapping["_cache_key"] in existing_mapping_cache_keys:
self.logger.debug(f"IR: _cache_key for {mapping.name} is {mapping['_cache_key']} already exists in a group.")
else:
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 @@ -551,7 +551,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 1d98849

Please sign in to comment.