fix: 修复集群切换为共享集群时缓存未刷新导致的操作报错#3839
Open
yuyudeqiu wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题背景
在
project-manager中,由于底层对集群信息存在本地缓存,当集群属性发生变更(例如临时切换为共享集群,或被重新分配到当前项目)时,由于缓存未及时刷新,会导致进行命名空间操作等鉴权时被直接拦截,报错project or cluster not valid。解决方案
在
NamespaceFactory.Action校验失败时增加兜底逻辑:若发现缓存中的集群既不归属当前项目,也不是共享集群,则利用
GetCluster接口绕过本地缓存(isCache=false)强拉一次服务端最新数据进行二次校验,避免因为缓存延迟导致误判。