mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
fix examples/ compilation so that test/ also compiles
fix network-tester cauldron serve_hostnames
This commit is contained in:
parent
c87de85347
commit
82d9ed770c
@ -6,6 +6,7 @@
|
||||
"./third_party",
|
||||
"./plugin",
|
||||
"./test",
|
||||
"./federation"
|
||||
"./federation",
|
||||
"./examples"
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,13 @@
|
||||
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",
|
||||
],
|
||||
)
|
||||
|
31
examples/apiserver/BUILD
Normal file
31
examples/apiserver/BUILD
Normal file
@ -0,0 +1,31 @@
|
||||
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",
|
||||
],
|
||||
)
|
25
examples/apiserver/rest/BUILD
Normal file
25
examples/apiserver/rest/BUILD
Normal file
@ -0,0 +1,25 @@
|
||||
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",
|
||||
],
|
||||
)
|
21
examples/apiserver/server/BUILD
Normal file
21
examples/apiserver/server/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
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",
|
||||
],
|
||||
)
|
15
examples/explorer/BUILD
Normal file
15
examples/explorer/BUILD
Normal file
@ -0,0 +1,15 @@
|
||||
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"],
|
||||
)
|
1
examples/guestbook-go/.gitignore
vendored
Normal file
1
examples/guestbook-go/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
guestbook_bin
|
19
examples/guestbook-go/BUILD
Normal file
19
examples/guestbook-go/BUILD
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
@ -1,23 +0,0 @@
|
||||
# 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 - .
|
@ -1,25 +0,0 @@
|
||||
## 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 -->
|
||||
[]()
|
||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
20
examples/https-nginx/BUILD
Normal file
20
examples/https-nginx/BUILD
Normal file
@ -0,0 +1,20 @@
|
||||
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",
|
||||
],
|
||||
)
|
19
examples/k8petstore/web-server/src/BUILD
Normal file
19
examples/k8petstore/web-server/src/BUILD
Normal file
@ -0,0 +1,19 @@
|
||||
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",
|
||||
],
|
||||
)
|
19
examples/sharing-clusters/BUILD
Normal file
19
examples/sharing-clusters/BUILD
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user