Commit 82d9ed77 authored by Mike Danese's avatar Mike Danese

fix examples/ compilation so that test/ also compiles

fix network-tester cauldron serve_hostnames
parent c87de853
......@@ -6,6 +6,7 @@
"./third_party",
"./plugin",
"./test",
"./federation"
"./federation",
"./examples"
]
}
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
filegroup(
name = "config",
srcs = glob([
......@@ -17,3 +25,34 @@ filegroup(
"**/*",
]),
)
go_library(
name = "go_default_library",
srcs = ["doc.go"],
tags = ["automanaged"],
)
go_test(
name = "go_default_xtest",
srcs = ["examples_test.go"],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/testapi:go_default_library",
"//pkg/api/validation:go_default_library",
"//pkg/apis/apps:go_default_library",
"//pkg/apis/apps/validation:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//pkg/apis/extensions/validation:go_default_library",
"//pkg/capabilities:go_default_library",
"//pkg/registry/batch/job:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/types:go_default_library",
"//pkg/util/validation/field:go_default_library",
"//pkg/util/yaml:go_default_library",
"//plugin/pkg/scheduler/api:go_default_library",
"//plugin/pkg/scheduler/api/latest:go_default_library",
"//vendor:github.com/golang/glog",
],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["apiserver.go"],
tags = ["automanaged"],
deps = [
"//cmd/libs/go2idl/client-gen/test_apis/testgroup/install:go_default_library",
"//cmd/libs/go2idl/client-gen/test_apis/testgroup/v1:go_default_library",
"//examples/apiserver/rest:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api/rest:go_default_library",
"//pkg/apimachinery/registered:go_default_library",
"//pkg/genericapiserver:go_default_library",
"//pkg/genericapiserver/authorizer:go_default_library",
"//pkg/genericapiserver/options:go_default_library",
"//pkg/genericapiserver/validation:go_default_library",
"//pkg/registry/generic:go_default_library",
"//pkg/runtime/schema:go_default_library",
"//pkg/storage/storagebackend:go_default_library",
"//pkg/util/errors:go_default_library",
"//vendor:github.com/golang/glog",
],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["reststorage.go"],
tags = ["automanaged"],
deps = [
"//cmd/libs/go2idl/client-gen/test_apis/testgroup:go_default_library",
"//pkg/api:go_default_library",
"//pkg/fields:go_default_library",
"//pkg/labels:go_default_library",
"//pkg/registry/generic:go_default_library",
"//pkg/registry/generic/registry:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/storage:go_default_library",
"//pkg/util/validation/field:go_default_library",
],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
)
go_binary(
name = "server",
srcs = ["main.go"],
tags = ["automanaged"],
deps = [
"//examples/apiserver:go_default_library",
"//pkg/util/flag:go_default_library",
"//pkg/util/wait:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:github.com/spf13/pflag",
],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
)
go_binary(
name = "explorer",
srcs = ["explorer.go"],
tags = ["automanaged"],
deps = ["//vendor:github.com/davecgh/go-spew/spew"],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
)
go_binary(
name = "guestbook-go",
srcs = ["main.go"],
tags = ["automanaged"],
deps = [
"//vendor:github.com/codegangsta/negroni",
"//vendor:github.com/gorilla/mux",
"//vendor:github.com/xyproto/simpleredis",
],
)
......@@ -14,10 +14,10 @@
FROM busybox:ubuntu-14.04
ADD ./bin/guestbook /app/guestbook
ADD ./_src/public/index.html /app/public/index.html
ADD ./_src/public/script.js /app/public/script.js
ADD ./_src/public/style.css /app/public/style.css
ADD ./guestbook_bin /app/guestbook
ADD ./public/index.html /app/public/index.html
ADD ./public/script.js /app/public/script.js
ADD ./public/style.css /app/public/style.css
WORKDIR /app
CMD ["./guestbook"]
......
......@@ -23,6 +23,7 @@ release: clean build push clean
# builds a docker image that builds the app and packages it into a minimal docker image
build:
@cp ../../bazel-bin/examples/guestbook-go/guestbook-go guestbook_bin
docker build --rm --force-rm -t ${REGISTRY}/guestbook-builder .
docker run --rm ${REGISTRY}/guestbook-builder | docker build -t "${REGISTRY}/guestbook:${VERSION}" -
......@@ -32,6 +33,7 @@ push:
# remove previous images and containers
clean:
rm -f guestbook_bin
docker rm -f ${REGISTRY}/guestbook-builder 2> /dev/null || true
docker rmi -f ${REGISTRY}/guestbook-builder || true
docker rmi -f "${REGISTRY}/guestbook:${VERSION}" || true
......
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.6.0
ADD . /go/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/_src
WORKDIR /go/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/
RUN cd _src/ && go get && go build -o ../bin/guestbook
RUN cp _src/guestbook/Dockerfile .
CMD tar cvzf - .
## Building and releasing Guestbook Image
This process employs building two docker images, one compiles the source and the other hosts the compiled binaries.
Releasing the image requires that you have access to the docker registry user account which will host the image. You can specify the registry including the user account by setting the environment variable `REGISTRY`.
To build and release the guestbook image:
cd examples/guestbook-go/_src
make release
To build and release the guestbook image with a different registry and version:
VERSION=v4 REGISTRY="docker.io/luebken" make build
If you want to, you can build and push the image step by step:
make clean
make build
make push
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/guestbook-go/_src/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
)
go_binary(
name = "https-nginx",
srcs = ["make_secret.go"],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/install:go_default_library",
"//pkg/apimachinery/registered:go_default_library",
"//pkg/runtime:go_default_library",
],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
)
go_binary(
name = "src",
srcs = ["main.go"],
tags = ["automanaged"],
deps = [
"//vendor:github.com/codegangsta/negroni",
"//vendor:github.com/gorilla/mux",
"//vendor:github.com/xyproto/simpleredis",
],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
)
go_binary(
name = "sharing-clusters",
srcs = ["make_secret.go"],
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/apimachinery/registered:go_default_library",
"//pkg/runtime:go_default_library",
],
)
......@@ -29,13 +29,13 @@ genrule(
],
outs = ["bindata.go"],
cmd = """
$(location //vendor:github.com/jteeuwen/go-bindata/go-bindata) \
$(location //vendor:github.com/jteeuwen/go-bindata/go-bindata_bin) \
-nometadata -o "$(OUTS)" -pkg generated \
-prefix $$(pwd) \
-ignore .jpg -ignore .png -ignore .md \
$(SRCS)
""",
tools = [
"//vendor:github.com/jteeuwen/go-bindata/go-bindata",
"//vendor:github.com/jteeuwen/go-bindata/go-bindata_bin",
],
)
......@@ -12,6 +12,7 @@ go_binary(
srcs = ["webserver.go"],
tags = ["automanaged"],
deps = [
"//pkg/apis/meta/v1:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/util/sets:go_default_library",
......
......@@ -43,6 +43,7 @@ import (
"syscall"
"time"
v1 "k8s.io/kubernetes/pkg/apis/meta/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/util/sets"
......@@ -268,7 +269,7 @@ func contactOthers(state *State) {
//getWebserverEndpoints returns the webserver endpoints as a set of String, each in the format like "http://{ip}:{port}"
func getWebserverEndpoints(client clientset.Interface) sets.String {
endpoints, err := client.Core().Endpoints(*namespace).Get(*service)
endpoints, err := client.Core().Endpoints(*namespace).Get(*service, v1.GetOptions{})
eps := sets.String{}
if err != nil {
state.Logf("Unable to read the endpoints for %v/%v: %v.", *namespace, *service, err)
......
......@@ -14,6 +14,7 @@ go_binary(
deps = [
"//pkg/api:go_default_library",
"//pkg/api/errors:go_default_library",
"//pkg/apis/meta/v1:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/util/intstr:go_default_library",
......
......@@ -32,6 +32,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
v1 "k8s.io/kubernetes/pkg/apis/meta/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/util/intstr"
......@@ -105,7 +106,7 @@ func main() {
} else {
// wait until the namespace disappears
for i := 0; i < int(namespaceDeleteTimeout/time.Second); i++ {
if _, err := client.Core().Namespaces().Get(ns); err != nil {
if _, err := client.Core().Namespaces().Get(ns, v1.GetOptions{}); err != nil {
if errors.IsNotFound(err) {
return
}
......@@ -220,7 +221,7 @@ func main() {
for _, podName := range podNames {
var pod *api.Pod
for start := time.Now(); time.Since(start) < podStartTimeout; time.Sleep(5 * time.Second) {
pod, err = client.Core().Pods(ns).Get(podName)
pod, err = client.Core().Pods(ns).Get(podName, v1.GetOptions{})
if err != nil {
glog.Warningf("Get pod %s/%s failed, ignoring for %v: %v", ns, podName, err, podStartTimeout)
continue
......
......@@ -29,7 +29,6 @@ import (
"path/filepath"
"time"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/v1"
......@@ -40,6 +39,8 @@ import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/intstr"
e2e "k8s.io/kubernetes/test/e2e/framework"
"github.com/golang/glog"
)
var (
......@@ -124,7 +125,7 @@ func main() {
} else {
// wait until the namespace disappears
for i := 0; i < int(namespaceDeleteTimeout/time.Second); i++ {
if _, err := client.Namespaces().Get(ns); err != nil {
if _, err := client.Namespaces().Get(ns, metav1.GetOptions{}); err != nil {
if errors.IsNotFound(err) {
return
}
......@@ -239,7 +240,7 @@ func main() {
for _, podName := range podNames {
var pod *v1.Pod
for start := time.Now(); time.Since(start) < podStartTimeout; time.Sleep(5 * time.Second) {
pod, err = client.Pods(ns).Get(podName)
pod, err = client.Pods(ns).Get(podName, metav1.GetOptions{})
if err != nil {
glog.Warningf("Get pod %s/%s failed, ignoring for %v: %v", ns, podName, err, podStartTimeout)
continue
......
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