Skip to content

优化redis client,支持在识别到 NOAUTH 响应的时候,重新初始化 #2000

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

Open
Lewisyixin opened this issue Apr 1, 2025 · 5 comments · May be fixed by #2032
Open

优化redis client,支持在识别到 NOAUTH 响应的时候,重新初始化 #2000

Lewisyixin opened this issue Apr 1, 2025 · 5 comments · May be fixed by #2032

Comments

@Lewisyixin
Copy link

Lewisyixin commented Apr 1, 2025

  • bug概述

修改McpBridge后会导致token限流插件的redis认证为空

  • 复现步骤
  1. 配置了外部服务类型的redis服务
k -nhigress-system get mcpbridges.networking.higress.io -oyaml
apiVersion: networking.higress.io/v1
kind: McpBridge
metadata:
  creationTimestamp: "2025-03-31T15:58:21Z"
  generation: 29
  name: default
  namespace: higress-system
  resourceVersion: "243407"
  uid: a3071821-737e-4214-97e6-6211580e928b
spec:
  registries:
  - domain: 10.56.23.202:6379
    name: redis-out
    port: 6379
    protocol: http
    type: static
  1. 配置好ai-token-ratelimit插件(此过程略,按照官网文档配置就行)
    此时限流插件是能正常运行的,并且每次发送请求,能看到higress->redis的数据包是有auth命令的
    Image
  2. 修改步骤1中(即McpBridge配置)的port配置,例如从6379改到80,再改回6379(有此类操作的原因是因为默认从dashboard上配置,只支持http协议,redis配置出来之后是80端口,所以需要手动修改一下,才发现的问题)
    此时再去发送客户端请求,会发现higress->redis包命令已经不带auth参数了,并且网关也会报相关错误

Image

Image
4. 但是将ai-token-ratelimit插件关闭再打开后恢复正常

想确认下这个算不算bug

Ⅵ. Environment:

  • Higress version: higress-2.0.7
  • OS : centos7的k8s集群中,k8s 版本 v1.29.15
  • Others:
@johnlanni
Copy link
Collaborator

你修改了端口后,有修改插件配置吗?如果不修改插件配置,连的还是老的服务地址。按道理应该都不会连通,因为端口变了

@Lewisyixin
Copy link
Author

你修改了端口后,有修改插件配置吗?如果不修改插件配置,连的还是老的服务地址。按道理应该都不会连通,因为端口变了

我是在不动插件配置的情况下, 将McpBridge 端口从 6379改成80再改回6379就会导致连接redis报错,我感觉这样报错不太合理,相当于只要McpBridge有变化,都需要重新开关一下所有redis相关的插件。
另外我还试了下,McpBridge下的那几个字段domain、name、port、protocol,只要任意一个被改过,即使再改回原来的值,还是会导致redis报错

@johnlanni
Copy link
Collaborator

嗯,现在只在cluster连接初始化的时候做AUTH,这个确实可以优化下sdk,在判断出Auth失败的时候,重新做一下Auth

@johnlanni johnlanni added the help wanted Extra attention is needed label Apr 8, 2025
@github-project-automation github-project-automation bot moved this to Todo in Higress Apr 8, 2025
@johnlanni johnlanni changed the title token限流插件 修改McpBridge后会导致redis认证为空 优化redis client,支持在识别到 NOAUTH 响应的时候,重新初始化 Apr 8, 2025
@johnlanni
Copy link
Collaborator

https://github.com/alibaba/higress/blob/main/plugins/wasm-go/pkg/wrapper/redis_wrapper.go

代码在这里,重新初始化只需要调用proxywasm.RedisInit即可,欢迎有兴趣的同学认领此任务

@Fengxq2014
Copy link
Contributor

https://github.com/alibaba/higress/blob/main/plugins/wasm-go/pkg/wrapper/redis_wrapper.go

代码在这里,重新初始化只需要调用proxywasm.RedisInit即可,欢迎有兴趣的同学认领此任务

可以指派给我

@CH3CHO CH3CHO added sig/wasm and removed help wanted Extra attention is needed labels Apr 8, 2025
@Fengxq2014 Fengxq2014 linked a pull request Apr 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants