operator: monitors should always be allowed to failover
Previously arbiter monitors were allowed to failover in supported versions of Ceph. This behaviour regressed. Since all supported versions of Ceph now support this, we no longer need to check this at all. Signed-off-by: Grant Fleming <gfleming@evroc.com>
This commit is contained in:
2 files changed
-43
No files matched your search
@@ -518,11 +518,6 @@ func (c *Cluster) failMon(monCount, desiredMonCount int, name string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if err := c.allowFailover(name); err != nil {
|
||||
logger.Warningf("aborting mon %q failover. %v", name, err)
|
||||
return false
|
||||
}
|
||||
|
||||
// prevent any voluntary mon drain while failing over
|
||||
if err := c.blockMonDrain(types.NamespacedName{Name: monPDBName, Namespace: c.Namespace}); err != nil {
|
||||
logger.Errorf("failed to block mon drain. %v", err)
|
||||
@@ -540,20 +535,6 @@ func (c *Cluster) failMon(monCount, desiredMonCount int, name string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Cluster) allowFailover(name string) error {
|
||||
if !c.spec.IsStretchCluster() {
|
||||
// always failover if not a stretch cluster
|
||||
return nil
|
||||
}
|
||||
if name != c.arbiterMon {
|
||||
// failover if it's a non-arbiter
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ceph does not support updating the arbiter mon in older versions
|
||||
return errors.Errorf("refusing to failover arbiter mon %q on a stretched cluster", name)
|
||||
}
|
||||
|
||||
func (c *Cluster) removeOrphanMonResources() {
|
||||
if c.spec.Mon.VolumeClaimTemplate == nil {
|
||||
logger.Debug("skipping check for orphaned mon pvcs since using the host path")
|
||||
|
||||
@@ -251,30 +251,6 @@ func TestTrackMonsOutOfQuorum(t *testing.T) {
|
||||
assert.Equal(t, "", cm.Data[opcontroller.OutOfQuorumKey])
|
||||
}
|
||||
|
||||
func TestSkipMonFailover(t *testing.T) {
|
||||
c := New(context.TODO(), &clusterd.Context{}, "ns", cephv1.ClusterSpec{}, nil)
|
||||
c.ClusterInfo = clienttest.CreateTestClusterInfo(1)
|
||||
monName := "arb"
|
||||
|
||||
t.Run("don't skip failover for non-stretch", func(t *testing.T) {
|
||||
assert.NoError(t, c.allowFailover(monName))
|
||||
})
|
||||
|
||||
t.Run("don't skip failover for non-arbiter", func(t *testing.T) {
|
||||
c.spec.Mon.Count = 5
|
||||
c.spec.Mon.StretchCluster = &cephv1.StretchClusterSpec{
|
||||
Zones: []cephv1.MonZoneSpec{
|
||||
{Name: "a"},
|
||||
{Name: "b"},
|
||||
{Name: "c", Arbiter: true},
|
||||
},
|
||||
}
|
||||
|
||||
assert.NoError(t, c.allowFailover(monName))
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestEvictMonOnSameNode(t *testing.T) {
|
||||
ctx := context.TODO()
|
||||
clientset := test.New(t, 1)
|
||||
|
||||
Reference in new issue
Block a user