From 904881bd740d979899d8c82d595381c9cb0dab4b Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Thu, 28 Aug 2025 12:26:28 -0600 Subject: [PATCH 1/2] csi: set csi operator as default if no settings found If the ROOK_USE_CSI_OPERATOR setting is not found in the rook-ceph-operator-config configmap, the default now is to use the csi operator instead of the previous csi driver Signed-off-by: Travis Nielsen (cherry picked from commit b2b28e1280e2a08c87d52b913891e7f4c02e8163) --- pkg/operator/ceph/csi/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/operator/ceph/csi/controller.go b/pkg/operator/ceph/csi/controller.go index 9b0a5fdec..05085b4ac 100644 --- a/pkg/operator/ceph/csi/controller.go +++ b/pkg/operator/ceph/csi/controller.go @@ -166,7 +166,7 @@ func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, e return opcontroller.ImmediateRetryResult, errors.Wrap(err, "failed to apply operator settings configmap") } - enableCSIOperator, err = strconv.ParseBool(k8sutil.GetOperatorSetting("ROOK_USE_CSI_OPERATOR", "false")) + enableCSIOperator, err = strconv.ParseBool(k8sutil.GetOperatorSetting("ROOK_USE_CSI_OPERATOR", "true")) if err != nil { return reconcileResult, errors.Wrap(err, "unable to parse value for 'ROOK_USE_CSI_OPERATOR'") } From 7c2347b30c3fa323393dce73dcd6c907e1401989 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Thu, 28 Aug 2025 12:27:32 -0600 Subject: [PATCH 2/2] csi: cleanup formatting of csi log statement The csi key creation was not correctly logging params Signed-off-by: Travis Nielsen (cherry picked from commit 0a9262e73bf2b284c31f274b8e14763311da1fbd) --- pkg/operator/ceph/csi/controller_test.go | 15 +++------------ pkg/operator/ceph/csi/secrets.go | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/pkg/operator/ceph/csi/controller_test.go b/pkg/operator/ceph/csi/controller_test.go index 2df439cef..9fe0fb5cf 100644 --- a/pkg/operator/ceph/csi/controller_test.go +++ b/pkg/operator/ceph/csi/controller_test.go @@ -21,6 +21,7 @@ import ( "os" "testing" + csiopv1 "github.com/ceph/ceph-csi-operator/api/v1" "github.com/coreos/pkg/capnslog" cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" rookclient "github.com/rook/rook/pkg/client/clientset/versioned/fake" @@ -89,7 +90,8 @@ func TestCephCSIController(t *testing.T) { assert.NoError(t, err) // Register operator types with the runtime scheme. s := scheme.Scheme - s.AddKnownTypes(cephv1.SchemeGroupVersion, &v1.ConfigMap{}, &v1.ConfigMapList{}, &cephv1.CephClusterList{}) + s.AddKnownTypes(cephv1.SchemeGroupVersion, &v1.ConfigMap{}, &v1.ConfigMapList{}, &cephv1.CephClusterList{}, + &csiopv1.CephConnection{}, &csiopv1.ClientProfile{}, &csiopv1.OperatorConfig{}, &csiopv1.Driver{}) // Create a fake client to mock API calls. cl := fake.NewClientBuilder().WithScheme(s).Build() @@ -179,10 +181,6 @@ func TestCephCSIController(t *testing.T) { assert.NoError(t, err) assert.False(t, res.Requeue) - ds, err := c.Clientset.AppsV1().DaemonSets(namespace).List(ctx, metav1.ListOptions{}) - assert.NoError(t, err) - assert.Equal(t, 2, len(ds.Items), ds) - assert.Equal(t, []string{namespace}, saveCSIDriverOptionsCalledForClusterNS) }) @@ -261,13 +259,6 @@ func TestCephCSIController(t *testing.T) { assert.NoError(t, err) assert.False(t, res.Requeue) - ds, err := c.Clientset.AppsV1().DaemonSets(namespace).List(ctx, metav1.ListOptions{}) - assert.NoError(t, err) - assert.Equal(t, 2, len(ds.Items), ds) - assert.Equal(t, "csi-cephfsplugin", ds.Items[0].Name) - assert.Equal(t, "csi-rbdplugin", ds.Items[1].Name) - assert.Equal(t, ``, ds.Items[1].Spec.Template.Annotations["k8s.v1.cni.cncf.io/networks"], ds.Items[1].Spec.Template.Annotations) - assert.Equal(t, []string{namespace}, saveCSIDriverOptionsCalledForClusterNS) }) } diff --git a/pkg/operator/ceph/csi/secrets.go b/pkg/operator/ceph/csi/secrets.go index a09f04362..d6c183710 100644 --- a/pkg/operator/ceph/csi/secrets.go +++ b/pkg/operator/ceph/csi/secrets.go @@ -241,7 +241,7 @@ func CreateCSISecrets(context *clusterd.Context, clusterInfo *client.ClusterInfo } k := keyring.GetSecretStore(context, clusterInfo, clusterInfo.OwnerInfo) - logger.Info("getting CephCluster %s during CSI key creation in namespace %s", clusterNamespaced.Name, clusterNamespaced.Namespace) + logger.Infof("getting CephCluster %s during CSI key creation in namespace %s", clusterNamespaced.Name, clusterNamespaced.Namespace) cephCluster := &cephv1.CephCluster{} if err := context.Client.Get(clusterInfo.Context, clusterNamespaced, cephCluster); err != nil {