tests: Spawn poststart / prestop pods on the same node as the https pod

In the PR https://github.com/kubernetes/kubernetes/pull/86139, two more lifecycle hook tests (poststart / prestop)
were added using HTTPS. They are similar with the existing HTTP tests.

However, this causes failures on Windows due to how networking
works there. We previously fixed this in the HTTP tests via f9e4a015e2.

This commit applies the same fix on the lifecycle hook HTTPS tests.

Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
This commit is contained in:
Ionut Balutoiu 2022-11-03 17:33:31 +02:00
parent f536b3cc4f
commit f092343300

View File

@ -184,7 +184,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() {
/*
Release : v1.23
Testname: Pod Lifecycle, poststart https hook
Description: When a post-start handler is specified in the container lifecycle using a 'HttpGet' action, then the handler MUST be invoked before the container is terminated. A server pod is created that will serve https requests, create a second pod with a container lifecycle specifying a post-start that invokes the server pod to validate that the post-start is executed.
Description: When a post-start handler is specified in the container lifecycle using a 'HttpGet' action, then the handler MUST be invoked before the container is terminated. A server pod is created that will serve https requests, create a second pod on the same node with a container lifecycle specifying a post-start that invokes the server pod to validate that the post-start is executed.
*/
ginkgo.It("should execute poststart https hook properly [MinimumKubeletVersion:1.23] [NodeConformance]", func() {
lifecycle := &v1.Lifecycle{
@ -198,6 +198,10 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() {
},
}
podWithHook := getPodWithHook("pod-with-poststart-https-hook", imageutils.GetPauseImageName(), lifecycle)
// make sure we spawn the test pod on the same node as the webserver.
nodeSelection := e2epod.NodeSelection{}
e2epod.SetAffinity(&nodeSelection, targetNode)
e2epod.SetNodeSelection(&podWithHook.Spec, nodeSelection)
testPodWithHook(podWithHook)
})
/*
@ -225,7 +229,7 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() {
/*
Release : v1.23
Testname: Pod Lifecycle, prestop https hook
Description: When a pre-stop handler is specified in the container lifecycle using a 'HttpGet' action, then the handler MUST be invoked before the container is terminated. A server pod is created that will serve https requests, create a second pod with a container lifecycle specifying a pre-stop that invokes the server pod to validate that the pre-stop is executed.
Description: When a pre-stop handler is specified in the container lifecycle using a 'HttpGet' action, then the handler MUST be invoked before the container is terminated. A server pod is created that will serve https requests, create a second pod on the same node with a container lifecycle specifying a pre-stop that invokes the server pod to validate that the pre-stop is executed.
*/
ginkgo.It("should execute prestop https hook properly [MinimumKubeletVersion:1.23] [NodeConformance]", func() {
lifecycle := &v1.Lifecycle{
@ -239,6 +243,10 @@ var _ = SIGDescribe("Container Lifecycle Hook", func() {
},
}
podWithHook := getPodWithHook("pod-with-prestop-https-hook", imageutils.GetPauseImageName(), lifecycle)
// make sure we spawn the test pod on the same node as the webserver.
nodeSelection := e2epod.NodeSelection{}
e2epod.SetAffinity(&nodeSelection, targetNode)
e2epod.SetNodeSelection(&podWithHook.Spec, nodeSelection)
testPodWithHook(podWithHook)
})
})