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

目前higress界面上还不支持Annotation实现高阶流量治理的配置。后续是否有计划这块的研发呢 #927

Open
gzwxh opened this issue Apr 26, 2024 · 7 comments
Assignees

Comments

@gzwxh
Copy link

gzwxh commented Apr 26, 2024

目前higress界面上还不支持Annotation实现高阶流量治理的配置。后续是否有计划这块的研发呢

@CH3CHO
Copy link
Collaborator

CH3CHO commented Apr 26, 2024

试试这里呢?

image

@CH3CHO CH3CHO self-assigned this Apr 26, 2024
@gzwxh
Copy link
Author

gzwxh commented Apr 26, 2024

https://higress.io/zh-cn/docs/user/annotation-use-case/#rewrite%E9%87%8D%E5%86%99path
Rewrite重写Path 下的 将请求example.com/v1/app在转发至后端服务之前,去掉Path前缀/v1
这种功能无法实现
目前是通过这个脚本实现

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
higress.io/destination: vman-new.xxx-wsc.svc.cluster.local:29121
higress.io/rewrite-target: "/$1"
name: xxx.xxx.com
namespace: higress-system
labels:
higress.io/resource-definer: higress
spec:
ingressClassName: higress
rules:
- host: xxx.xxx.com
http:
paths:
- backend:
resource:
apiGroup: networking.higress.io
kind: McpBridge
name: default
path: /shopping/renovation/man-api/(.*)
pathType: ImplementationSpecific

前端页面不支持这个类型ImplementationSpecific

@CH3CHO
Copy link
Collaborator

CH3CHO commented Apr 26, 2024

你是说这个 annotation 吗,higress.io/rewrite-target: "/$1"

@gzwxh
Copy link
Author

gzwxh commented Apr 26, 2024

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    higress.io/destination: vman-new.xxx-wsc.svc.cluster.local:29121
    higress.io/rewrite-target: "/$1"
  name: xxxxx
  namespace: higress-system
  labels:
    higress.io/resource-definer: higress
spec:
  ingressClassName: higress
  rules:
    - host: xxxxxx
      http:
        paths:
          - backend:
              resource:
                apiGroup: networking.higress.io
                kind: McpBridge
                name: default
            path: /shopping/renovation/man-api/(.*)
            pathType: ImplementationSpecific

那如何实现这种功能呢

@CH3CHO
Copy link
Collaborator

CH3CHO commented Apr 26, 2024

你这个path应该是走正则匹配吧,然后走正则的rewrite。正则rewrite确实console还不支持

@gzwxh
Copy link
Author

gzwxh commented Apr 26, 2024

图片
图片
通过页面上配置正则,但是类型还是 pathType: Prefix

@johnlanni
Copy link
Collaborator

ingress没有定义正则的路径类型,所以这里用了prefix,并通过注解来识别是正则

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

No branches or pull requests

3 participants