csi: create cephconnection cr with cluster namespace name
The cephconnection CR expects to be created with the name of
the namespace where the cephcluster CR is found, so the CSI
driver can find the cluster when provisioning the volume.
Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
(cherry picked from commit 134e27e353)
This commit is contained in:
1 parent
943ab71cfa
commit
dac320bc20
2 files changed
+5
-5
No files matched your search
@@ -32,11 +32,11 @@ import (
|
||||
)
|
||||
|
||||
func CreateUpdateCephConnection(c client.Client, clusterInfo *cephclient.ClusterInfo, clusterSpec cephv1.ClusterSpec) error {
|
||||
logger.Infof("Configuring ceph connection CR %q in namespace %q", clusterInfo.NamespacedName().Name, clusterInfo.NamespacedName().Namespace)
|
||||
// Create a cephconnection CR in the namespace of the operator, with the namespace of the cephcluster CR
|
||||
csiCephConnection := &csiopv1.CephConnection{}
|
||||
|
||||
csiCephConnection.Name = clusterInfo.NamespacedName().Name
|
||||
csiCephConnection.Name = clusterInfo.NamespacedName().Namespace
|
||||
csiCephConnection.Namespace = os.Getenv(k8sutil.PodNamespaceEnvVar)
|
||||
logger.Infof("Configuring ceph connection CR %q in namespace %q", csiCephConnection.Name, csiCephConnection.Namespace)
|
||||
|
||||
spec, err := generateCephConnSpec(c, clusterInfo, csiCephConnection.Spec, clusterSpec)
|
||||
if err != nil {
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestCreateUpdateCephConnection(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
// When no RBDMirror is created
|
||||
err = cl.Get(context.TODO(), types.NamespacedName{Name: c.NamespacedName().Name, Namespace: c.NamespacedName().Namespace}, csiCephConnection)
|
||||
err = cl.Get(context.TODO(), types.NamespacedName{Name: ns, Namespace: ns}, csiCephConnection)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, csiCephConnection.Spec.RbdMirrorDaemonCount, 0)
|
||||
|
||||
@@ -96,7 +96,7 @@ func TestCreateUpdateCephConnection(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
// When RBDMirror is created
|
||||
err = cl.Get(context.TODO(), types.NamespacedName{Name: c.NamespacedName().Name, Namespace: c.NamespacedName().Namespace}, csiCephConnection)
|
||||
err = cl.Get(context.TODO(), types.NamespacedName{Name: ns, Namespace: ns}, csiCephConnection)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, csiCephConnection.Spec.RbdMirrorDaemonCount)
|
||||
}
|
||||
Reference in new issue
Block a user