-
Notifications
You must be signed in to change notification settings - Fork 83
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
Add chainCNI support for spidermultusconfig #3918
Add chainCNI support for spidermultusconfig #3918
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3918 +/- ##
==========================================
- Coverage 80.88% 80.83% -0.05%
==========================================
Files 51 51
Lines 4514 4514
==========================================
- Hits 3651 3649 -2
- Misses 698 699 +1
- Partials 165 166 +1
Flags with carried forward coverage won't be shown. Click here to find out more. |
5d6c872
to
57bc92f
Compare
"sysctl": { | ||
"net.core.somaxconn": "4096" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 字典格式,不符合我们讨论的预期
我们设计的是 数组描述,否则 格式过于 宽泛,
chianCNIJsonData: -|
[{
chain 1
},{
chain 2
}]
这样能插入任意多个
webhook 对 数组格式进行校验
另外,这个新字段 等于 划开一个口子,用户能够随意输入东西,例如缺少一些 field 等, webhook 是否 能够调用 cni 相关接口,验证 最终生成的 cni 配置 是否符合 cni 规范的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是字符串数组 :) 每个元素对应一个 chainCNI 的配置。
这个新字段 等于 划开一个口子,用户能够随意输入东西,例如缺少一些 field 等, webhook 是否 能够调用 cni 相关接口,验证 最终生成的 cni 配置 是否符合 cni 规范的
这个可以
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chianCNIJsonData: -|
[{
chain 1
},{
chain 2
}]
这种方式还不能实现,因为这里面是多个不同 chainCNI 的配置,没办法用一个统一得结构去 unmarshal ,所以没法转化为 plugins
可以用 []interface{} 实现,但会反复marshal 和 unmarshal
只能或者还是按照以下得方式:
chianCNIJsonData:
- chain1
- chain2
每个元素是一个chainCNI 的配置,可以校验,不需要反复的 marshal 和 unmarshal 就可以方便append 到已有的 plugins 中,哪种方式更好?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也不错
chianCNIJsonData:
- chain1
- chain2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chianCNIJsonData:
- chain1
- chain2
// The automatically generated multus configuration should be associated with spidermultus | ||
if config.ObjectMeta.OwnerReferences[0].Kind != constant.KindSpiderMultusConfig { | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个最好 拉起个 pod 能够 running,完成最终的闭环 ,避免想当然了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
db48a81
to
d4ba810
Compare
It("create a spidermultusconfig to verify chainCNI json config", Label("M00021"), func() { | ||
var smcName string = "chain-cni-multus" + common.GenerateString(10, true) | ||
|
||
invalidJson := `{ "invalid" }` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里只验证了 非 json 格式, 如果如下呢,是否有能力,是否要补 CI
- json格式, 但是不是字典
- json格式, 但 缺少 type 什么的,基本的 cni 配置都不满足
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
a20a4ed
to
bd3188b
Compare
Signed-off-by: cyclinder <[email protected]>
bd3188b
to
074381e
Compare
Thanks for contributing!
What type of PR is this?
What this PR does / why we need it:
Add chainCNI support for spidermultusconfig, In this way, we use a plugin like
tuning
to help configure the kernel parameters of the pod.Which issue(s) this PR fixes:
Fixes #3919
Special notes for your reviewer:
nad: