Merge pull request #8889 from GoogleCloudPlatform/revert-8829-no-ro-nettest

Revert "Revert "Revert "Fix networking test"""
This commit is contained in:
Quinton Hoole 2015-05-27 14:52:47 -07:00
commit ebdccb7b52
4 changed files with 13 additions and 29 deletions

View File

@ -1,7 +1,7 @@
all: push all: push
# Set this to the *next* version to prevent accidentally overwriting the existing image. # Set this to the *next* version to prevent accidentally overwriting the existing image.
TAG = 1.5 TAG = 1.4
webserver: webserver.go webserver: webserver.go
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./webserver.go CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./webserver.go

View File

@ -8,7 +8,7 @@
} }
}, },
"spec": { "spec": {
"replicas": 2, "replicas": 8,
"selector": { "selector": {
"name": "nettest" "name": "nettest"
}, },
@ -22,13 +22,9 @@
"containers": [ "containers": [
{ {
"name": "webserver", "name": "webserver",
"image": "gcr.io/google_containers/nettest:1.4", "image": "gcr.io/google_containers/nettest:1.1",
"imagePullPolicy": "Always", "command": [
"args": [ "-service=nettest"
"-service=nettest",
"-port=8080",
"-namespace=default",
"-peers=2"
], ],
"ports": [ "ports": [
{ {

View File

@ -37,12 +37,13 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"math/rand" "math/rand"
"net"
"net/http" "net/http"
"net/url"
"os" "os"
"sync" "sync"
"time" "time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/GoogleCloudPlatform/kubernetes/pkg/util"
) )
@ -202,25 +203,12 @@ func main() {
// Find all sibling pods in the service and post to their /write handler. // Find all sibling pods in the service and post to their /write handler.
func contactOthers(state *State) { func contactOthers(state *State) {
defer state.doneContactingPeers() defer state.doneContactingPeers()
token, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/token") masterRO := url.URL{
if err != nil { Scheme: "http",
log.Fatalf("Unable to read service account token: %v", err) Host: os.Getenv("KUBERNETES_RO_SERVICE_HOST") + ":" + os.Getenv("KUBERNETES_RO_SERVICE_PORT"),
} Path: "/api/" + latest.Version,
cc := client.Config{
Host: "https://" + net.JoinHostPort(os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT")),
Version: "v1beta3",
BearerToken: string(token),
Insecure: true, // TOOD: package certs along with the token
}
client, err := client.New(&cc)
if err != nil {
log.Fatalf("Unable to create client:\nconfig: %#v\nerror: %v\n", err)
}
if v, err := client.ServerVersion(); err != nil {
log.Fatalf("Unable to get server version: %v\n", err)
} else {
log.Printf("Server version: %#v\n", v)
} }
client := &client.Client{client.NewRESTClient(&masterRO, latest.Version, latest.Codec, false, 5, 10)}
// Do this repeatedly, in case there's some propagation delay with getting // Do this repeatedly, in case there's some propagation delay with getting
// newly started pods into the endpoints list. // newly started pods into the endpoints list.

View File

@ -50,7 +50,7 @@ func LaunchNetTestPodPerNode(f *Framework, nodes *api.NodeList, name string) []s
Containers: []api.Container{ Containers: []api.Container{
{ {
Name: "webserver", Name: "webserver",
Image: "gcr.io/google_containers/nettest:1.4", Image: "gcr.io/google_containers/nettest:1.3",
Args: []string{ Args: []string{
"-service=" + name, "-service=" + name,
//peers >= totalPods should be asserted by the container. //peers >= totalPods should be asserted by the container.