Skip to content

Commit 7fe2a0e

Browse files
committed
Make ovs-vswitchd service 'other_config' option configurable
Signed-off-by: Ivan Kolodiazhnyi <[email protected]>
1 parent 0a5260b commit 7fe2a0e

18 files changed

+77
-32
lines changed

api/v1/sriovnetworknodestate_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ type System struct {
119119
// +kubebuilder:validation:Enum=shared;exclusive
120120
//RDMA subsystem. Allowed value "shared", "exclusive".
121121
RdmaMode string `json:"rdmaMode,omitempty"`
122+
// OVS config. It will be provided for ovs-vswitchd service as other_config option
123+
// +kubebuilder:default:= "hw-offload=true"
124+
OvsConfig string `json:"ovsConfig,omitempty"`
122125
}
123126

124127
// SriovNetworkNodeStateStatus defines the observed state of SriovNetworkNodeState

api/v1/sriovnetworkpoolconfig_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ type OvsHardwareOffloadConfig struct {
3434
// On OpenShift:
3535
// Name is the name of MachineConfigPool to be enabled with OVS hardware offload
3636
Name string `json:"name,omitempty"`
37+
// OVS config. It will be provided for ovs-vswitchd service as other_config option
38+
// +kubebuilder:default:= "hw-offload=true"
39+
OvsConfig string `json:"ovsConfig,omitempty"`
3740
}
3841

3942
// SriovNetworkPoolConfigStatus defines the observed state of SriovNetworkPoolConfig

bindata/manifests/switchdev-config/ovs-units/ovs-vswitchd.service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ dropins:
33
- name: 10-hw-offload.conf
44
contents: |
55
[Service]
6-
ExecStartPre=/bin/ovs-vsctl --no-wait set Open_vSwitch . other_config:hw-offload=true
6+
ExecStartPre=/bin/ovs-vsctl --no-wait set Open_vSwitch . other_config:{{ .OvsConfig }}

config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodestates.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ spec:
176176
type: array
177177
system:
178178
properties:
179+
ovsConfig:
180+
default: hw-offload=true
181+
description: OVS config. It will be provided for ovs-vswitchd
182+
service as other_config option
183+
type: string
179184
rdmaMode:
180185
description: RDMA subsystem. Allowed value "shared", "exclusive".
181186
enum:
@@ -346,6 +351,11 @@ spec:
346351
type: string
347352
system:
348353
properties:
354+
ovsConfig:
355+
default: hw-offload=true
356+
description: OVS config. It will be provided for ovs-vswitchd
357+
service as other_config option
358+
type: string
349359
rdmaMode:
350360
description: RDMA subsystem. Allowed value "shared", "exclusive".
351361
enum:

config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ spec:
110110
On OpenShift:
111111
Name is the name of MachineConfigPool to be enabled with OVS hardware offload
112112
type: string
113+
ovsConfig:
114+
default: hw-offload=true
115+
description: OVS config. It will be provided for ovs-vswitchd
116+
service as other_config option
117+
type: string
113118
type: object
114119
rdmaMode:
115120
description: RDMA subsystem. Allowed value "shared", "exclusive".

controllers/sriovnetworknodepolicy_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ func (r *SriovNetworkNodePolicyReconciler) syncAllSriovNetworkNodeStates(ctx con
305305
}
306306
if netPoolConfig != nil {
307307
ns.Spec.System.RdmaMode = netPoolConfig.Spec.RdmaMode
308+
ns.Spec.System.OvsConfig = netPoolConfig.Spec.OvsHardwareOffloadConfig.OvsConfig
308309
}
309310
j, _ := json.Marshal(ns)
310311
logger.V(2).Info("SriovNetworkNodeState CR", "content", j)

controllers/sriovnetworkpoolconfig_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ func (r *SriovNetworkPoolConfigReconciler) syncOvsHardwareOffloadMachineConfigs(
159159
}
160160

161161
data := render.MakeRenderData()
162+
data.Data["OvsConfig"] = "hw-offload=true"
162163
mc, err := render.GenerateMachineConfig("bindata/manifests/switchdev-config", mcName, mcpName, true, &data)
163164
if err != nil {
164165
return err

deployment/sriov-network-operator-chart/crds/sriovnetwork.openshift.io_sriovnetworknodestates.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ spec:
176176
type: array
177177
system:
178178
properties:
179+
ovsConfig:
180+
default: hw-offload=true
181+
description: OVS config. It will be provided for ovs-vswitchd
182+
service as other_config option
183+
type: string
179184
rdmaMode:
180185
description: RDMA subsystem. Allowed value "shared", "exclusive".
181186
enum:
@@ -346,6 +351,11 @@ spec:
346351
type: string
347352
system:
348353
properties:
354+
ovsConfig:
355+
default: hw-offload=true
356+
description: OVS config. It will be provided for ovs-vswitchd
357+
service as other_config option
358+
type: string
349359
rdmaMode:
350360
description: RDMA subsystem. Allowed value "shared", "exclusive".
351361
enum:

deployment/sriov-network-operator-chart/crds/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ spec:
110110
On OpenShift:
111111
Name is the name of MachineConfigPool to be enabled with OVS hardware offload
112112
type: string
113+
ovsConfig:
114+
default: hw-offload=true
115+
description: OVS config. It will be provided for ovs-vswitchd
116+
service as other_config option
117+
type: string
113118
type: object
114119
rdmaMode:
115120
description: RDMA subsystem. Allowed value "shared", "exclusive".

pkg/daemon/plugin.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ func loadPlugins(ns *sriovnetworkv1.SriovNetworkNodeState, helpers helper.HostHe
5252
loadedPlugins = loadedVendorPlugins
5353

5454
if vars.ClusterType != consts.ClusterTypeOpenshift {
55-
k8sPlugin, err := K8sPlugin(helpers)
56-
if err != nil {
57-
log.Log.Error(err, "loadPlugins(): failed to load the k8s plugin")
58-
return nil, err
59-
}
60-
55+
k8sPlugin := K8sPlugin(helpers)
6156
pluginName := k8sPlugin.Name()
6257
if !isPluginDisabled(pluginName, disabledPlugins) {
6358
loadedPlugins[pluginName] = k8sPlugin

0 commit comments

Comments
 (0)