Merge pull request #54686 from m1093782566/gce-alpha-fail

Automatic merge from submit-queue (batch tested with PRs 54572, 54686). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix service session affinity e2e failure cases

**What this PR does / why we need it**:

Fix service session affinity e2e failure cases - debuging...

**Which issue this PR fixes**:

xref #54571 #54524

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/sig network
This commit is contained in:
Kubernetes Submit Queue
2017-10-30 21:45:17 -07:00
committed by GitHub
2 changed files with 22 additions and 34 deletions

View File

@@ -226,8 +226,8 @@ func (config *NetworkingTestConfig) GetEndpointsFromTestContainer(protocol, targ
// GetEndpointsFromContainer executes a curl via kubectl exec in a test container,
// which might then translate to a tcp or udp request based on the protocol argument
// in the url.
// - tries is the maximum number of curl attempts. If this many attempts pass and
// in the url. It returns all different endpoints from multiple retries.
// - tries is the number of curl attempts. If this many attempts pass and
// we don't see any endpoints, the test fails.
func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containerIP, targetIP string, containerHttpPort, targetPort, tries int) (sets.String, error) {
cmd := fmt.Sprintf("curl -q -s 'http://%s:%d/dial?request=hostName&protocol=%s&host=%s&port=%d&tries=1'",
@@ -247,7 +247,7 @@ func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containe
// we confirm unreachability.
Logf("Failed to execute %q: %v, stdout: %q, stderr: %q", cmd, err, stdout, stderr)
} else {
Logf("maxTries: %d, in try: %d, stdout: %v, stderr: %v", tries, i, stdout, stderr)
Logf("Tries: %d, in try: %d, stdout: %v, stderr: %v, command run in: %#v", tries, i, stdout, stderr, config.HostTestContainerPod)
var output map[string][]string
if err := json.Unmarshal([]byte(stdout), &output); err != nil {
Logf("WARNING: Failed to unmarshal curl response. Cmd %v run in %v, output: %s, err: %v",
@@ -261,15 +261,11 @@ func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containe
eps.Insert(trimmed)
}
}
// Return immediately when we successfully fetch endpoints
if len(eps) > 0 {
return eps, nil
}
// TODO: get rid of this delay #36281
time.Sleep(hitEndpointRetryDelay)
}
}
return nil, fmt.Errorf("error getting endpoints:\nTries %d\nCommand %v\n", tries, cmd)
return eps, nil
}
// DialFromNode executes a tcp or udp request based on protocol via kubectl exec