-
Notifications
You must be signed in to change notification settings - Fork 690
Description
The following configuration attempts to use labels to associate the quote-backend-foo
Mapping
only with foo.example.com
, and quote-backend-bar
only with bar.example.com
:
---
apiVersion: getambassador.io/v3alpha1
kind: Host
metadata:
name: foo-host
spec:
hostname: foo.example.com
mappingSelector:
matchLabels:
host: foo
...
---
apiVersion: getambassador.io/v3alpha1
kind: Host
metadata:
name: bar-host
spec:
hostname: bar.example.com
mappingSelector:
matchLabels:
host: bar
...
---
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: quote-backend-foo
labels:
host: foo
spec:
prefix: /test/
service: quote
---
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: quote-backend-bar
labels:
host: bar
spec:
prefix: /test/
service: quote
Since the two Mapping
s have different host
labels, they will associate with different Host
s
and should not be placed in the same canary group. However, as of Emissary 2.2.2, the canary-group
logic doesn't pay attention to labels, so the two Mapping
s will (wrongly) be placed in the same
canary group. Since Envoy-config generation operates on groups rather than on individual Mapping
s,
the effect here is that https://foo.example.com/test/
will be correctly routed, but
https://bar.example.com/test/
will 404.
As an additional constraint, consider the same Host
s above, but these two Mapping
s:
---
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: quote-labels-1
labels:
host: foo
irrelevant-label: "1"
spec:
prefix: /labels/
service: quote-1
---
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: quote-labels-2
labels:
host: foo
irrelevant-label: "2"
spec:
prefix: /labels/
service: quote-2
These Mapping
s should be placed in the same canary group, since the Host
s don't differentiate
based on the irrelevant-label
label. So we mustn't look at every label -- only the ones that
the Host
s actually care about matter.
To work around this, you can either:
- Give the two
Mapping
s aprecedence
with different values so that they can't be canaried together, or - Use the
hostname
rather than labels.