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

issue-5702 - Multiple duplicate mappings generated for single mapping resource fixed #5722

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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