Merge pull request #16407 from rook/mergify/bp/release-1.18/pr-16405

csi: Set csi operator as default if no settings found (backport #16405)
This commit is contained in:
subham rai authored and GitHub committed 2025-08-29 14:50:51 +05:30
commit ab01227c55
3 files changed
+5 -14

No files matched your search

+1 -1
View File
@@ -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'")
}
+3 -12
View File
@@ -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)
})
}
+1 -1
View File
@@ -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 {