Skip to content

Add support for "in" multiple values header match in virtualservice #3731

Description

@ashupednekar

Describe the feature request

Right now, the virtualService spec supports header based routing which is one of the fundamental features core to istio. A typical scenario would be to say, allow an ingress request if a particular header is in a list of allowed values.

One way to do this today is to have multiple header entries in the match list

match:
- headers:
    x-env:
      exact: prod
- headers:
    x-env:
      exact: stage
- headers:
    x-env:
      exact: dev

This could work for cases like env filtering, but if it's something like user, team or company filtering the list can get quite huge... increasing the CR size and degraded devX

or have a regex match with a list... This has clear limitations of performance, faulty regexes and the 1024 character limit preventing bigger lists

This issue proposes having a "in" semantic here which would simplify the CR, improve devX and potentially help with perf

headers:
  x-tenant:
    in:
    - foo
    - bar
    - baz

Describe alternatives you've considered
On the user end, there are two ways folks currently work around this, apart from the obvious regex hack...

  • yaml anchors reusing blocks, not ideal since these only work on repeated maps
  • having custom helm templates over the vs spec to iterate that way, solves dx with downstream maintainability setback

Affected product area (please put an X in all that apply)

[ ] Configuration Infrastructure
[x] Docs
[ ] Installation
[x] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[x] User Experience

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions