Ingress test revamp

Fixes a number of harder issues the initial test punted on.
parent c1af9dcb
......@@ -5,7 +5,7 @@ metadata:
namespace: kube-system
labels:
k8s-app: glbc
version: v0.5
version: v0.5.1
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "GLBC"
spec:
......@@ -13,12 +13,12 @@ spec:
replicas: 1
selector:
k8s-app: glbc
version: v0.5
version: v0.5.1
template:
metadata:
labels:
k8s-app: glbc
version: v0.5
version: v0.5.1
name: glbc
kubernetes.io/cluster-service: "true"
spec:
......@@ -45,13 +45,15 @@ spec:
requests:
cpu: 10m
memory: 20Mi
- image: gcr.io/google_containers/glbc:0.5
- image: gcr.io/google_containers/glbc:0.5.1
livenessProbe:
httpGet:
path: /healthz
port: 8081
scheme: HTTP
initialDelaySeconds: 30
# healthz reaches out to GCE
periodSeconds: 30
timeoutSeconds: 5
name: l7-lb-controller
resources:
......
......@@ -206,7 +206,7 @@ GCE_SLOW_TESTS=(
# Tests which are not able to be run in parallel.
GCE_PARALLEL_SKIP_TESTS=(
"GCE\sL7\sLoadBalancer\sController" # TODO: This cannot run in parallel with other L4 tests till quota has been bumped up.
"GCE\sL7\sLoadBalancer\sController" # namespaced watch flakes, issue: #17805
"Nodes\sNetwork"
"MaxPods"
"Resource\susage\sof\ssystem\scontainers"
......
......@@ -112,7 +112,7 @@ readonly KUBE_CLIENT_PLATFORMS=(
# arbitrary, but is a reasonable splitting point for 2015
# laptops-versus-not.
#
# If you are using boot2docker, the following seems to work (note
# If you are using boot2docker, the following seems to work (note
# that 12000 rounds to 11G):
# boot2docker down
# VBoxManage modifyvm boot2docker-vm --memory 12000
......
......@@ -2522,3 +2522,63 @@ func lookForString(expectedString string, timeout time.Duration, fn func() strin
err = fmt.Errorf("Failed to find \"%s\", last result: \"%s\"", expectedString, result)
return
}
// getSvcNodePort returns the node port for the given service:port.
func getSvcNodePort(client *client.Client, ns, name string, svcPort int) (int, error) {
svc, err := client.Services(ns).Get(name)
if err != nil {
return 0, err
}
for _, p := range svc.Spec.Ports {
if p.Port == svcPort {
if p.NodePort != 0 {
return p.NodePort, nil
}
}
}
return 0, fmt.Errorf(
"No node port found for service %v, port %v", name, svcPort)
}
// getNodePortURL returns the url to a nodeport Service.
func getNodePortURL(client *client.Client, ns, name string, svcPort int) (string, error) {
nodePort, err := getSvcNodePort(client, ns, name, svcPort)
if err != nil {
return "", err
}
nodes, err := client.Nodes().List(labels.Everything(), fields.Everything())
if err != nil {
return "", err
}
if len(nodes.Items) == 0 {
return "", fmt.Errorf("Unable to list nodes in cluster.")
}
for _, node := range nodes.Items {
for _, address := range node.Status.Addresses {
if address.Type == api.NodeExternalIP {
if address.Address != "" {
return fmt.Sprintf("http://%v:%v", address.Address, nodePort), nil
}
}
}
}
return "", fmt.Errorf("Failed to find external address for service %v", name)
}
// scaleRCByName scales an RC via ns/name lookup. If replicas == 0 it waits till
// none are running, otherwise it does what a synchronous scale operation would do.
func scaleRCByName(client *client.Client, ns, name string, replicas uint) error {
if err := ScaleRC(client, ns, name, replicas, false); err != nil {
return err
}
rc, err := client.ReplicationControllers(ns).Get(name)
if err != nil {
return err
}
if replicas == 0 {
return waitForRCPodsGone(client, rc)
} else {
return waitForPodsWithLabelRunning(
client, ns, labels.SelectorFromSet(labels.Set(rc.Spec.Selector)))
}
}
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