Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic header matching in HTTPRoute #2198

Open
frankbu opened this issue Jul 18, 2023 · 11 comments · May be fixed by #2213
Open

Dynamic header matching in HTTPRoute #2198

frankbu opened this issue Jul 18, 2023 · 11 comments · May be fixed by #2213
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@frankbu
Copy link
Contributor

frankbu commented Jul 18, 2023

What would you like to be added:
A standard API for routing based on matching metadata derived from dynamically evaluated request headers.

Why this is needed:
Users want to be able to route HTTP requests based on a validated JWT associated with the request.
Istio, for example, supports this by using header names with a special prefix (@) in a httproute header match configuration, to indicate that the matching is not against a static header value, but rather the metadata associated with the validated JWT: https://istio.io/latest/docs/tasks/security/authentication/jwt-route/#configuring-ingress-routing-based-on-jwt-claims

Although Istio could support this in Gateway API routes with some implementation specific (e.g., prefix) solution, it would be better to define an optional standard API for this kind of routing in Gateway API.

Maybe simply allowing some prefix (e.g., @) in a header name to allow for implementation-specific dynamic header matching would be minimally sufficient? Beyond that, defining some standard dynamic header names (like the one to use to match JWT metadata, for example) would also be nice to have in the Gateway spec.

@frankbu frankbu added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 18, 2023
@brianehlert
Copy link
Contributor

This came up in a conversation between myself, @kflynn and @robscott a few weeks back and I have been slow at starting the write-up.
Looking across existing implementations (not all Gateway API of course) there are respectable differences that need to be surfaced.
Not to mention there are the two use cases of validation and claims checking.
Let me see how quickly I can get my current (and not polished) write-up checked in for review and to start the broader process.

@howardjohn
Copy link
Contributor

Another use case which is similar is just things like set: x-client-country: %CLIENT_COUNTRY% or something. I think most proxies support this in some way or another.

Standardization seems near impossible - but nice as an extension?

@pleshakov
Copy link
Contributor

pleshakov commented Jul 18, 2023

I wonder if combined with here #2166 , a generalized case here is implementation specific routing - data plane provides some parameters which can be used to make a routing decision.

Perhaps something like this could work:

Client IP based routing:

  - matches:
      proxyKeys:
      - name: $client_ip # proxy specific
        type: CIDR # proxy specific
        value: 192.168.0.0
    backendRefs:
    - name: backend-local
      port: 80

JWT claim based routing:

  - matches:
      proxyKeys:
      - name: $jwt_claim_group # proxy specific
        type: Exact # proxy specific
        value: group-1
    backendRefs:
    - name: backend-group1
      port: 80

Cookie based routing:

  - matches:
      proxyKeys:
      - name: $cookie_version # proxy specific
        type: Exact # proxy specific
        value: v2
    backendRefs:
    - name: backend-v2
      port: 80

@brianehlert
Copy link
Contributor

Okay.
Time to check my doc in, though I am not really 'ready' - but the conversation is.
Where is the place to get the GEP checked in?

@brianehlert
Copy link
Contributor

I think it comes down to: Policy with extensions, or Policy and Extensions.
There is a reusable part here that leads to Polic-y/ies

@frankbu
Copy link
Contributor Author

frankbu commented Jul 19, 2023

Where is the place to get the GEP checked in?

@brianehlert If you'd like to use this issue to start the GEP, then I think you just create a PR with a file named geps/gep-2198.md to start the discussion.

@brianehlert brianehlert linked a pull request Jul 21, 2023 that will close this issue
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 24, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 23, 2024
@frankbu
Copy link
Contributor Author

frankbu commented Feb 23, 2024

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 23, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 23, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants