Make ovs-vswitchd service 'other_config' option configurable#823
Make ovs-vswitchd service 'other_config' option configurable#823e0ne wants to merge 2 commits intok8snetworkplumbingwg:masterfrom
Conversation
|
Thanks for your PR,
To skip the vendors CIs, Maintainers can use one of:
|
2dc7153 to
bc320cd
Compare
Pull Request Test Coverage Report for Build 22157252900Details
💛 - Coveralls |
|
So, here are my thoughts on this one: we should use same API as we have in in addition we should support clearing any global configurations which were set but are not relevant anymore. the i wonder if we want a design doc for this one WDYT ? |
a26b54a to
027353b
Compare
c451160 to
13d1f90
Compare
5f41adf to
9d3add7
Compare
|
Thanks for your PR,
To skip the vendors CIs, Maintainers can use one of:
|
f64a6b8 to
f73543a
Compare
466ee14 to
dd06c5b
Compare
|
/test-all-nvidia |
|
CI failures aren't related to this change |
|
Thanks for your PR,
To skip the vendors CIs, Maintainers can use one of:
|
1a25f3d to
4c7f92e
Compare
|
Thanks for your PR,
To skip the vendors CIs, Maintainers can use one of:
|
|
@SchSeba could you please take a look on that? |
Signed-off-by: Ivan Kolodiazhnyi <ikolodiazhny@nvidia.com>
Signed-off-by: Ivan Kolodiazhnyi <ikolodiazhny@nvidia.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces configurability for the ovs-vswitchd service's other_config option. The changes span API types, CRDs, controllers, and host-level service management to apply these configurations. While the overall approach is sound, I've found a critical issue in the systemd service unit command that includes a typo and has flawed logic for cleaning up old configurations. I've also noted some areas for improvement regarding API consistency, test code structure, and plugin logic. Please see the detailed comments for suggestions.
| contents: | | ||
| [Service] | ||
| ExecStartPre=/bin/ovs-vsctl --no-wait set Open_vSwitch . other_config:hw-offload=true | ||
| ExecStartPre=/bin/ovs-vsctl -t 5 set Open_vSwitch . external_ids:sriov-operator-owned-keys='{{ .ExternalIds }}' && /bin/ovs-vsctl/ovs-vsctl -t 5 get Open_vSwitch . external_ids:sriov-operator-owned-keys | xargs /bin/ovs-vsctl --no-wait remove Open_vSwitch . other_config && /bin/ovs-vsctl --no-wait set Open_vSwitch . {{ .OtherOvsConfig }} |
There was a problem hiding this comment.
The ExecStartPre command has a critical typo and flawed logic for managing other_config.
-
Critical Typo: The path
/bin/ovs-vsctl/ovs-vsctlis incorrect and will cause the command to fail. It should be/bin/ovs-vsctl. -
Flawed Cleanup Logic: The command attempts to clean up old
other_configentries. However, it first updatesexternal_ids:sriov-operator-owned-keyswith the new set of keys, then reads them back to perform the cleanup. This means if a key is removed from the configuration, it will not be in the list of keys to remove and will remain stale inother_config. -
Incorrect
xargsUsage:ovs-vsctl getreturns a single quoted string (e.g.,"key1 key2").xargswill pass this as a single argument toovs-vsctl remove, which will fail because it expects separate keys.
To fix this, you should first get the old keys, then remove them, then set the new keys. A simple fix for the typo is provided, but the logic should be revisited for robustness.
ExecStartPre=/bin/ovs-vsctl -t 5 set Open_vSwitch . external_ids:sriov-operator-owned-keys='{{ .ExternalIds }}' && /bin/ovs-vsctl -t 5 get Open_vSwitch . external_ids:sriov-operator-owned-keys | xargs /bin/ovs-vsctl --no-wait remove Open_vSwitch . other_config && /bin/ovs-vsctl --no-wait set Open_vSwitch . {{ .OtherOvsConfig }}| Name string `json:"name,omitempty"` | ||
| // OVS config. It will be provided for ovs-vswitchd service as other_config option | ||
| // +kubebuilder:default:={hw-offload: "true"} | ||
| OvsConfig map[string]string `json:"otherConfig,omitempty"` |
There was a problem hiding this comment.
The JSON tag otherConfig for the OvsConfig field is inconsistent. In sriovnetworknodestate_types.go, the OvsConfig field uses the ovsConfig JSON tag. For consistency across the API, it would be better to use ovsConfig here as well.
| OvsConfig map[string]string `json:"otherConfig,omitempty"` | |
| OvsConfig map[string]string `json:"ovsConfig,omitempty"` |
| Context("Config Daemon generic flow", func() { | ||
| BeforeEach(func() { | ||
| // k8s plugin for k8s cluster type | ||
| if vars.ClusterType == constants.ClusterTypeKubernetes { | ||
| hostHelper.EXPECT().ReadServiceManifestFile(gomock.Any()).Return(&hostTypes.Service{Name: "test"}, nil).AnyTimes() | ||
| hostHelper.EXPECT().ReadServiceInjectionManifestFile(gomock.Any(), gomock.Any()).Return(&hostTypes.Service{Name: "test"}, nil).AnyTimes() | ||
| } | ||
| }) | ||
| }) |
| if p.isOVSHwOffloadingEnabled() { | ||
| p.updateTarget.openVSwitch.SetNeedUpdate() | ||
| } else { | ||
| p.updateTarget.openVSwitch.SetNeedReboot() | ||
| } |
There was a problem hiding this comment.
The logic if p.isOVSHwOffloadingEnabled() { p.updateTarget.openVSwitch.SetNeedUpdate() } seems redundant. The preceding if/else block already sets NeedUpdate if the systemd service requires an update. The isSystemDServiceNeedUpdate check should be sufficient to determine if the service file needs to be updated. This additional check is confusing because it marks the service for an update even if it's already enabled, which is likely not the intention. Consider removing this block for clarity.
No description provided.