mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #38668 from bprashanth/glbc_version
Automatic merge from submit-queue Bump glbc version, cleanup test Matches https://github.com/kubernetes/ingress/pull/55
This commit is contained in:
commit
a9c5f67509
@ -12,7 +12,7 @@ spec:
|
||||
terminationGracePeriodSeconds: 600
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- image: gcr.io/google_containers/glbc:0.8.0
|
||||
- image: gcr.io/google_containers/glbc:0.9.0
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
@ -43,7 +43,7 @@ spec:
|
||||
# TODO: split this out into args when we no longer need to pipe stdout to a file #6428
|
||||
- sh
|
||||
- -c
|
||||
- '/glbc --default-backend-service=kube-system/default-http-backend --sync-period=60s --running-in-cluster=false --use-real-cloud=true --config-file-path=/etc/gce.conf --healthz-port=8086 1>>/var/log/glbc.log 2>&1'
|
||||
- '/glbc --verbose=true --default-backend-service=kube-system/default-http-backend --sync-period=60s --running-in-cluster=false --use-real-cloud=true --config-file-path=/etc/gce.conf --healthz-port=8086 1>>/var/log/glbc.log 2>&1'
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /etc/gce.conf
|
||||
|
@ -120,7 +120,7 @@ var _ = framework.KubeDescribe("Loadbalancing: L7", func() {
|
||||
|
||||
It("shoud create ingress with given static-ip ", func() {
|
||||
// ip released when the rest of lb resources are deleted in cleanupGCE
|
||||
ip := gceController.staticIP(ns)
|
||||
ip := gceController.createStaticIP(ns)
|
||||
By(fmt.Sprintf("allocated static ip %v: %v through the GCE cloud provider", ns, ip))
|
||||
|
||||
jig.createIngress(filepath.Join(ingressManifestPath, "static-ip"), ns, map[string]string{
|
||||
|
@ -335,6 +335,23 @@ func cleanupGCE(gceController *GCEIngressController) {
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
|
||||
// Static-IP allocated on behalf of the test, never deleted by the
|
||||
// controller. Delete this IP only after the controller has had a chance
|
||||
// to cleanup or it might interfere with the controller, causing it to
|
||||
// throw out confusing events.
|
||||
if ipErr := wait.Poll(5*time.Second, lbCleanupTimeout, func() (bool, error) {
|
||||
if err := gceController.deleteStaticIPs(); err != nil {
|
||||
framework.Logf("Failed to delete static-ip: %v\n", err)
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}); ipErr != nil {
|
||||
// If this is a persistent error, the suite will fail when we run out
|
||||
// of quota anyway.
|
||||
By(fmt.Sprintf("WARNING: possibly leaked static IP: %v\n", ipErr))
|
||||
}
|
||||
|
||||
// Always try to cleanup even if pollErr == nil, because the cleanup
|
||||
// routine also purges old leaked resources based on creation timestamp.
|
||||
if cleanupErr := gceController.Cleanup(true); cleanupErr != nil {
|
||||
@ -342,6 +359,8 @@ func cleanupGCE(gceController *GCEIngressController) {
|
||||
} else {
|
||||
By("No resources leaked.")
|
||||
}
|
||||
|
||||
// Fail if the controller didn't cleanup
|
||||
if pollErr != nil {
|
||||
framework.Failf("L7 controller failed to delete all cloud resources on time. %v", pollErr)
|
||||
}
|
||||
@ -384,20 +403,6 @@ func (cont *GCEIngressController) deleteAddresses(del bool) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the test allocated a static ip, delete that regardless
|
||||
if cont.staticIPName != "" {
|
||||
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
|
||||
}
|
||||
|
||||
@ -664,9 +669,10 @@ func (cont *GCEIngressController) init() {
|
||||
}
|
||||
}
|
||||
|
||||
// staticIP allocates a random static ip with the given name. Returns a string
|
||||
// representation of the ip. Caller is expected to manage cleanup of the ip.
|
||||
func (cont *GCEIngressController) staticIP(name string) string {
|
||||
// createStaticIP allocates a random static ip with the given name. Returns a string
|
||||
// representation of the ip. Caller is expected to manage cleanup of the ip by
|
||||
// invoking deleteStaticIPs.
|
||||
func (cont *GCEIngressController) createStaticIP(name string) string {
|
||||
gceCloud := cont.cloud.Provider.(*gcecloud.GCECloud)
|
||||
ip, err := gceCloud.ReserveGlobalStaticIP(name, "")
|
||||
if err != nil {
|
||||
@ -684,6 +690,27 @@ func (cont *GCEIngressController) staticIP(name string) string {
|
||||
return ip.Address
|
||||
}
|
||||
|
||||
// deleteStaticIPs delets all static-ips allocated through calls to
|
||||
// createStaticIP.
|
||||
func (cont *GCEIngressController) deleteStaticIPs() error {
|
||||
if cont.staticIPName != "" {
|
||||
if err := gcloudDelete("addresses", cont.staticIPName, cont.cloud.ProjectID, "--global"); err == nil {
|
||||
cont.staticIPName = ""
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
} 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 nil
|
||||
}
|
||||
|
||||
// gcloudList unmarshals json output of gcloud into given out interface.
|
||||
func gcloudList(resource, regex, project string, out interface{}) {
|
||||
// gcloud prints a message to stderr if it has an available update
|
||||
|
Loading…
Reference in New Issue
Block a user