mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-27 13:15:36 +00:00
fix reuse nodePort issue
This commit is contained in:
@@ -555,6 +555,25 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
|
||||
By("checking the result")
|
||||
forEachReplicationController(c, ns, "app", "redis", validateReplicationControllerConfiguration)
|
||||
})
|
||||
It("should reuse nodePort when apply to an existing SVC", func() {
|
||||
mkpath := func(file string) string {
|
||||
return filepath.Join(framework.TestContext.RepoRoot, "examples/guestbook-go", file)
|
||||
}
|
||||
serviceJson := mkpath("redis-master-service.json")
|
||||
nsFlag := fmt.Sprintf("--namespace=%v", ns)
|
||||
By("creating Redis SVC")
|
||||
framework.RunKubectlOrDie("create", "-f", serviceJson, nsFlag)
|
||||
By("getting the original nodePort")
|
||||
originalNodePort := framework.RunKubectlOrDie("get", "service", "redis-master", nsFlag, "-o", "jsonpath={.spec.ports[0].nodePort}")
|
||||
By("applying the same configuration")
|
||||
framework.RunKubectlOrDie("apply", "-f", serviceJson, nsFlag)
|
||||
By("getting the nodePort after applying configuration")
|
||||
currentNodePort := framework.RunKubectlOrDie("get", "service", "redis-master", nsFlag, "-o", "jsonpath={.spec.ports[0].nodePort}")
|
||||
By("checking the result")
|
||||
if originalNodePort != currentNodePort {
|
||||
framework.Failf("nodePort should keep the same")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
framework.KubeDescribe("Kubectl cluster-info", func() {
|
||||
|
Reference in New Issue
Block a user