emissary icon indicating copy to clipboard operation
emissary copied to clipboard

Mappingselector not respected

Open wiegandf opened this issue 2 years ago • 0 comments

Describe the bug The documentation (https://www.getambassador.io/docs/emissary/latest/topics/running/host-crd/) states the following

If the Host specifies mappingSelector and the Mapping specifies hostname, both must match for the association to happen.

This doesn't seem to be true. We have a host that specifies a mappingselector and a mapping that specifies hostname and its labels don't match the host's mappingselector. Still there is an association.

To Reproduce

--- Host
kubectl get host.v3alpha1.getambassador.io emissary -o yaml
apiVersion: getambassador.io/v3alpha1
kind: Host
metadata:
  labels:
    app.kubernetes.io/managed-by: Helm
    emissary: cas
 ...
spec:
  ambassador_id:
  - cas
  hostname: <hostname>
  mappingSelector:
    matchLabels:
      emissary: cas
  ...
  tlsSecret:
    name: emissary-certs

--- Mapping
kubectl get mapping.v3alpha1.getambassador.io mapping -o yaml
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
  labels:
    app.kubernetes.io/managed-by: Helm
    emissary: main
  ...
spec:
  ambassador_id:
  - cas
  bypass_auth: true
  hostname: <hostname>
  method: ^(GET|OPTIONS)$
  method_regex: true
  prefix: /our-prefix/
  tls: istio-upstream
  ...

The mapping still works, even though the mappingSelector doesn't match.

Expected behavior No mapping association.

Versions (please complete the following information):

  • Emissary: 3.1.0
  • K8s: 1.23.9

wiegandf avatar Sep 23 '22 07:09 wiegandf