Description
Describe the bug
When using the query_parameters
option in a mapping it is possible to set param: true
to say that the mapping will match if the parameter is present in the URL.
Example:
---
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: quote-mode
spec:
prefix: /backend/
service: quote-mode
query_parameters:
quote-mode: true
In this example, calls to /backend/
that include the query_parameter quote-mode
with any value will match.
Documentation: https://emissary-ingress.dev/docs/3.9/topics/using/query-parameters/#a-conditional-example
Since v3alpha1
of the CRDs have been released this mapping is no longer possible due to this line. The query parameters are now expecting map[string]string
so that a boolean is not allowed.
When attempting to use this the following error is received:
Mapping.getambassador.io "my-mapping" is invalid: spec.query_parameters.quote-mode: Invalid value: "boolean": spec.query_parameters.quote-mode in body must be of type string: "boolean"
To Reproduce
- Create a mapping like above
- Attempt to
kubectl apply
it to any kubernetes cluster that has Emissary CRDs installed
Expected behavior
I would want one of two options:
- We remove this functionality from
query_parameters
and always requirestring
. We can achieve similar functionality by usingregex_query_parameters
and a regex of.*
. This would match all values of query parameter, which is the intention of this functionality - We figure out a way to allow for string or boolean in the CRD so that a boolean of
true
can be passed
Versions (please complete the following information):
- Emissary: v3.8
- Kubernetes environment: GKE 1.31
Additional context
This is technically a regression with the introduction of v3alpha1
. The v2
mappings would not have this problem and the code would pick it up as expected.