[RFC]feat: enhance transformer plugin by adding a set-based requirement check#3495
Open
rayne-Li wants to merge 4 commits intoalibaba:mainfrom
Open
[RFC]feat: enhance transformer plugin by adding a set-based requirement check#3495rayne-Li wants to merge 4 commits intoalibaba:mainfrom
rayne-Li wants to merge 4 commits intoalibaba:mainfrom
Conversation
Signed-off-by: rayneLi <rayne.lyvn@gmail.com>
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.
Ⅰ. Describe what this PR did
transformer插件目前有丰富的转换逻辑, 转换相关的功能符合我的使用场景, 但是目前我希望在add header:A时, 可以判断header中其他的key:B是否存在再进行添加(而非key:A本身)
因此我实现了一个基于sets的类似k8s labelSelector风格的校验机制, 它实现了例如: 当model不存在在headers中时才添加routing-strategy这个header
目前代码逻辑仅对kvHandler的add功能生效, 理论上任何一个operator都可以加上类似的条件判断机制, 如果社区认为这种方式是一个合理的必要的拓展, 我乐意继续完善add之外的功能
Ⅰ. Describe what this PR did
The transformer plug-in currently has rich conversion logic, and the conversion-related functions are in line with my usage scenarios, but currently I hope that when adding header:A, I can determine whether other key:B in the header exists before adding it (instead of key:A itself)
Therefore, I implemented a verification mechanism based on sets similar to k8s labelSelector style. It implements, for example: only add the routing-strategy header when the model does not exist in the headers.
At present, the code logic only takes effect for the add function of kvHandler. In theory, any operator can add a similar conditional judgment mechanism. If the community believes that this method is a reasonable and necessary expansion, I will be happy to continue to improve functions other than add.