Skip to content
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

title: support host-device cni #3327

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GreatLazyMan
Copy link

Thanks for contributing!

What type of PR is this?

  • kind/feature

What this PR does / why we need it:
support host-device cni

Which issue(s) this PR fixes:
Fixes #3303

Special notes for your reviewer:

Signed-off-by: GreatLazyMan <dongweiguo_yewu@cmss.chinamobile.com>
Signed-off-by: GreatLazyMan <dongweiguo_yewu@cmss.chinamobile.com>
Signed-off-by: GreatLazyMan <dongweiguo_yewu@cmss.chinamobile.com>
Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.12%. Comparing base (39a4e3d) to head (9f5f462).
Report is 24 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3327      +/-   ##
==========================================
- Coverage   81.68%   81.12%   -0.56%     
==========================================
  Files          50       50              
  Lines        5372     5372              
==========================================
- Hits         4388     4358      -30     
- Misses        823      856      +33     
+ Partials      161      158       -3     
Flag Coverage Δ
unittests 81.12% <ø> (-0.56%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

Copy link
Collaborator

@cyclinder cyclinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! @GreatLazyMan.

Could you mind adding some e2e tests for this? you can refer to

It("testing creating spiderMultusConfig with cniType: ipvlan and checking the net-attach-conf config if works", Label("M00002"), func() {

Also, After you test the host-device plugin in your local, you can update the docs :)

// +kubebuilder:validation:Optional
HWAddr string `json:"hwAddr,omitempty"`
// +kubebuilder:validation:Optional
DPDKMode bool `json:"enableDPDK,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need DPDKMode, this field can't be configured. The host-device plugin can detect it is in DPDK mode automatically by checking the Device's driver. see https://github.com/containernetworking/plugins/blob/c860b78de419336c418fee93fc5cf0f6c9b115ba/plugins/main/host-device/host-device.go#L113.

netConf.IPAM = &spiderpoolcmd.IPAMConfig{
Type: constant.Spiderpool,
}
if multusConfSpec.OvsConfig.SpiderpoolConfigPools != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: OvsConfig -> HostDeviceConfig

Type string `json:"type"`
Device string `json:"deviceName,omitempty"`
HWAddr string `json:"hwAddr,omitempty"`
DPDKMode bool `json:"enableDPDK,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need remove this

@cyclinder cyclinder added release/feature-new release note for new feature kind/feature labels Mar 20, 2024
```bash
helm repo add spiderpool https://spidernet-io.github.io/spiderpool
helm repo update spiderpool
helm install spiderpool spiderpool/spiderpool --namespace kube-system --set multus.multusCNI.defaultCniCRName="host-device-conf" --set plugins.installHostDeviceCNI=true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove --set plugins.installHostDeviceCNI=true because --install-cni would install the whole cni-plugins including host-device.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helm install spiderpool spiderpool/spiderpool --namespace kube-system --set multus.multusCNI.defaultCniCRName="host-device-conf" --set plugins.installHostDeviceCNI=true
```

> 如果未安装 host-device-cni, 可以通过 Helm 参数 '-set plugins.installHostDeviceCNI=true' 安装它。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

{
"ipv4": ["ippool-test"]
}
v1.multus-cni.io/default-network: kube-system/host-device-conf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need a SpiderMultusConfig object for host-device, just follow

MACVLAN_MASTER_INTERFACE="eth0"
cat <<EOF | kubectl apply -f -
apiVersion: spiderpool.spidernet.io/v2beta1
kind: SpiderMultusConfig
metadata:
name: macvlan-conf
namespace: kube-system
spec:
cniType: macvlan
macvlan:
master:
- ${MACVLAN_MASTER_INTERFACE}
EOF
```


* 如果你使用 Underlay 模式,`coordinator` 会在主机上创建 veth 接口,为了防止 NetworkManager 干扰 veth 接口, 导致 Pod 访问异常。我们需要配置 NetworkManager,使其不纳管这些 Veth 接口。

* 如果你通过 `Iface`r 创建 Vlan 和 Bond 接口,NetworkManager 可能会干扰这些接口,导致 Pod 访问异常。我们需要配置 NetworkManager,使其不纳管这些 Veth 接口。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these description is not suitable for host device case

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过 Ifacer

---》

通过 Ifacer

@weizhoublue
Copy link
Collaborator

@GreatLazyMan could you update the PR according to the comments ? thanks

@weizhoublue
Copy link
Collaborator

BTW, it needs E2E cases to make sure the feature

@weizhoublue weizhoublue added the pr/not-ready not ready for merging label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature pr/not-ready not ready for merging release/feature-new release note for new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support host-device cni
4 participants