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

Supports routing of query param #1838

Closed
lianglli opened this issue Aug 4, 2023 · 1 comment · Fixed by #1864
Closed

Supports routing of query param #1838

lianglli opened this issue Aug 4, 2023 · 1 comment · Fixed by #1864
Assignees

Comments

@lianglli
Copy link
Member

lianglli commented Aug 4, 2023

支持请求Query参数的高级路由,可以指定具体匹配的query参数值,在query参数和query参数值完全匹配的情况下,请求将被转发到指定的upstream。

Query参数值允许最多设置20个,只要其中1个相匹配,请求就会被转发到指定的upstream。

无损动态生效,无需tengine reload。

@lianglli lianglli added this to the 3.0.1 milestone Aug 4, 2023
@lianglli lianglli self-assigned this Aug 4, 2023
@lianglli lianglli changed the title Supports canary routing of query param Supports routing of query param Aug 4, 2023
@lianglli lianglli removed this from the 3.0.1 milestone Sep 18, 2023
@lianglli
Copy link
Member Author

lianglli commented Nov 1, 2023

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-by-query: open3
    nginx.ingress.kubernetes.io/canary-by-query-value: abc1||abc2||abc3||abc4||abc5||abc6||abc7||abc8||abc9||abc10||abc11||abc12||abc13||abc14||abc15||abc16||abc17||abc18||abc19||abc20||abc21
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  creationTimestamp: "2023-10-31T06:30:31Z"
  generation: 2
  name: tengine-ingress-hello-query-ing
  namespace: default
  resourceVersion: "28152616"
  uid: debebfd0-afd2-4604-af8d-a41ad400bfbc
spec:
  ingressClassName: opensource-ingress
  rules:
  - host: echo.w1.com
    http:
      paths:
      - backend:
          service:
            name: tengine-ingress-hello3-service
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - echo.w1.com
    secretName: https-server-1
status:
  loadBalancer:
    ingress:
    - {}

默认configmap 配置,"max-canary-query-val-num"允许路由匹配的query参数值个数是20,用户可以通过cm配置按需调整。

	// Max number of query value for canary annotation 'canary-by-query-value'
	MaxCanaryQueryValNum int `json:"max-canary-query-val-num"`

MaxCanaryQueryValNum:         20,

............................................................

$ curl -i -k https://echo.w1.com/?open3=abc20
HTTP/2 301 
server: Tengine/3.1.0
date: Wed, 01 Nov 2023 08:56:10 GMT
location: /?open3=abc20/
strict-transport-security: max-age=0
ups-target-key: default-tengine-ingress-hello3-service-80
x-protocol: HTTP/2.0
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

@lianglli lianglli closed this as completed Nov 1, 2023
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.

1 participant