-
Notifications
You must be signed in to change notification settings - Fork 82
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 annotation cni.spidernet.io/network-resource-inject #4421
base: main
Are you sure you want to change the base?
Conversation
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.
也需要添加下 docs 和 e2e
pkg/podmanager/pod_webhook.go
Outdated
if !ok { | ||
needInject := false | ||
annos := []string{constant.AnnoPodResourceInject, constant.AnnoNetworkResourceInject} | ||
for _, anno := range annos { |
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.
可以直接这样:
for _, anno := range ]string{constant.AnnoPodResourceInject, constant.AnnoNetworkResourceInject} {
...
}
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.
好的
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.
似乎修改还没推送上来?
pkg/podmanager/utils.go
Outdated
Key: constant.AnnoPodResourceInject, | ||
Operator: metav1.LabelSelectorOpIn, | ||
Values: []string{multusLabelValue}, | ||
for _, anno := range annos { |
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.
我在想两个 annotations 应该是 2 选一 ,所以当检查到 pod 有其中一个 anno 并处理完后,就可以跳出这个 loop
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.
ok
pkg/podmanager/utils.go
Outdated
return nil | ||
annos := []struct { | ||
key string | ||
checkCNI bool |
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.
这个 checkCNI 似乎是多余的,AnnoNetworkResourceInject
是一个更大的范围,包括 RDMA 以及 Underlay 场景
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.
ok
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4421 +/- ##
==========================================
- Coverage 79.26% 79.15% -0.12%
==========================================
Files 54 54
Lines 6283 6288 +5
==========================================
- Hits 4980 4977 -3
- Misses 1108 1115 +7
- Partials 195 196 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
add e2e test case and docs |
|
||
[**English**](./multi-underlay-nic.md) | **简体中文** | ||
|
||
## 基于 Webhook 自动注入 Multi Underlay 网络资源 |
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.
把这个作为标题:
基于 Webhook 自动为 Pod 附加多张 Underlay 网卡
@@ -135,6 +135,7 @@ EOF | |||
Note: | |||
|
|||
> subnet 应该与节点网卡 ens192 的子网保持一致,并且不与现有任何 IP 冲突。 | |||
> 如果需要为Pod添加多张Underlay网卡的可以参考[**Multi-Underlay-NIC**](./multi-underlay-nic-zh_CN.md)。 |
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.
英文单词中加个空格
apiVersion: spiderpool.spidernet.io/v2beta1 | ||
kind: SpiderMultusConfig | ||
metadata: | ||
name: macvlan1 |
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.
name 可改为 macvlan-ens192
apiVersion: spiderpool.spidernet.io/v2beta1 | ||
kind: SpiderMultusConfig | ||
metadata: | ||
name: macvlan2 |
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.
name 可改为 macvlan-ens193
|
@@ -422,7 +422,7 @@ | |||
|
|||
## 基于 Webhook 自动注入 RDMA 网络资源 | |||
|
|||
在上述步骤中,我们展示了如何使用 SR-IOV 技术在 RoCE 和 Infiniband 网络环境中为容器提供 RDMA 通信能力。然而,当配置多网卡的 AI 应用时,过程会变得复杂。为简化这个过程,Spiderpool 通过 annotations(`cni.spidernet.io/rdma-resource-inject`) 支持对一组网卡配置进行分类。用户只需要为应用添加与网卡配置相同的注解,Spiderpool 就会通过 webhook 自动为应用注入所有具有相同注解的对应网卡和网络资源。 | |||
在上述步骤中,我们展示了如何使用 SR-IOV 技术在 RoCE 和 Infiniband 网络环境中为容器提供 RDMA 通信能力。然而,当配置多网卡的 AI 应用时,过程会变得复杂。为简化这个过程,Spiderpool 通过 annotations(`cni.spidernet.io/rdma-resource-inject` 或 `cni.spidernet.io/network-resource-inject`) 支持对一组网卡配置进行分类。用户只需要为应用添加与网卡配置相同的注解,Spiderpool 就会通过 webhook 自动为应用注入所有具有相同注解的对应网卡和网络资源。 |
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.
(1)pls tell the differences between the two annotation in the document
(2) cni.spidernet.io/network-resource-inject
seems not to apply to the RDMA document
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.
- 在 AI docs 中 说明下 使用 这两种 anno 的差异:
cni.spidernet.io/rdma-resource-inject 只适用于 AI 场景,自动注入 RDMA 网卡及 RDMA Resources。 cni.spidernet.io/network-resource-inject 不但可以用于 AI 场景,也支持 Underlay 场景
- 在未来我们希望都统一使用 cni.spidernet.io/network-resource-inject 统一支持 这两种场景。
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.
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.
好的
Signed-off-by: Cyclinder Kuo <[email protected]>
Signed-off-by: ruochen <[email protected]> Signed-off-by: Cyclinder Kuo <[email protected]>
Thanks for contributing!
Notice:
"release/none"
"release/bug"
"release/feature"
What issue(s) does this PR fix:
Fixes #4358
Special notes for your reviewer:
Maybe could rename some funcs