ceph: ignore MDS_ALL_DOWN during reconciliation
This allows the catch-22 situation where the filesystem cannot be reconciled because there is no MDS but there is no MDS because the operator has not reconciled the filesystem and brought up the MDS pods. Closes #5967, #5846 Signed-off-by: Lalit Maganti <lalitm@google.com>
This commit is contained in:
1 parent
1a5d296e8e
commit
88f16e4980
2 files changed
+95
-1
No files matched your search
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright 2020 The Rook Authors. All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func CreateTestClusterFromStatusDetails(details map[string]cephv1.CephHealthMessage) cephv1.CephCluster {
|
||||
return cephv1.CephCluster{
|
||||
Status: cephv1.ClusterStatus{
|
||||
CephStatus: &cephv1.CephStatus{
|
||||
Details: details,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func TestCanIgnoreHealthErrStatusInReconcile(t *testing.T) {
|
||||
var cluster = CreateTestClusterFromStatusDetails(map[string]cephv1.CephHealthMessage{
|
||||
"MDS_ALL_DOWN": {
|
||||
Severity: "HEALTH_ERR",
|
||||
Message: "MDS_ALL_DOWN",
|
||||
},
|
||||
"TEST_OTHER": {
|
||||
Severity: "HEALTH_WARN",
|
||||
Message: "TEST_OTHER",
|
||||
},
|
||||
"TEST_ANOTHER": {
|
||||
Severity: "HEALTH_OK",
|
||||
Message: "TEST_ANOTHER",
|
||||
},
|
||||
})
|
||||
assert.True(t, canIgnoreHealthErrStatusInReconcile(cluster, "controller"))
|
||||
|
||||
cluster = CreateTestClusterFromStatusDetails(map[string]cephv1.CephHealthMessage{
|
||||
"MDS_ALL_DOWN": {
|
||||
Severity: "HEALTH_ERR",
|
||||
Message: "MDS_ALL_DOWN",
|
||||
},
|
||||
"TEST_UNIGNORABLE": {
|
||||
Severity: "HEALTH_ERR",
|
||||
Message: "TEST_UNIGNORABLE",
|
||||
},
|
||||
})
|
||||
assert.False(t, canIgnoreHealthErrStatusInReconcile(cluster, "controller"))
|
||||
|
||||
cluster = CreateTestClusterFromStatusDetails(map[string]cephv1.CephHealthMessage{
|
||||
"TEST_UNIGNORABLE": {
|
||||
Severity: "HEALTH_ERR",
|
||||
Message: "TEST_UNIGNORABLE",
|
||||
},
|
||||
})
|
||||
assert.False(t, canIgnoreHealthErrStatusInReconcile(cluster, "controller"))
|
||||
}
|
||||
Reference in new issue
Block a user