Skip to content

Commit c92b6e3

Browse files
committed
controllers: fix useHostNetworkForCsiControllersKey parsing from CM
csi controller plugin host network was getting set to false if the useHostNetworkForCsiControllersKey was not present, changed it to apply the correct value only if the key is present Signed-off-by: Rohan Gupta <rohgupta@redhat.com>
1 parent 3d91951 commit c92b6e3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/controller/operatorconfigmap_controller.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,11 @@ func (c *OperatorConfigMapReconciler) reconcileDelegatedCSI(storageClients *v1al
573573
if c.AvailableCrds[VolumeGroupSnapshotClassCrdName] {
574574
driverSpecDefaults.SnapshotPolicy = csiopv1.VolumeGroupSnapshotPolicy
575575
}
576-
csiCtrlPluginHostNetwork, _ := strconv.ParseBool(c.operatorConfigMap.Data[useHostNetworkForCsiControllersKey])
577-
driverSpecDefaults.ControllerPlugin.HostNetwork = ptr.To(csiCtrlPluginHostNetwork)
576+
csiCtrlPluginHostNetworkVal, exists := c.operatorConfigMap.Data[useHostNetworkForCsiControllersKey]
577+
if exists {
578+
csiCtrlPluginHostNetwork, _ := strconv.ParseBool(csiCtrlPluginHostNetworkVal)
579+
driverSpecDefaults.ControllerPlugin.HostNetwork = ptr.To(csiCtrlPluginHostNetwork)
580+
}
578581
if cniNetworkAnnotationValue != "" {
579582
if driverSpecDefaults.ControllerPlugin.Annotations == nil {
580583
driverSpecDefaults.ControllerPlugin.Annotations = map[string]string{}

0 commit comments

Comments
 (0)