Skip to content

Commit

Permalink
Fix matching a Mapping with host_redirect a Host
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Féron <[email protected]>

fix redirect mappings thanks to @gferon

Signed-off-by: AliceProxy <[email protected]>

update gold-test snapshot

Signed-off-by: AliceProxy <[email protected]>

update changelog

Signed-off-by: AliceProxy <[email protected]>
  • Loading branch information
Gabriel Féron authored and AliceProxy committed Jan 21, 2022
1 parent d61ff0b commit 70d76e0
Show file tree
Hide file tree
Showing 5 changed files with 877 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ Please see the [Envoy documentation](https://www.envoyproxy.io/docs/envoy/latest
- Change: Docker BuildKit is enabled for all Emissary builds. Additionally, the Go build cache is
fully enabled when building images, speeding up repeated builds.

- Bugfix: Any `Mapping` that uses the `host_redirect` field is now properly discovered and used.
Thanks to <a href="https://github.com/gferon">Gabriel Féron</a> for contributing this bugfix! ([3709])

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

## 2.1.1 not issued

*Emissary-ingress 2.1.1 was not issued; Ambassador Edge Stack 2.1.1 uses Emissary-ingress 2.1.0.*
Expand Down
10 changes: 10 additions & 0 deletions docs/releaseNotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ items:
build cache is fully enabled when building images, speeding up repeated builds.
docs: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md

- title: Correctly use Mappings with host redirects
type: bugfix
body: >-
Any <code>Mapping</code> that uses the <code>host_redirect</code> field is now properly discovered and used. Thanks
to <a href="https://github.com/gferon">Gabriel Féron</a> for contributing this bugfix!
github:
- title: 3709
link: https://github.com/emissary-ingress/emissary/issues/3709
docs: https://github.com/emissary-ingress/emissary/issues/3709

- version: 2.1.1
date: 'N/A'
notes:
Expand Down
7 changes: 6 additions & 1 deletion python/ambassador/ir/irhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,12 @@ def matches_httpgroup(self, group: 'IRHTTPMappingGroup') -> bool:
else:
# It is NOT A TYPO that we use group.get("host") here -- whether the Mapping supplies
# "hostname" or "host", the Mapping code normalizes to "host" internally.
group_glob = group.get('host') or None # NOT A TYPO: see above.

# It's possible for group.host_redirect to be None instead of missing, and it's also
# conceivably possible for group.host_redirect.host to be "", which we'd rather be
# None. Hence we do this two-line dance to massage the various cases.
host_redirecct = (group.get('host_redirect') or {}).get('host')
group_glob = group.get('host') or host_redirecct # NOT A TYPO: see above.

if group_glob:
host_match = hostglob_matches(self.hostname, group_glob)
Expand Down
Loading

0 comments on commit 70d76e0

Please sign in to comment.