ceph: allow running rgw in rook with external mode

We don't fail anymore if the cluster is external and user wants to
bootstrap rgw gateways in Kubernertes.

Closes: https://github.com/rook/rook/issues/6217
Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-09-11 09:28:40 +02:00
1 parent 6998d00740
commit a51b76889a
2 files changed
+13 -2

No files matched your search

+1 -1
View File
@@ -361,7 +361,7 @@ func (r *ReconcileCephObjectStore) validateStore(s *cephv1.CephObjectStore) erro
}
// Fail if we detected an external CephCluster CR and the list of endpoints is empty
if r.cephClusterSpec.External.Enable {
if r.cephClusterSpec.External.Enable && r.clusterInfo.CephCred.Username != cephclient.AdminUsername {
if len(s.Spec.Gateway.ExternalRgwEndpoints) == 0 {
return errors.New("ceph cluster is external but externalRgwEndpoints list is empty")
}
+12 -1
View File
@@ -22,6 +22,7 @@ import (
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/daemon/ceph/client"
clienttest "github.com/rook/rook/pkg/daemon/ceph/client/test"
cephconfig "github.com/rook/rook/pkg/operator/ceph/config"
cephtest "github.com/rook/rook/pkg/operator/ceph/test"
@@ -142,6 +143,11 @@ func TestValidateSpec(t *testing.T) {
Enable: false,
},
},
clusterInfo: &client.ClusterInfo{
CephCred: client.CephCred{
Username: "client.admin",
},
},
}
// valid store
@@ -173,9 +179,14 @@ func TestValidateSpec(t *testing.T) {
err = r.validateStore(s)
assert.Nil(t, err)
// external with no endpoints, failure
// external with no endpoints but ok since client.admin is used
r.cephClusterSpec.External.Enable = true
err = r.validateStore(s)
assert.NoError(t, err)
// external with no endpoints, failure
r.clusterInfo.CephCred.Username = "client.external"
err = r.validateStore(s)
assert.NotNil(t, err)
// external with endpoints, success