Commit f0fc0e15 authored by Jan Safranek's avatar Jan Safranek

Add pod cleanup timeout

After client pod is stopped we need to wait for a while for kubelet to unmount and clean up the client pod before we can destroy the server pod. Killing e.g. iSCSI server too early may result in stale attached device that cannot be removed.
parent 9db14771
...@@ -67,6 +67,10 @@ const ( ...@@ -67,6 +67,10 @@ const (
// Waiting period for volume server (Ceph, ...) to initialize itself. // Waiting period for volume server (Ceph, ...) to initialize itself.
VolumeServerPodStartupSleep = 20 * time.Second VolumeServerPodStartupSleep = 20 * time.Second
// Waiting period for pod to be cleaned up and unmount its volumes so we
// don't tear down containers with NFS/Ceph/Gluster server too early.
PodCleanupTimeout = 20 * time.Second
) )
// Configuration of one tests. The test consist of: // Configuration of one tests. The test consist of:
...@@ -351,8 +355,8 @@ func VolumeTestCleanup(f *Framework, config VolumeTestConfig) { ...@@ -351,8 +355,8 @@ func VolumeTestCleanup(f *Framework, config VolumeTestConfig) {
} }
// See issue #24100. // See issue #24100.
// Prevent umount errors by making sure making sure the client pod exits cleanly *before* the volume server pod exits. // Prevent umount errors by making sure making sure the client pod exits cleanly *before* the volume server pod exits.
By("sleeping a bit so client can stop and unmount") By("sleeping a bit so kubelet can unmount and detach the volume")
time.Sleep(20 * time.Second) time.Sleep(PodCleanupTimeout)
err = podClient.Delete(config.Prefix+"-server", nil) err = podClient.Delete(config.Prefix+"-server", nil)
if err != nil { if err != nil {
......
...@@ -33,6 +33,7 @@ import ( ...@@ -33,6 +33,7 @@ import (
"path" "path"
"strconv" "strconv"
"strings" "strings"
"time"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
...@@ -209,6 +210,9 @@ func testVolumeIO(f *framework.Framework, cs clientset.Interface, config framewo ...@@ -209,6 +210,9 @@ func testVolumeIO(f *framework.Framework, cs clientset.Interface, config framewo
if err == nil { // delete err is returned if err is not set if err == nil { // delete err is returned if err is not set
err = e err = e
} }
} else {
framework.Logf("sleeping a bit so kubelet can unmount and detach the volume")
time.Sleep(framework.PodCleanupTimeout)
} }
}() }()
......
...@@ -261,7 +261,7 @@ var _ = utils.SIGDescribe("Volumes", func() { ...@@ -261,7 +261,7 @@ var _ = utils.SIGDescribe("Volumes", func() {
config := framework.VolumeTestConfig{ config := framework.VolumeTestConfig{
Namespace: namespace.Name, Namespace: namespace.Name,
Prefix: "cephfs", Prefix: "cephfs",
ServerImage: imageutils.GetE2EImage(imageutils.VolumeCephServer), ServerImage: imageutils.GetE2EImage(imageutils.VolumeRBDServer),
ServerPorts: []int{6789}, ServerPorts: []int{6789},
} }
......
...@@ -96,7 +96,6 @@ var ( ...@@ -96,7 +96,6 @@ var (
VolumeNFSServer = ImageConfig{gcRegistry, "volume-nfs", "0.8", false} VolumeNFSServer = ImageConfig{gcRegistry, "volume-nfs", "0.8", false}
VolumeISCSIServer = ImageConfig{gcRegistry, "volume-iscsi", "0.2", false} VolumeISCSIServer = ImageConfig{gcRegistry, "volume-iscsi", "0.2", false}
VolumeGlusterServer = ImageConfig{gcRegistry, "volume-gluster", "0.2", false} VolumeGlusterServer = ImageConfig{gcRegistry, "volume-gluster", "0.2", false}
VolumeCephServer = ImageConfig{gcRegistry, "volume-ceph", "0.1", false}
VolumeRBDServer = ImageConfig{gcRegistry, "volume-rbd", "0.2", false} VolumeRBDServer = ImageConfig{gcRegistry, "volume-rbd", "0.2", false}
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment