operator: improve ProbeHandler error message
This commit implements more diagnostic error for unsccessful
Liveness- and Readiness-Probe of Pods.
Added codes are expected to catch failures of
`ceph status` and `ceph mon_status`, and report it.
Closes: https://github.com/rook/rook/issues/9846
Closes: https://github.com/rook/rook/issues/9852
Signed-off-by: motorailgun <motoi_public@mail.aria-on-the-planet.es>
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
(cherry picked from commit ff0951738f)
This commit is contained in:
1 parent
b61a217452
commit
43cdbeb99f
2 files changed
+19
-3
No files matched your search
@@ -578,12 +578,23 @@ func GenerateLivenessProbeExecDaemon(daemonType, daemonID string) *v1.Probe {
|
||||
//
|
||||
// Example:
|
||||
// env -i sh -c "ceph --admin-daemon /run/ceph/ceph-osd.0.asok status"
|
||||
//
|
||||
// Ceph gives pretty un-diagnostic error message when `ceph status` or `ceph mon_status` command fails.
|
||||
// Add a clear message after Ceph's to help.
|
||||
// ref: https://github.com/rook/rook/issues/9846
|
||||
Command: []string{
|
||||
"env",
|
||||
"-i",
|
||||
"sh",
|
||||
"-c",
|
||||
fmt.Sprintf("ceph --admin-daemon %s %s", confDaemon.buildSocketPath(), confDaemon.buildAdminSocketCommand()),
|
||||
fmt.Sprintf(`outp="$(ceph --admin-daemon %s %s 2>&1)"
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "ceph daemon health check failed with the following output:"
|
||||
echo "$outp" | sed -e 's/^/> /g'
|
||||
exit $rc
|
||||
fi`,
|
||||
confDaemon.buildSocketPath(), confDaemon.buildAdminSocketCommand()),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -154,8 +154,13 @@ func TestGenerateLivenessProbeExecDaemon(t *testing.T) {
|
||||
"-i",
|
||||
"sh",
|
||||
"-c",
|
||||
"ceph --admin-daemon /run/ceph/ceph-osd.0.asok status",
|
||||
}
|
||||
`outp="$(ceph --admin-daemon /run/ceph/ceph-osd.0.asok status 2>&1)"
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "ceph daemon health check failed with the following output:"
|
||||
echo "$outp" | sed -e 's/^/> /g'
|
||||
exit $rc
|
||||
fi`}
|
||||
|
||||
assert.Equal(t, expectedCommand, probe.ProbeHandler.Exec.Command)
|
||||
assert.Equal(t, livenessProbeInitialDelaySeconds, probe.InitialDelaySeconds)
|
||||
|
||||
Reference in new issue
Block a user