Skip to content

Commit a26b54a

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

19 files changed

+124
-35
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 map[string]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 map[string]string `json:"otherConfig,omitempty"`
3740
}
3841

3942
// SriovNetworkPoolConfigStatus defines the observed state of SriovNetworkPoolConfig

api/v1/zz_generated.deepcopy.go

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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 . {{ .OtherOvsConfig }}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ spec:
176176
type: array
177177
system:
178178
properties:
179+
ovsConfig:
180+
additionalProperties:
181+
type: string
182+
default:
183+
hw-offload=: "true"
184+
description: OVS config. It will be provided for ovs-vswitchd
185+
service as other_config option
186+
type: object
179187
rdmaMode:
180188
description: RDMA subsystem. Allowed value "shared", "exclusive".
181189
enum:
@@ -346,6 +354,14 @@ spec:
346354
type: string
347355
system:
348356
properties:
357+
ovsConfig:
358+
additionalProperties:
359+
type: string
360+
default:
361+
hw-offload=: "true"
362+
description: OVS config. It will be provided for ovs-vswitchd
363+
service as other_config option
364+
type: object
349365
rdmaMode:
350366
description: RDMA subsystem. Allowed value "shared", "exclusive".
351367
enum:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ spec:
110110
On OpenShift:
111111
Name is the name of MachineConfigPool to be enabled with OVS hardware offload
112112
type: string
113+
otherConfig:
114+
additionalProperties:
115+
type: string
116+
default:
117+
hw-offload: "true"
118+
description: OVS config. It will be provided for ovs-vswitchd
119+
service as other_config option
120+
type: object
113121
type: object
114122
rdmaMode:
115123
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ spec:
176176
type: array
177177
system:
178178
properties:
179+
ovsConfig:
180+
additionalProperties:
181+
type: string
182+
default:
183+
hw-offload=: "true"
184+
description: OVS config. It will be provided for ovs-vswitchd
185+
service as other_config option
186+
type: object
179187
rdmaMode:
180188
description: RDMA subsystem. Allowed value "shared", "exclusive".
181189
enum:
@@ -346,6 +354,14 @@ spec:
346354
type: string
347355
system:
348356
properties:
357+
ovsConfig:
358+
additionalProperties:
359+
type: string
360+
default:
361+
hw-offload=: "true"
362+
description: OVS config. It will be provided for ovs-vswitchd
363+
service as other_config option
364+
type: object
349365
rdmaMode:
350366
description: RDMA subsystem. Allowed value "shared", "exclusive".
351367
enum:

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

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

0 commit comments

Comments
 (0)