Commit f21cbfa3 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #47143 from ethernetdan/net_pod_use_nodename

Automatic merge from submit-queue (batch tested with PRs 47065, 47157, 47143) Use actual hostname when creating network e2e test pod **What this PR does / why we need it**: This changes a e2e framework network test Pod use the actual hostname value to match the `kubernetes.io/hostname` label in it's `NodeSelector`. Currently it assumes the Node name will match that hostname label which is not true in all environments. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: Fixes coreos/tectonic-installer#1018 **Release note**: ```release-note NONE ```
parents 409165bb fa67fdea
...@@ -308,7 +308,7 @@ func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected ...@@ -308,7 +308,7 @@ func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected
} }
} }
func (config *NetworkingTestConfig) createNetShellPodSpec(podName string, node string) *v1.Pod { func (config *NetworkingTestConfig) createNetShellPodSpec(podName, hostname string) *v1.Pod {
probe := &v1.Probe{ probe := &v1.Probe{
InitialDelaySeconds: 10, InitialDelaySeconds: 10,
TimeoutSeconds: 30, TimeoutSeconds: 30,
...@@ -358,7 +358,7 @@ func (config *NetworkingTestConfig) createNetShellPodSpec(podName string, node s ...@@ -358,7 +358,7 @@ func (config *NetworkingTestConfig) createNetShellPodSpec(podName string, node s
}, },
}, },
NodeSelector: map[string]string{ NodeSelector: map[string]string{
"kubernetes.io/hostname": node, "kubernetes.io/hostname": hostname,
}, },
}, },
} }
...@@ -539,7 +539,8 @@ func (config *NetworkingTestConfig) createNetProxyPods(podName string, selector ...@@ -539,7 +539,8 @@ func (config *NetworkingTestConfig) createNetProxyPods(podName string, selector
createdPods := make([]*v1.Pod, 0, len(nodes)) createdPods := make([]*v1.Pod, 0, len(nodes))
for i, n := range nodes { for i, n := range nodes {
podName := fmt.Sprintf("%s-%d", podName, i) podName := fmt.Sprintf("%s-%d", podName, i)
pod := config.createNetShellPodSpec(podName, n.Name) hostname, _ := n.Labels["kubernetes.io/hostname"]
pod := config.createNetShellPodSpec(podName, hostname)
pod.ObjectMeta.Labels = selector pod.ObjectMeta.Labels = selector
createdPod := config.createPod(pod) createdPod := config.createPod(pod)
createdPods = append(createdPods, createdPod) createdPods = append(createdPods, createdPod)
......
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