Skip to content

Mapping 'query_parameters' presence conditional not allowed #5843

Open
@ppeble

Description

@ppeble

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

  1. Create a mapping like above
  2. Attempt to kubectl apply it to any kubernetes cluster that has Emissary CRDs installed

Expected behavior

I would want one of two options:

  1. We remove this functionality from query_parameters and always require string. We can achieve similar functionality by using regex_query_parameters and a regex of .*. This would match all values of query parameter, which is the intention of this functionality
  2. 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.

Metadata

Metadata

Assignees

Labels

t:bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions