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

add ibKubernetesEnabled config #38

Merged
merged 1 commit into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ echo 8 > /sys/class/net/ib0/device/sriov_numvfs
* `type` (string, required): "ib-sriov"
* `deviceID` (string, required): A valid pci address of an InfiniBand SR-IOV NIC's VF. e.g. "0000:03:02.3"
* `guid` (string, optional): InfiniBand Guid for VF.
* `pkey` (string, optional): InfiniBand pkey for VF, this filed is used by [ib-kubernetes](https://www.github.com/Mellanox/ib-kubernetes) to add pkey with guid to InfiniBand subnet manager client e.g. [Mellanox UFM](https://www.mellanox.com/products/management-software/ufm), [OpenSM](https://docs.mellanox.com/display/MLNXOFEDv461000/OpenSM).
* `pkey` (string, optional): InfiniBand pkey for VF, this field is used by [ib-kubernetes](https://www.github.com/Mellanox/ib-kubernetes) to add pkey with guid to InfiniBand subnet manager client e.g. [Mellanox UFM](https://www.mellanox.com/products/management-software/ufm), [OpenSM](https://docs.mellanox.com/display/MLNXOFEDv461000/OpenSM).
* `ipam` (dictionary, optional): IPAM configuration to be used for this network, `dhcp` is not supported.
* `link_state` (string, optional): Enforces link state for the VF. Allowed values: auto, enable, disable.
* `rdmaIsolation` (boolean, optional): Enable RDMA network namespace isolation for RDMA workloads. More information
about the system requirements to support this mode of operation can be found [here](https://github.com/Mellanox/rdma-cni)
* `ibKubernetesEnabled` (bool, optional): Enforces ib-sriov-cni to work with [ib-kubernetes](https://www.github.com/Mellanox/ib-kubernetes).

> *__Note__*: If `rdmaIsolation` is set to _true_, [`rdma-cni`](https://github.com/Mellanox/rdma-cni) should not be used.

Expand All @@ -225,6 +226,7 @@ ib-sriov supports the following [CNI's Capabilities / Runtime Configuration](htt
"deviceID": "0000:03:02.0",
"link_state": "enable",
"rdmaIsolation": true,
"ibKubernetesEnabled": false,
"ipam": {
"type": "host-local",
"subnet": "10.56.217.0/24",
Expand Down
2 changes: 1 addition & 1 deletion cmd/ib-sriov-cni/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func cmdAdd(args *skel.CmdArgs) error {
return fmt.Errorf("infiniBand SRI-OV CNI failed to load netconf: %v", err)
}

if netConf.Args.CNI[infiniBandAnnotation] != configuredInfiniBand {
if netConf.IBKubernetesEnabled && netConf.Args.CNI[infiniBandAnnotation] != configuredInfiniBand {
return fmt.Errorf(
"infiniBand SRIOV-CNI failed, InfiniBand status \"%s\" is not \"%s\" please check mellanox ib-kubernets",
infiniBandAnnotation, configuredInfiniBand)
Expand Down
1 change: 1 addition & 0 deletions deployment/examples/ib-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
"name": "sriov-network",
"pkey": "0x5",
"link_state": "enable",
"ibKubernetesEnabled": false,
"ipam": {
"type": "host-local",
"subnet": "10.56.217.0/24",
Expand Down
27 changes: 14 additions & 13 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ import (
// NetConf extends types.NetConf for ib-sriov-cni
type NetConf struct {
types.NetConf
Master string
DeviceID string `json:"deviceID"` // PCI address of a VF in valid sysfs format
VFID int
HostIFNames string // VF netdevice name(s)
HostIFGUID string // VF netdevice GUID
ContIFNames string // VF names after in the container; used during deletion
GUID string `json:"-"` // Taken from either CNI_ARGS "guid" attribute or from RuntimeConfig
PKey string `json:"pkey"`
LinkState string `json:"link_state,omitempty"` // auto|enable|disable
RdmaIso bool `json:"rdmaIsolation,omitempty"`
RdmaNetState rdmatypes.RdmaNetState
Args struct {
Master string
DeviceID string `json:"deviceID"` // PCI address of a VF in valid sysfs format
VFID int
HostIFNames string // VF netdevice name(s)
HostIFGUID string // VF netdevice GUID
ContIFNames string // VF names after in the container; used during deletion
GUID string `json:"-"` // Taken from either CNI_ARGS "guid" attribute or from RuntimeConfig
PKey string `json:"pkey"`
LinkState string `json:"link_state,omitempty"` // auto|enable|disable
RdmaIso bool `json:"rdmaIsolation,omitempty"`
IBKubernetesEnabled bool `json:"ibKubernetesEnabled,omitempty"`
RdmaNetState rdmatypes.RdmaNetState
RuntimeConfig RuntimeConf `json:"runtimeConfig,omitempty"`
Args struct {
CNI map[string]string `json:"cni"`
} `json:"args"`
RuntimeConfig RuntimeConf `json:"runtimeConfig,omitempty"`
}

// RuntimeConf represents the plugin's runtime configurations
Expand Down