Merge pull request #35798 from bprashanth/ing_test

Automatic merge from submit-queue

Clean up static-ip in e2e

I dropped this line: https://github.com/kubernetes/kubernetes/pull/35331/files#diff-5997d488011ead8354bdddfceaf1515dL595, in a previous refactor https://github.com/kubernetes/kubernetes/pull/35331, so we started leaking static ips. This commit adds it back in, along with some debug info if it happens again. Marking p2 since test is currently leaking.
This commit is contained in:
Kubernetes Submit Queue 2016-10-29 04:15:59 -07:00 committed by GitHub
commit 0e46a5b2ec

View File

@ -359,6 +359,14 @@ func (cont *GCEIngressController) deleteAddresses(del bool) string {
if err := gcloudDelete("addresses", cont.staticIPName, cont.cloud.ProjectID, "--global"); err == nil {
cont.staticIPName = ""
}
} else {
e2eIPs := []compute.Address{}
gcloudList("addresses", "e2e-.*", cont.cloud.ProjectID, &e2eIPs)
ips := []string{}
for _, ip := range e2eIPs {
ips = append(ips, ip.Name)
}
framework.Logf("None of the remaining %d static-ips were created by this e2e: %v", len(ips), strings.Join(ips, ", "))
}
return msg
}
@ -605,6 +613,8 @@ func (cont *GCEIngressController) staticIP(name string) string {
}
framework.Failf("Failed to allocated static ip %v: %v", name, err)
}
cont.staticIPName = ip.Name
framework.Logf("Reserved static ip %v: %v", cont.staticIPName, ip.Address)
return ip.Address
}