k8snetworkplumbingwg / sriov-network-operator

Operator for provisioning and configuring SR-IOV CNI plugin and device plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error message when applying a policy doesn't highlight was went wrong with the policy when checking for dynamicSriovNetworkNodePolicy parameters

vrindle opened this issue · comments

SRIOV network node policy:

Full matching:
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
name: policy-mlx
namespace: openshift-sriov-network-operator
spec:
deviceType: netdevice
eSwitchMode: "switchdev"
nicSelector:
rootDevices:
- 0000:af:00.0
pfNames:
- ens4f0np0#1-11
nodeSelector:
feature.node.kubernetes.io/network-sriov.capable: "true"
numVfs: 12
priority: 5
resourceName: mlxnics

Output when created:
sriovnetworknodepolicy.sriovnetwork.openshift.io/policy-mlx created

Partially matching:
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
name: policy-mlx
namespace: openshift-sriov-network-operator
spec:
deviceType: netdevice
eSwitchMode: "switchdev"
nicSelector:
rootDevices:
- 0000:aq:00.0
pfNames:
- ens4f0np0#1-11
nodeSelector:
feature.node.kubernetes.io/network-sriov.capable: "true"
numVfs: 12
priority: 5
resourceName: mlxnics

Output when created:
Error from server (no supported NIC is selected by the nicSelector in CR policy-mlx): error when applying patch: {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"sriovnetwork.openshift.io/v1\",\"kind\":\"SriovNetworkNodePolicy\",\"metadata\":{\"annotations\":{},\"name\":\"policy-mlx\",\"namespace\":\"openshift-sriov-network-operator\"},\"spec\":{\"deviceType\":\"netdevice\",\"eSwitchMode\":\"switchdev\",\"nicSelector\":{\"pfNames\":[\"ens4f0np0#1-11\"],\"rootDevices\":[\"0000:aq:00.0\"]},\"nodeSelector\":{\"feature.node.kubernetes.io/network-sriov.capable\":\"true\"},\"numVfs\":12,\"priority\":5,\"resourceName\":\"mlxnics\"}}\n"}},"spec":{"nicSelector":{"rootDevices":["0000:aq:00.0"]}}}

No matching:
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
name: policy-mlx
namespace: openshift-sriov-network-operator
spec:
deviceType: netdevice
eSwitchMode: "switchdev"
nicSelector:
rootDevices:
- 0000:aq:00.0
pfNames:
- ens3f0np0#1-11
nodeSelector:
feature.node.kubernetes.io/network-sriov.capable: "true"
numVfs: 12
priority: 5
resourceName: mlxnics

Output when created:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"sriovnetwork.openshift.io/v1\",\"kind\":\"SriovNetworkNodePolicy\",\"metadata\":{\"annotations\":{},\"name\":\"policy-mlx\",\"namespace\":\"openshift-sriov-network-operator\"},\"spec\":{\"deviceType\":\"netdevice\",\"eSwitchMode\":\"switchdev\",\"nicSelector\":{\"pfNames\":[\"ens3f0np0#1-11\"],\"rootDevices\":[\"0000:aq:00.0\"]},\"nodeSelector\":{\"feature.node.kubernetes.io/network-sriov.capable\":\"true\"},\"numVfs\":12,\"priority\":5,\"resourceName\":\"mlxnics\"}}\n"}},"spec":{"nicSelector":{"pfNames":["ens3f0np0#1-11"],"rootDevices":["0000:aq:00.0"]}}}

As we can see it should tell the user why the policy is not failing in a more verbose and direct way.

Hi @vrindle do you already have a PR open for this right?

PR 434 seems to address the issue. please reopen if my understanding is wrong.