-
Create a
SriovOperatorConfig
custom resource (CR) to deploy all the SR-IOV Operator components:-
Create a file named
sriovOperatorConfig.yaml
using the following YAML:apiVersion: sriovnetwork.openshift.io/v1 kind: SriovOperatorConfig metadata: name: default (1) namespace: openshift-sriov-network-operator spec: disableDrain: false enableInjector: true (2) enableOperatorWebhook: true (3) logLevel: 2 featureGates: metricsExporter: false
-
The only valid name for the
SriovOperatorConfig
resource isdefault
and it must be in the namespace where the Operator is deployed. -
The
enableInjector
field, if not specified in the CR or explicitly set totrue
, defaults tofalse
or<none>
, preventing anynetwork-resources-injector
pod from running in the namespace. The recommended setting istrue
. -
The
enableOperatorWebhook
field, if not specified in the CR or explicitly set to true, defaults tofalse
or<none>
, preventing anyoperator-webhook
pod from running in the namespace. The recommended setting istrue
.
-
-
Create the resource by running the following command:
$ oc apply -f sriovOperatorConfig.yaml
-
The fields for the sriovoperatorconfig
custom resource are described in the following table:
Field | Type | Description |
---|---|---|
|
|
Specifies the name of the SR-IOV Network Operator instance.
The default value is |
|
|
Specifies the namespace of the SR-IOV Network Operator instance.
The default value is |
|
|
Specifies the node selection to control scheduling the SR-IOV Network Config Daemon on selected nodes. By default, this field is not set and the Operator deploys the SR-IOV Network Config daemon set on worker nodes. |
|
|
Specifies whether to disable the node draining process or enable the node draining process when you apply a new policy to configure the NIC on a node.
Setting this field to For single-node clusters, set this field to |
|
|
Specifies whether to enable or disable the Network Resources Injector daemon set. |
|
|
Specifies whether to enable or disable the Operator Admission Controller webhook daemon set. |
|
|
Specifies the log verbosity level of the Operator.
Set to |
|
|
Specifies whether to enable or disable the optional features. For example, |
|
|
Specifies whether to enable or disable the SR-IOV Network Operator metrics. By default, this field is set to |
|
|
Specifies whether to reset the firmware on virtual function (VF) changes in the SR-IOV Network Operator. Some chipsets, such as the Intel C740 Series, do not completely power off the PCI-E devices, which is required to configure VFs on NVIDIA/Mellanox NICs. By default, this field is set to |
The Network Resources Injector is a Kubernetes Dynamic Admission Controller application, which provides the following capabilities:
-
Mutation of resource requests and limits in a pod specification to add an SR-IOV resource name according to an SR-IOV network attachment definition annotation.
-
Mutation of a pod specification with a Downward API volume to expose pod annotations, labels, and huge pages requests and limits. Containers that run in the pod can access the exposed information as files under the
/etc/podnetinfo
path.
The Network Resources Injector is enabled by the SR-IOV Network Operator when the enableInjector
is set to true
in the SriovOperatorConfig
CR. The network-resources-injector
pod runs as a daemon set on all control plane nodes. The following is an example of Network Resources Injector pods running in a cluster with three control plane nodes:
$ oc get pods -n openshift-sriov-network-operator
NAME READY STATUS RESTARTS AGE
network-resources-injector-5cz5p 1/1 Running 0 10m
network-resources-injector-dwqpx 1/1 Running 0 10m
network-resources-injector-lktz5 1/1 Running 0 10m
By default, the failurePolicy
field in the Network Resources Injector webhook is set to Ignore
. This default setting prevents pod creation from being blocked if the webhook is unavailable.
If you set the failurePolicy
field to Fail
, and the Network Resources Injector webhook is unavailable, the webhook attempts to mutate all pod creation and update requests. This behavior can block pod creation and disrupt normal cluster operations. To prevent such issues, you can enable the featureGates.resourceInjectorMatchCondition
feature in the SriovOperatorConfig
object to limit the scope of the Network Resources Injector webhook. If this feature is enabled, the webhook applies only to pods with the secondary network annotation k8s.v1.cni.cncf.io/networks
.
If you set the failurePolicy
field to Fail
after enabling the resourceInjectorMatchCondition
feature, the webhook applies only to pods with the secondary network annotation k8s.v1.cni.cncf.io/networks
. If the webhook is unavailable, pods without this annotation are still deployed, preventing unnecessary disruptions to cluster operations.
The featureGates.resourceInjectorMatchCondition
feature is disabled by default. To enable this feature, set the featureGates.resourceInjectorMatchCondition
field to true
in the SriovOperatorConfig
object.
SriovOperatorConfig
object configurationapiVersion: sriovnetwork.openshift.io/v1
kind: SriovOperatorConfig
metadata:
name: default
namespace: sriov-network-operator
spec:
# ...
featureGates:
resourceInjectorMatchCondition: true
# ...
To disable or enable the Network Resources Injector, complete the following procedure.
-
Install the OpenShift CLI (
oc
). -
Log in as a user with
cluster-admin
privileges. -
You must have installed the SR-IOV Network Operator.
-
Set the
enableInjector
field. Replace<value>
withfalse
to disable the feature ortrue
to enable the feature.$ oc patch sriovoperatorconfig default \ --type=merge -n openshift-sriov-network-operator \ --patch '{ "spec": { "enableInjector": <value> } }'
TipYou can alternatively apply the following YAML to update the Operator:
apiVersion: sriovnetwork.openshift.io/v1 kind: SriovOperatorConfig metadata: name: default namespace: openshift-sriov-network-operator spec: enableInjector: <value>
The SR-IOV Network Operator Admission Controller webhook is a Kubernetes Dynamic Admission Controller application. It provides the following capabilities:
-
Validation of the
SriovNetworkNodePolicy
CR when it is created or updated. -
Mutation of the
SriovNetworkNodePolicy
CR by setting the default value for thepriority
anddeviceType
fields when the CR is created or updated.
The SR-IOV Network Operator Admission Controller webhook is enabled by the Operator when the enableOperatorWebhook
is set to true
in the SriovOperatorConfig
CR. The operator-webhook
pod runs as a daemon set on all control plane nodes.
Note
|
Use caution when disabling the SR-IOV Network Operator Admission Controller webhook. You can disable the webhook under specific circumstances, such as troubleshooting, or if you want to use unsupported devices. For information about configuring unsupported devices, see Configuring the SR-IOV Network Operator to use an unsupported NIC. |
The following is an example of the Operator Admission Controller webhook pods running in a cluster with three control plane nodes:
$ oc get pods -n openshift-sriov-network-operator
NAME READY STATUS RESTARTS AGE
operator-webhook-9jkw6 1/1 Running 0 16m
operator-webhook-kbr5p 1/1 Running 0 16m
operator-webhook-rpfrl 1/1 Running 0 16m
To disable or enable the admission controller webhook, complete the following procedure.
-
Install the OpenShift CLI (
oc
). -
Log in as a user with
cluster-admin
privileges. -
You must have installed the SR-IOV Network Operator.
-
Set the
enableOperatorWebhook
field. Replace<value>
withfalse
to disable the feature ortrue
to enable it:$ oc patch sriovoperatorconfig default --type=merge \ -n openshift-sriov-network-operator \ --patch '{ "spec": { "enableOperatorWebhook": <value> } }'
TipYou can alternatively apply the following YAML to update the Operator:
apiVersion: sriovnetwork.openshift.io/v1 kind: SriovOperatorConfig metadata: name: default namespace: openshift-sriov-network-operator spec: enableOperatorWebhook: <value>
The SR-IOV Network Config daemon discovers and configures the SR-IOV network devices on cluster nodes.
By default, it is deployed to all the worker
nodes in the cluster.
You can use node labels to specify on which nodes the SR-IOV Network Config daemon runs.
The SR-IOV Network Config daemon discovers and configures the SR-IOV network devices on cluster nodes. By default, it is deployed to all the worker
nodes in the cluster. You can use node labels to specify on which nodes the SR-IOV Network Config daemon runs.
To specify the nodes where the SR-IOV Network Config daemon is deployed, complete the following procedure.
Important
|
When you update the |
-
To update the node selector for the operator, enter the following command:
$ oc patch sriovoperatorconfig default --type=json \ -n openshift-sriov-network-operator \ --patch '[{ "op": "replace", "path": "/spec/configDaemonNodeSelector", "value": {<node_label>} }]'
Replace
<node_label>
with a label to apply as in the following example:"node-role.kubernetes.io/worker": ""
.TipYou can alternatively apply the following YAML to update the Operator:
apiVersion: sriovnetwork.openshift.io/v1 kind: SriovOperatorConfig metadata: name: default namespace: openshift-sriov-network-operator spec: configDaemonNodeSelector: <node_label>
By default, the SR-IOV Network Operator drains workloads from a node before every policy change. The Operator performs this action to ensure that there no workloads using the virtual functions before the reconfiguration.
For installations on a single node, there are no other nodes to receive the workloads. As a result, the Operator must be configured not to drain the workloads from the single node.
Important
|
After performing the following procedure to disable draining workloads, you must remove any workload that uses an SR-IOV network interface before you change any SR-IOV network node policy. |
-
Install the OpenShift CLI (
oc
). -
Log in as a user with
cluster-admin
privileges. -
You must have installed the SR-IOV Network Operator.
-
To set the
disableDrain
field totrue
and theconfigDaemonNodeSelector
field tonode-role.kubernetes.io/master: ""
, enter the following command:$ oc patch sriovoperatorconfig default --type=merge -n openshift-sriov-network-operator --patch '{ "spec": { "disableDrain": true, "configDaemonNodeSelector": { "node-role.kubernetes.io/master": "" } } }'
TipYou can alternatively apply the following YAML to update the Operator:
apiVersion: sriovnetwork.openshift.io/v1 kind: SriovOperatorConfig metadata: name: default namespace: openshift-sriov-network-operator spec: disableDrain: true configDaemonNodeSelector: node-role.kubernetes.io/master: ""