From ecc8de7083c657e3e36db31617dd734bbccbbc8c Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 9 Mar 2021 17:05:00 -0500 Subject: [PATCH 1/2] Revert : conformance: promote container exec probe timeout tests Reverting af3e118b1fc4c90c088da9ffa375087b1dcf947f and 2242d0ffc409594bd4543153ebdba4534c8e83cf as these tests fail when ExecProbeTimeout feature gate is turned on. Signed-off-by: Davanum Srinivas --- test/conformance/testdata/conformance.yaml | 16 ---------------- test/e2e/common/node/container_probe.go | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/test/conformance/testdata/conformance.yaml b/test/conformance/testdata/conformance.yaml index 3dc2ae2d11b..1a6b4abb837 100755 --- a/test/conformance/testdata/conformance.yaml +++ b/test/conformance/testdata/conformance.yaml @@ -1950,14 +1950,6 @@ restart count to 1. release: v1.9 file: test/e2e/common/node/container_probe.go -- testname: Pod liveness probe, container exec timeout, restart - codename: '[sig-node] Probing container should be restarted with an exec liveness - probe with timeout [NodeConformance] [Conformance]' - description: A Pod is created with liveness probe with a Exec action on the Pod. - If the liveness probe call does not return within the timeout specified, liveness - probe MUST restart the Pod. - release: v1.9 - file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, using http endpoint, multiple restarts (slow) codename: '[sig-node] Probing container should have monotonically increasing restart count [NodeConformance] [Conformance]' @@ -1970,14 +1962,6 @@ everytime health check fails, measure upto 5 restart. release: v1.9 file: test/e2e/common/node/container_probe.go -- testname: Pod readiness probe, container exec timeout, not ready - codename: '[sig-node] Probing container should not be ready with an exec readiness - probe timeout [NodeConformance] [Conformance]' - description: A Pod is created with readiness probe with a Exec action on the Pod. - If the readiness probe call does not return within the timeout specified, readiness - probe MUST not be Ready. - release: v1.20 - file: test/e2e/common/node/container_probe.go - testname: Pod readiness probe, with initial delay codename: '[sig-node] Probing container with readiness probe should not be ready before initial delay and never restart [NodeConformance] [Conformance]' diff --git a/test/e2e/common/node/container_probe.go b/test/e2e/common/node/container_probe.go index 20aa75b8e87..239b76aead0 100644 --- a/test/e2e/common/node/container_probe.go +++ b/test/e2e/common/node/container_probe.go @@ -213,7 +213,7 @@ var _ = SIGDescribe("Probing container", func() { Testname: Pod liveness probe, container exec timeout, restart Description: A Pod is created with liveness probe with a Exec action on the Pod. If the liveness probe call does not return within the timeout specified, liveness probe MUST restart the Pod. */ - framework.ConformanceIt("should be restarted with an exec liveness probe with timeout [NodeConformance]", func() { + ginkgo.It("should be restarted with an exec liveness probe with timeout [NodeConformance]", func() { cmd := []string{"/bin/sh", "-c", "sleep 600"} livenessProbe := &v1.Probe{ Handler: execHandler([]string{"/bin/sh", "-c", "sleep 10"}), @@ -230,7 +230,7 @@ var _ = SIGDescribe("Probing container", func() { Testname: Pod readiness probe, container exec timeout, not ready Description: A Pod is created with readiness probe with a Exec action on the Pod. If the readiness probe call does not return within the timeout specified, readiness probe MUST not be Ready. */ - framework.ConformanceIt("should not be ready with an exec readiness probe timeout [NodeConformance]", func() { + ginkgo.It("should not be ready with an exec readiness probe timeout [NodeConformance]", func() { cmd := []string{"/bin/sh", "-c", "sleep 600"} readinessProbe := &v1.Probe{ Handler: execHandler([]string{"/bin/sh", "-c", "sleep 10"}), From 6c76fe9c14a6914e292dcde4c48bce082f0c94d7 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 9 Mar 2021 17:22:10 -0500 Subject: [PATCH 2/2] Skip test when depending on feature Signed-off-by: Davanum Srinivas --- test/e2e/common/node/container_probe.go | 4 ++++ test/e2e/framework/skipper/skipper.go | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/test/e2e/common/node/container_probe.go b/test/e2e/common/node/container_probe.go index 239b76aead0..529e2225e31 100644 --- a/test/e2e/common/node/container_probe.go +++ b/test/e2e/common/node/container_probe.go @@ -32,6 +32,7 @@ import ( "k8s.io/kubernetes/test/e2e/framework" e2eevents "k8s.io/kubernetes/test/e2e/framework/events" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" + e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" testutils "k8s.io/kubernetes/test/utils" "github.com/onsi/ginkgo" @@ -214,6 +215,9 @@ var _ = SIGDescribe("Probing container", func() { Description: A Pod is created with liveness probe with a Exec action on the Pod. If the liveness probe call does not return within the timeout specified, liveness probe MUST restart the Pod. */ ginkgo.It("should be restarted with an exec liveness probe with timeout [NodeConformance]", func() { + // The ExecProbeTimeout feature gate exists to allow backwards-compatibility with pre-1.20 cluster behaviors, where livenessProbe timeouts were ignored + // If ExecProbeTimeout feature gate is disabled, timeout enforcement for exec livenessProbes is disabled, so we should skip this test + e2eskipper.SkipUnlessExecProbeTimeoutEnabled() cmd := []string{"/bin/sh", "-c", "sleep 600"} livenessProbe := &v1.Probe{ Handler: execHandler([]string{"/bin/sh", "-c", "sleep 10"}), diff --git a/test/e2e/framework/skipper/skipper.go b/test/e2e/framework/skipper/skipper.go index 265dd0afa6e..dbe0214a9fa 100644 --- a/test/e2e/framework/skipper/skipper.go +++ b/test/e2e/framework/skipper/skipper.go @@ -46,7 +46,10 @@ import ( // New local storage types to support local storage capacity isolation var localStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIsolation" -var downwardAPIHugePages featuregate.Feature = "DownwardAPIHugePages" +var ( + downwardAPIHugePages featuregate.Feature = "DownwardAPIHugePages" + execProbeTimeout featuregate.Feature = "ExecProbeTimeout" +) func skipInternalf(caller int, format string, args ...interface{}) { msg := fmt.Sprintf(format, args...) @@ -145,6 +148,12 @@ func SkipUnlessDownwardAPIHugePagesEnabled() { } } +func SkipUnlessExecProbeTimeoutEnabled() { + if !utilfeature.DefaultFeatureGate.Enabled(execProbeTimeout) { + skipInternalf(1, "Only supported when %v feature is enabled", execProbeTimeout) + } +} + // SkipIfMissingResource skips if the gvr resource is missing. func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) { resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)