diff --git a/pkg/operator/ceph/object/rgw.go b/pkg/operator/ceph/object/rgw.go index 0a094e451..200b1854e 100644 --- a/pkg/operator/ceph/object/rgw.go +++ b/pkg/operator/ceph/object/rgw.go @@ -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") } diff --git a/pkg/operator/ceph/object/spec_test.go b/pkg/operator/ceph/object/spec_test.go index d9c1a6734..2641a953a 100644 --- a/pkg/operator/ceph/object/spec_test.go +++ b/pkg/operator/ceph/object/spec_test.go @@ -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