Merge pull request #97809 from jayunit100/fix_node_port_windows

Fix node port tests windows nodeSelector metadata
This commit is contained in:
Kubernetes Prow Robot 2021-01-08 10:34:29 -08:00 committed by GitHub
commit 04e3106b1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,16 +56,26 @@ var _ = SIGDescribe("Services", func() {
nodePort := int(svc.Spec.Ports[0].NodePort)
ginkgo.By("creating Pod to be part of service " + serviceName)
_, err = jig.Run(nil)
// tweak the Jig to use windows...
windowsNodeSelectorTweak := func(rc *v1.ReplicationController) {
rc.Spec.Template.Spec.NodeSelector = map[string]string{
"kubernetes.io/os": "windows",
}
}
_, err = jig.Run(windowsNodeSelectorTweak)
framework.ExpectNoError(err)
//using hybrid_network methods
ginkgo.By("creating Windows testing Pod")
windowsPod := createTestPod(f, windowsBusyBoximage, windowsOS)
windowsPod = f.PodClient().CreateSync(windowsPod)
testPod := createTestPod(f, windowsBusyBoximage, windowsOS)
testPod = f.PodClient().CreateSync(testPod)
ginkgo.By("verifying that pod has the correct nodeSelector")
// Admission controllers may sometimes do the wrong thing
framework.ExpectEqual(testPod.Spec.NodeSelector["kubernetes.io/os"], "windows")
ginkgo.By(fmt.Sprintf("checking connectivity Pod to curl http://%s:%d", nodeIP, nodePort))
assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck(fmt.Sprintf("http://%s:%d", nodeIP, nodePort)))
assertConsistentConnectivity(f, testPod.ObjectMeta.Name, windowsOS, windowsCheck(fmt.Sprintf("http://%s:%d", nodeIP, nodePort)))
})