Skip to content

Commit

Permalink
controllers: fix issues found in recent testing
Browse files Browse the repository at this point in the history
1. While setting SELinuxMount on CSIDriver we need to check for existence
of value set in Nodeplugin before using it or else CSIDriver will
reconile infinitely due to a spurious diff
```
(dlv) p desiredCsiDriver.Spec
k8s.io/api/storage/v1.CSIDriverSpec {
        AttachRequired: *true,
        PodInfoOnMount: *false,
        VolumeLifecycleModes: []k8s.io/api/storage/v1.VolumeLifecycleMode len: 1, cap: 1, [
                "Persistent",
        ],
        StorageCapacity: *false,
        FSGroupPolicy: *"File",
        TokenRequests: []k8s.io/api/storage/v1.TokenRequest len: 0, cap: 0, nil,
        RequiresRepublish: *false,
        SELinuxMount: *bool nil,} <=====>
(dlv) p existingCsiDriver.Spec
k8s.io/api/storage/v1.CSIDriverSpec {
        AttachRequired: *true,
        PodInfoOnMount: *false,
        VolumeLifecycleModes: []k8s.io/api/storage/v1.VolumeLifecycleMode len: 1, cap: 1, [
                "Persistent",
        ],
        StorageCapacity: *false,
        FSGroupPolicy: *"File",
        TokenRequests: []k8s.io/api/storage/v1.TokenRequest len: 0, cap: 0, nil,
        RequiresRepublish: *false,
        SELinuxMount: *false,} <=====>
```
2. We need to mount csi configmap in Nodeplugin as well
3. Topology feature gate should be `false` by default
4. Fix typo in CSI plugin roles

Signed-off-by: Leela Venkaiah G <[email protected]>
  • Loading branch information
leelavg committed Aug 2, 2024
1 parent e08591b commit 8230041
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/rbac/csi_cephfs_ctrlplugin_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ subjects:
namespace: system
roleRef:
kind: Role
name: csi-cephfs-ctrlplugin-role
name: csi-cephfs-ctrlplugin-r
apiGroup: rbac.authorization.k8s.io
2 changes: 1 addition & 1 deletion config/rbac/csi_rbd_ctrlplugin_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ subjects:
namespace: system
roleRef:
kind: Role
name: csi-rbd-ctrlplugin-role
name: csi-rbd-ctrlplugin-r
apiGroup: rbac.authorization.k8s.io
2 changes: 1 addition & 1 deletion config/rbac/csi_rbd_nodeplugin_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ subjects:
namespace: system
roleRef:
kind: Role
name: csi-rbd-nodeplugin-role
name: csi-rbd-nodeplugin-r
apiGroup: rbac.authorization.k8s.io
8 changes: 6 additions & 2 deletions internal/controller/driver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,15 @@ func (r *driverReconcile) reconcileK8sCsiDriver() error {
)
desiredCsiDriver.Spec.FSGroupPolicy = ptr.To(
cmp.Or(
r.driver.Spec.FsGroupPolicy,
r.driver.Spec.FsGroupPolicy,
storagev1.FileFSGroupPolicy,
),
)
if nodePlugin := r.driver.Spec.NodePlugin; nodePlugin != nil {
desiredCsiDriver.Spec.SELinuxMount = nodePlugin.EnableSeLinuxHostMount
desiredCsiDriver.Spec.SELinuxMount = cmp.Or(
nodePlugin.EnableSeLinuxHostMount,
desiredCsiDriver.Spec.SELinuxMount,
)
}

ownerObjKey := client.ObjectKeyFromObject(&r.driver)
Expand Down Expand Up @@ -828,6 +830,7 @@ func (r *driverReconcile) reconcileNodePluginDeamonSet() error {
utils.LibModulesVolumeMount,
utils.KeysTmpDirVolumeMount,
utils.PluginDirVolumeMount,
utils.CsiConfigVolumeMount,
utils.PluginMountDirVolumeMount(kubeletDirPath),
utils.PodsMountDirVolumeMount(kubeletDirPath),
}
Expand Down Expand Up @@ -965,6 +968,7 @@ func (r *driverReconcile) reconcileNodePluginDeamonSet() error {
utils.HostRunMountVolume,
utils.LibModulesVolume,
utils.KeysTmpDirVolume,
utils.CsiConfigVolume,
utils.PluginDirVolume(kubeletDirPath, r.driver.Name),
utils.PluginMountDirVolume(kubeletDirPath),
utils.PodsMountDirVolume(kubeletDirPath),
Expand Down
4 changes: 3 additions & 1 deletion internal/utils/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ var PoolTimeContainerArg = "--polltime=60s"
var ExtraCreateMetadataContainerArg = "--extra-create-metadata=true"
var PreventVolumeModeConversionContainerArg = "--prevent-volume-mode-conversion=true"
var HonorPVReclaimPolicyContainerArg = "--feature-gates=HonorPVReclaimPolicy=true"
var TopologyContainerArg = "--feature-gates=Topology=true"

// TODO: the value for this field should be based on "domainlabels" in RBD nodeplugin, so "false" here is temporary.
var TopologyContainerArg = "--feature-gates=Topology=false"
var RecoverVolumeExpansionFailureContainerArg = "--feature-gates=RecoverVolumeExpansionFailure=true"
var EnableVolumeGroupSnapshotsContainerArg = "--enable-volume-group-snapshots=true"
var ForceCephKernelClientContainerArg = "--forcecephkernelclient=true"
Expand Down

0 comments on commit 8230041

Please sign in to comment.