From d2d1da5970268a71ecee76215bc29b74ae77fff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 1 Oct 2020 11:28:56 +0200 Subject: [PATCH] ceph: fix obc upgrade from 1.3 to 1.4 external cluster MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the 1.3 cycle, we had implemented support for OBC external mode through an Endpoint in the StorageClass parameter. In 1.4, this is not the case anymore as we directly use the CephObjectStore external mode. However, we must maintain backward compatibility with the cluster using the Endpoint and not fail the upgrade. Thus checking for a CephObjectStore is invalid and should not always be assumed, now if we detect an Endpoint we return a simple context which fixes the upgrade. Signed-off-by: Sébastien Han --- .../ceph/object/bucket/provisioner.go | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkg/operator/ceph/object/bucket/provisioner.go b/pkg/operator/ceph/object/bucket/provisioner.go index 8175c321c..348bcce97 100644 --- a/pkg/operator/ceph/object/bucket/provisioner.go +++ b/pkg/operator/ceph/object/bucket/provisioner.go @@ -402,14 +402,23 @@ func (p *Provisioner) setObjectContext() error { return errors.Errorf(msg, "name") } - store, err := p.getObjectStore() - if err != nil { - return errors.Wrap(err, "failed to get cephObjectStore") - } + // We don't need the CephObjectStore if an endpoint is provided + // In 1.3, OBC external is working with an Endpoint (from the SC param) and in 1.4 we have a CephObjectStore but we must keep backward compatibility + // In 1.4, the Endpoint from the SC is not expected and never used so we will enter the "else" condition which gets a CephObjectStore and it is present + if p.endpoint != "" { + p.objectContext = cephObject.NewContext(p.context, p.clusterInfo, p.objectStoreName) + } else { + // Get CephObjectStore + store, err := p.getObjectStore() + if err != nil { + return errors.Wrap(err, "failed to get cephObjectStore") + } - p.objectContext, err = cephObject.NewMultisiteContext(p.context, p.clusterInfo, store) - if err != nil { - return errors.Wrapf(err, "failed to set multisite on provisioner's objectContext") + // Set multisite context + p.objectContext, err = cephObject.NewMultisiteContext(p.context, p.clusterInfo, store) + if err != nil { + return errors.Wrap(err, "failed to set multisite on provisioner's objectContext") + } } return nil