Unverified Commit 9bdc86ff authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #59222 from MrHohn/e2e-ingress-healthcheck-fix

Automatic merge from submit-queue. 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>. [e2e ingress-gce] Retrieve the correct health check resource **What this PR does / why we need it**: Previously the test retrieves a random health check resource and assumes it belongs to the test ingress, which is wrong when multiple ingress tests are running simultaneously. Example failure: https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-ingress-gce-e2e/533 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #NONE **Special notes for your reviewer**: /assign @rramkumar1 @nicksardo **Release note**: ```release-note NONE ```
parents 49bf4421 f5bb5234
...@@ -258,29 +258,27 @@ var _ = SIGDescribe("Loadbalancing: L7", func() { ...@@ -258,29 +258,27 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
// Get cluster UID. // Get cluster UID.
clusterID, err := framework.GetClusterID(f.ClientSet) clusterID, err := framework.GetClusterID(f.ClientSet)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
// Get default backend nodeport. // Get the related nodeports.
defaultBackendNodePort, err := jig.GetDefaultBackendNodePort() nodePorts := jig.GetIngressNodePorts(false)
Expect(err).NotTo(HaveOccurred()) Expect(len(nodePorts)).ToNot(Equal(0))
// Filter health check using cluster UID as the suffix. // Filter health check using cluster UID as the suffix.
By("Retrieving relevant health check resources from GCE.") By("Retrieving relevant health check resources from GCE.")
gceCloud := gceController.Cloud.Provider.(*gcecloud.GCECloud) gceCloud := gceController.Cloud.Provider.(*gcecloud.GCECloud)
hcs, err := gceCloud.ListHealthChecks() hcs, err := gceCloud.ListHealthChecks()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
ingressHCs := []*compute.HealthCheck{} var hcToChange *compute.HealthCheck
for _, hc := range hcs { for _, hc := range hcs {
if strings.HasSuffix(hc.Name, clusterID) { if strings.HasSuffix(hc.Name, clusterID) {
Expect(hc.HttpHealthCheck).ToNot(Equal(nil)) Expect(hc.HttpHealthCheck).NotTo(BeNil())
// Skip the default backend healthcheck as that shouldn't be customized. if fmt.Sprintf("%d", hc.HttpHealthCheck.Port) == nodePorts[0] {
if hc.HttpHealthCheck.Port == int64(defaultBackendNodePort) { hcToChange = hc
continue break
} }
ingressHCs = append(ingressHCs, hc)
} }
} }
Expect(hcToChange).NotTo(BeNil())
Expect(len(ingressHCs)).ToNot(Equal(0))
hcToChange := ingressHCs[0]
By(fmt.Sprintf("Modifying health check %v without involving ingress.", hcToChange.Name)) By(fmt.Sprintf("Modifying health check %v without involving ingress.", hcToChange.Name))
// Change timeout from 60s to 25s. // Change timeout from 60s to 25s.
hcToChange.TimeoutSec = 25 hcToChange.TimeoutSec = 25
......
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