dotnet / dotnet/yarp

Http Method Match in K8S Controller

Open
#1,828 4 comments 0 reactions 0 assignees View on GitHub
Kubernetes Ingress Controller
Dominant language
C#
Stars
9.6k
Forks
933
Avg merge
12d 18h
Merged PRs (30d)
2

Description

### Discussed in https://github.com/microsoft/reverse-proxy/discussions/1825

Originally posted by **pinkfloydx33** August 13, 2022
I have a proxied endpoint that requires authorization based on the Http Method. For `POST`, the endpoint accepts anonymous requests; for everything else it requires authorization. It's something akin to a user endpoint where `POST` represents signing up to an application.

I can easily codify this in configuration-based routes using the `route.Match.Methods` property, plus _either_ a higher priority `Order` for the `POST` endpoint _or_ spelling out the remaining HTTP methods on the other. However, this doesn't seem possible to do when using the Ingress controller as it does not have an http-methods annotation.

If such an annotation _were_ supported, this would require creating two `Ingress` resources with the same path and host. So far as I am aware, this is technically a valid thing to do per K8S. The Ingress Controller should be able to support such a case since it uses the `Ingress` name to construct the route's, so there'd be no conflict.

Is this something that could in theory be supported, or was it explicitly not considered? Or am I overlooking something that would prevent it?

Contributor guide

Open the contributing guide

Research direction

Start with the linked discussion 1825, then inspect the Kubernetes Ingress controller's annotation handling and route construction. Done should mean the controller can express HTTP-method matching for Ingress resources, including multiple resources sharing a host and path without route conflicts.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes
Domain
infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.