ceph: run self-signed cert creation with timeout

fixes: #2784

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
Noah Watkins committed 2019-05-06 10:10:05 -07:00
1 parent c2dbb93096
commit e33eb98047
3 files changed
+13 -3

No files matched your search

+2 -2
View File
@@ -39,7 +39,7 @@ const (
Kubectl = "kubectl"
// CrushTool is the name of the CLI tool for 'crushtool'
CrushTool = "crushtool"
cmdExecuteTimeout = 1 * time.Minute
CmdExecuteTimeout = 1 * time.Minute
cephConnectionTimeout = "15" // in seconds
)
@@ -169,7 +169,7 @@ func (c *CephToolCommand) RunWithTimeout(timeout time.Duration) ([]byte, error)
// configured its arguments. It is future work to integrate this case into the
// generalization.
func ExecuteRBDCommandWithTimeout(context *clusterd.Context, clusterName string, args []string) (string, error) {
output, err := context.Executor.ExecuteCommandWithTimeout(false, cmdExecuteTimeout, "", RBDTool, args...)
output, err := context.Executor.ExecuteCommandWithTimeout(false, CmdExecuteTimeout, "", RBDTool, args...)
return output, err
}
+6 -1
View File
@@ -18,6 +18,7 @@ limitations under the License.
package mgr
import (
"context"
"fmt"
"math/rand"
"os/exec"
@@ -185,7 +186,11 @@ func (c *Cluster) createSelfSignedCert() (bool, error) {
// retry a few times in the case that the mgr module is not ready to accept commands
for i := 0; i < 5; i++ {
_, err := client.NewCephCommand(c.context, c.Namespace, args).Run()
_, err := client.NewCephCommand(c.context, c.Namespace, args).RunWithTimeout(client.CmdExecuteTimeout)
if err == context.DeadlineExceeded {
logger.Infof("cert creation timed out. trying again..")
continue
}
if err != nil {
exitCode, parsed := c.exitCode(err)
if parsed {
@@ -18,6 +18,7 @@ package mgr
import (
"fmt"
"testing"
"time"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
@@ -93,6 +94,10 @@ func TestStartSecureDashboard(t *testing.T) {
return "", nil
},
}
executor.MockExecuteCommandWithOutputFileTimeout = func(debug bool, timeout time.Duration, actionName string, command, outfileArg string, arg ...string) (string, error) {
return executor.MockExecuteCommandWithOutputFile(debug, actionName, command, outfileArg, arg...)
}
clusterInfo := &cephconfig.ClusterInfo{
CephVersion: cephver.Mimic,
}