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

Implement annotation to support matching routes by HTTP method, headers, and url paramaters #161

Closed
Tracked by #56
johnlanni opened this issue Feb 6, 2023 · 1 comment · Fixed by #188
Closed
Tracked by #56

Comments

@johnlanni
Copy link
Collaborator

How could it be?

Examples:

1. Match by method

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    # support matching multiple or single method 
    higress.io/match-method: "GET POST PATCH"
  name: foo
spec:
  ingressClassName: higress  
  rules:
  - http:
      paths:
      - pathType: Exact
        path: "/"
...

2. Match by headers

format:

higress.io/<exact|regex|prefix>-match-header-<header key>: "<part or all of the header value>"
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    # exact matching
    higress.io/exact-match-header-abc: "123"
    # regex matching
    higress.io/regex-match-header-content-type: "application/(json|xml)"
    # prefix matching
    higress.io/prefix-match-header-user-id: "10086-1"
  name: foo
spec:
  ingressClassName: higress  
  rules:
  - http:
      paths:
      - pathType: Exact
        path: "/"
...

2. Match by url parameters

format:

higress.io/<exact|regex|prefix>-match-query-<param key>: "<part or all of the param value>"
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    # exact matching
    higress.io/exact-match-query-abc: "123"
    # regex matching
    higress.io/regex-match-query-name: "B.*"
    # prefix matching
    higress.io/prefix-match-query-age: "2"
  name: foo
spec:
  ingressClassName: higress  
  rules:
  - http:
      paths:
      - pathType: Exact
        path: "/"
...

Other related information

1. Annotation example
2. Istio api conversion
3. Istio VitrualService's MatchRequest api

@Charlie17Li
Copy link
Collaborator

pls assign to me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants