ceph: change external rgw detection, not relying on cluster
After #6217, internal rgw spawning on external cluster was still broken, operator claiming: ``` ceph-object-controller: failed to reconcile failed to create object store deployments: failed to reconcile external endpoint: failed to create or update object store "arch-cloud" endpoint: failed to create endpoint "rook-ceph-rgw-arch-cloud". Endpoints "rook-ceph-rgw-arch-cloud" is invalid: subsets[0]: Required value: must specify `addresses` or `notReadyAddresses` ``` To spawn internal rgw for external cluster, changes detection of what mean 'internal' for rgw and only use the externalRgwEndpoints list for that independently of the status of the cluster Now there is multiple posibilities: * internal cluster and internal rgw pods: "normal case" * external cluster and internal rgw pods: <= now working with the PR * external cluster and external rgw pods: the external case * internal cluster and external rgw pods: <= new case that could exist Signed-off-by: Julien Girardin <jugirardin@free.fr>
This commit is contained in:
1 parent
d643c59d75
commit
d63d9b7d4d
5 files changed
+6
-19
No files matched your search
@@ -20,6 +20,10 @@ func (s *ObjectStoreSpec) IsMultisite() bool {
|
||||
return s.Zone.Name != ""
|
||||
}
|
||||
|
||||
func (s *ObjectStoreSpec) IsExternal() bool {
|
||||
return len(s.Gateway.ExternalRgwEndpoints) != 0
|
||||
}
|
||||
|
||||
func (s *ObjectRealmSpec) IsPullRealm() bool {
|
||||
return s.Pull.Endpoint != ""
|
||||
}
|
||||
@@ -308,7 +308,7 @@ func (r *ReconcileCephObjectStore) reconcileCreateObjectStore(cephObjectStore *c
|
||||
var serviceIP string
|
||||
var err error
|
||||
|
||||
if r.clusterSpec.External.Enable {
|
||||
if cephObjectStore.Spec.IsExternal() {
|
||||
logger.Info("reconciling external object store")
|
||||
|
||||
// RECONCILE SERVICE
|
||||
|
||||
@@ -305,13 +305,6 @@ 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.clusterSpec.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")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ func (c *clusterConfig) generateService(cephObjectStore *cephv1.CephObjectStore)
|
||||
destPort := c.generateLiveProbePort()
|
||||
|
||||
// When the cluster is external we must use the same one as the gateways are listening on
|
||||
if c.clusterSpec.External.Enable {
|
||||
if cephObjectStore.Spec.IsExternal() {
|
||||
destPort.IntVal = cephObjectStore.Spec.Gateway.Port
|
||||
} else {
|
||||
// If the cluster is not external we add the Selector
|
||||
|
||||
@@ -189,16 +189,6 @@ func TestValidateSpec(t *testing.T) {
|
||||
err = r.validateStore(s)
|
||||
assert.Nil(t, err)
|
||||
|
||||
// external with no endpoints but ok since client.admin is used
|
||||
r.clusterSpec.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
|
||||
s.Spec.Gateway.ExternalRgwEndpoints = []v1.EndpointAddress{
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user