Description of problem: When creating cr SriovNetworkNodePolicy with "resourceName: intel-rhel". the device-plugin pod creashed with error: oc logs sriov-device-plugin-klb2t I1120 09:36:40.274970 20 manager.go:70] Using Kubelet Plugin Registry Mode I1120 09:36:40.275183 20 main.go:44] resource manager reading configs I1120 09:36:40.275746 20 manager.go:98] ResourceList: [{ResourceName:intelnetdevice-rhel IsRdma:false Selectors:{Vendors:[8086] Devices:[] Drivers:[iavf mlx5_core i40evf ixgbevf] PfNames:[p1p1] LinkTypes:[]}}] E1120 09:36:40.275876 20 manager.go:161] resource name "intelnetdevice-rhel" contains invalid characters F1120 09:36:40.275901 20 main.go:57] Exiting.. one or more invalid configuration(s) given Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Assume the sriov operator is installed 2. Create one CR with: apiVersion: sriovnetwork.openshift.io/v1 kind: SriovNetworkNodePolicy metadata: name: intel-netdevice-rhel namespace: openshift-sriov-network-operator spec: deviceType: netdevice mtu: 1500 nicSelector: pfNames: - p1p1 rootDevices: - '0000:3b:00.0' vendor: '8086' nodeSelector: feature.node.kubernetes.io/sriov-capable-rhel: 'true' numVfs: 5 priority: 99 resourceName: intel-rhel 3. oc get pod 4. Actual results: oc logs sriov-device-plugin-klb2t I1120 09:36:40.274970 20 manager.go:70] Using Kubelet Plugin Registry Mode I1120 09:36:40.275183 20 main.go:44] resource manager reading configs I1120 09:36:40.275746 20 manager.go:98] ResourceList: [{ResourceName:intelnetdevice-rhel IsRdma:false Selectors:{Vendors:[8086] Devices:[] Drivers:[iavf mlx5_core i40evf ixgbevf] PfNames:[p1p1] LinkTypes:[]}}] E1120 09:36:40.275876 20 manager.go:161] resource name "intelnetdevice-rhel" contains invalid characters F1120 09:36:40.275901 20 main.go:57] Exiting.. one or more invalid configuration(s) given Expected results: Webhook should add validation for resourceName. Additional info:
The sriov-network-device-plugin only allows the resourceNames which follow '^[a-zA-Z0-9-]+$'. I guess the intention is to follow rfc952. However, in rfc952, '-' is a valid character. The sriov-network-device-plugin code may also need to be fixed.
Verified this bug on 4.3.0-201912190717 # oc create -f wrong.yaml Error from server (resource name "intel-rhel" contains invalid characters): error when creating "wrong.yaml": admission webhook "operator-webhook.sriovnetwork.openshift.io" denied the request: resource name "intel-rhel" contains invalid characters
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:0581