Add glide.yaml and vendor deps
This commit is contained in:
parent
db918f12ad
commit
5b3d5e81bd
18880 changed files with 5166045 additions and 1 deletions
317
vendor/k8s.io/kubernetes/hack/.linted_packages
generated
vendored
Normal file
317
vendor/k8s.io/kubernetes/hack/.linted_packages
generated
vendored
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
cluster/addons/fluentd-elasticsearch/es-image
|
||||
cluster/images/etcd/attachlease
|
||||
cluster/images/etcd/rollback
|
||||
cmd/clicheck
|
||||
cmd/gendocs
|
||||
cmd/genkubedocs
|
||||
cmd/genman
|
||||
cmd/genswaggertypedocs
|
||||
cmd/genyaml
|
||||
cmd/integration
|
||||
cmd/kube-apiserver
|
||||
cmd/kube-apiserver/app
|
||||
cmd/kube-apiserver/app/options
|
||||
cmd/kube-controller-manager
|
||||
cmd/kube-controller-manager/app/options
|
||||
cmd/kube-discovery
|
||||
cmd/kube-dns
|
||||
cmd/kube-proxy
|
||||
cmd/kubeadm
|
||||
cmd/kubeadm
|
||||
cmd/kubeadm/app/apis/kubeadm/install
|
||||
cmd/kubectl
|
||||
cmd/kubelet
|
||||
cmd/kubernetes-discovery
|
||||
cmd/libs/go2idl/client-gen
|
||||
cmd/libs/go2idl/client-gen/generators
|
||||
cmd/libs/go2idl/client-gen/test_apis/testgroup/install
|
||||
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/internalversion
|
||||
cmd/libs/go2idl/conversion-gen
|
||||
cmd/libs/go2idl/deepcopy-gen
|
||||
cmd/libs/go2idl/defaulter-gen
|
||||
cmd/libs/go2idl/generator
|
||||
cmd/libs/go2idl/go-to-protobuf
|
||||
cmd/libs/go2idl/go-to-protobuf/protoc-gen-gogo
|
||||
cmd/libs/go2idl/import-boss
|
||||
cmd/libs/go2idl/informer-gen
|
||||
cmd/libs/go2idl/lister-gen
|
||||
cmd/libs/go2idl/openapi-gen
|
||||
cmd/libs/go2idl/parser
|
||||
cmd/libs/go2idl/set-gen
|
||||
cmd/libs/go2idl/set-gen/generators
|
||||
cmd/linkcheck
|
||||
docs/user-guide/environment-guide/containers/backend
|
||||
docs/user-guide/environment-guide/containers/show
|
||||
docs/user-guide/liveness/image
|
||||
examples
|
||||
examples/apiserver/server
|
||||
examples/explorer
|
||||
examples/https-nginx
|
||||
examples/sharing-clusters
|
||||
federation/apis/core/install
|
||||
federation/apis/federation/install
|
||||
federation/cmd/federation-apiserver
|
||||
federation/cmd/federation-controller-manager
|
||||
federation/cmd/genfeddocs
|
||||
federation/cmd/kubefed
|
||||
hack/boilerplate/test
|
||||
hack/cmd/teststale
|
||||
pkg/api
|
||||
pkg/api/annotations
|
||||
pkg/api/errors
|
||||
pkg/api/events
|
||||
pkg/api/install
|
||||
pkg/api/meta
|
||||
pkg/api/resource
|
||||
pkg/api/service
|
||||
pkg/api/v1
|
||||
pkg/api/v1/service
|
||||
pkg/apimachinery
|
||||
pkg/apis/abac/v0
|
||||
pkg/apis/apps/install
|
||||
pkg/apis/authentication.k8s.io/install
|
||||
pkg/apis/authentication/install
|
||||
pkg/apis/authorization/install
|
||||
pkg/apis/autoscaling/install
|
||||
pkg/apis/autoscaling/v1
|
||||
pkg/apis/batch/install
|
||||
pkg/apis/batch/v1
|
||||
pkg/apis/batch/v2alpha1
|
||||
pkg/apis/certificates/install
|
||||
pkg/apis/componentconfig/install
|
||||
pkg/apis/extensions/install
|
||||
pkg/apis/extensions/v1beta1
|
||||
pkg/apis/imagepolicy/install
|
||||
pkg/apis/policy/install
|
||||
pkg/apis/rbac/install
|
||||
pkg/apis/storage/install
|
||||
pkg/apis/storage/validation
|
||||
pkg/apiserver/audit
|
||||
pkg/apiserver/openapi
|
||||
pkg/auth/authenticator
|
||||
pkg/auth/authorizer/union
|
||||
pkg/client/conditions
|
||||
pkg/client/informers/informers_generated/apps
|
||||
pkg/client/informers/informers_generated/apps/internalversion
|
||||
pkg/client/informers/informers_generated/apps/v1beta1
|
||||
pkg/client/informers/informers_generated/autoscaling
|
||||
pkg/client/informers/informers_generated/autoscaling/internalversion
|
||||
pkg/client/informers/informers_generated/autoscaling/v1
|
||||
pkg/client/informers/informers_generated/batch
|
||||
pkg/client/informers/informers_generated/batch/internalversion
|
||||
pkg/client/informers/informers_generated/batch/v1
|
||||
pkg/client/informers/informers_generated/batch/v2alpha1
|
||||
pkg/client/informers/informers_generated/certificates
|
||||
pkg/client/informers/informers_generated/certificates/internalversion
|
||||
pkg/client/informers/informers_generated/certificates/v1alpha1
|
||||
pkg/client/informers/informers_generated/core
|
||||
pkg/client/informers/informers_generated/core/internalversion
|
||||
pkg/client/informers/informers_generated/core/v1
|
||||
pkg/client/informers/informers_generated/extensions
|
||||
pkg/client/informers/informers_generated/extensions/internalversion
|
||||
pkg/client/informers/informers_generated/extensions/v1beta1
|
||||
pkg/client/informers/informers_generated/policy
|
||||
pkg/client/informers/informers_generated/policy/internalversion
|
||||
pkg/client/informers/informers_generated/policy/v1beta1
|
||||
pkg/client/informers/informers_generated/rbac
|
||||
pkg/client/informers/informers_generated/rbac/internalversion
|
||||
pkg/client/informers/informers_generated/rbac/v1alpha1
|
||||
pkg/client/informers/informers_generated/storage
|
||||
pkg/client/informers/informers_generated/storage/internalversion
|
||||
pkg/client/informers/informers_generated/storage/v1beta1
|
||||
pkg/client/listers/apps/internalversion
|
||||
pkg/client/listers/apps/v1alpha1
|
||||
pkg/client/listers/apps/v1beta1
|
||||
pkg/client/listers/authentication/internalversion
|
||||
pkg/client/listers/authentication/v1beta1
|
||||
pkg/client/listers/authorization/internalversion
|
||||
pkg/client/listers/authorization/v1beta1
|
||||
pkg/client/listers/autoscaling/internalversion
|
||||
pkg/client/listers/autoscaling/v1
|
||||
pkg/client/listers/batch/internalversion
|
||||
pkg/client/listers/batch/v1
|
||||
pkg/client/listers/batch/v2alpha1
|
||||
pkg/client/listers/certificates/internalversion
|
||||
pkg/client/listers/certificates/v1alpha1
|
||||
pkg/client/listers/core/internalversion
|
||||
pkg/client/listers/core/v1
|
||||
pkg/client/listers/extensions/internalversion
|
||||
pkg/client/listers/extensions/v1beta1
|
||||
pkg/client/listers/imagepolicy/internalversion
|
||||
pkg/client/listers/imagepolicy/v1alpha1
|
||||
pkg/client/listers/policy/internalversion
|
||||
pkg/client/listers/policy/v1alpha1
|
||||
pkg/client/listers/policy/v1beta1
|
||||
pkg/client/listers/rbac/internalversion
|
||||
pkg/client/listers/rbac/v1alpha1
|
||||
pkg/client/listers/storage/internalversion
|
||||
pkg/client/listers/storage/v1beta1
|
||||
pkg/client/metrics
|
||||
pkg/client/metrics/prometheus
|
||||
pkg/client/testing/core
|
||||
pkg/client/typed/discovery
|
||||
pkg/client/unversioned
|
||||
pkg/client/unversioned/adapters/internalclientset
|
||||
pkg/client/unversioned/auth
|
||||
pkg/client/unversioned/remotecommand
|
||||
pkg/cloudprovider/providers
|
||||
pkg/cloudprovider/providers/azure
|
||||
pkg/cloudprovider/providers/cloudstack
|
||||
pkg/controller/framework
|
||||
pkg/controller/volume
|
||||
pkg/controller/volume/attachdetach/cache
|
||||
pkg/controller/volume/attachdetach/populator
|
||||
pkg/controller/volume/attachdetach/reconciler
|
||||
pkg/controller/volume/cache
|
||||
pkg/controller/volume/populator
|
||||
pkg/controller/volume/reconciler
|
||||
pkg/controller/volume/statusupdater
|
||||
pkg/conversion/queryparams
|
||||
pkg/credentialprovider/aws
|
||||
pkg/genericapiserver/filters
|
||||
pkg/genericapiserver/mux
|
||||
pkg/genericapiserver/routes
|
||||
pkg/hyperkube
|
||||
pkg/kubelet/api
|
||||
pkg/kubelet/container
|
||||
pkg/kubelet/envvars
|
||||
pkg/kubelet/eviction
|
||||
pkg/kubelet/sysctls
|
||||
pkg/kubelet/util/csr
|
||||
pkg/kubelet/util/format
|
||||
pkg/kubelet/util/ioutils
|
||||
pkg/kubelet/volume
|
||||
pkg/kubelet/volume/cache
|
||||
pkg/kubelet/volume/populator
|
||||
pkg/kubelet/volume/reconciler
|
||||
pkg/kubelet/volumemanager
|
||||
pkg/kubelet/volumemanager/cache
|
||||
pkg/kubelet/volumemanager/populator
|
||||
pkg/kubelet/volumemanager/reconciler
|
||||
pkg/proxy/config
|
||||
pkg/proxy/healthcheck
|
||||
pkg/quota/install
|
||||
pkg/registry
|
||||
pkg/registry/authorization/util
|
||||
pkg/registry/clusterrole/etcd
|
||||
pkg/registry/clusterrolebinding/etcd
|
||||
pkg/registry/configmap/etcd
|
||||
pkg/registry/core/configmap/etcd
|
||||
pkg/registry/core/endpoint
|
||||
pkg/registry/core/node/rest
|
||||
pkg/registry/core/pod/etcd
|
||||
pkg/registry/core/rangeallocation
|
||||
pkg/registry/core/service/ipallocator/controller
|
||||
pkg/registry/core/service/ipallocator/etcd
|
||||
pkg/registry/core/serviceaccount
|
||||
pkg/registry/endpoint
|
||||
pkg/registry/extensions/podsecuritypolicy/etcd
|
||||
pkg/registry/extensions/thirdpartyresource
|
||||
pkg/registry/extensions/thirdpartyresource/etcd
|
||||
pkg/registry/node/rest
|
||||
pkg/registry/pod/etcd
|
||||
pkg/registry/podsecuritypolicy/etcd
|
||||
pkg/registry/rangeallocation
|
||||
pkg/registry/rbac/clusterrole/etcd
|
||||
pkg/registry/rbac/clusterrolebinding/etcd
|
||||
pkg/registry/rbac/role/etcd
|
||||
pkg/registry/rbac/rolebinding/etcd
|
||||
pkg/registry/role/etcd
|
||||
pkg/registry/rolebinding/etcd
|
||||
pkg/registry/service/ipallocator/controller
|
||||
pkg/registry/service/ipallocator/etcd
|
||||
pkg/registry/serviceaccount
|
||||
pkg/registry/thirdpartyresource
|
||||
pkg/registry/thirdpartyresource/etcd
|
||||
pkg/runtime
|
||||
pkg/runtime/serializer/json
|
||||
pkg/runtime/serializer/protobuf
|
||||
pkg/runtime/serializer/recognizer/testing
|
||||
pkg/runtime/serializer/versioning
|
||||
pkg/runtime/serializer/yaml
|
||||
pkg/security
|
||||
pkg/security/podsecuritypolicy/apparmor
|
||||
pkg/security/podsecuritypolicy/capabilities
|
||||
pkg/security/podsecuritypolicy/sysctl
|
||||
pkg/serviceaccount
|
||||
pkg/storage
|
||||
pkg/storage/etcd3
|
||||
pkg/storage/storagebackend/factory
|
||||
pkg/util/async
|
||||
pkg/util/cert
|
||||
pkg/util/codeinspector
|
||||
pkg/util/flock
|
||||
pkg/util/flushwriter
|
||||
pkg/util/goroutinemap
|
||||
pkg/util/hash
|
||||
pkg/util/homedir
|
||||
pkg/util/interrupt
|
||||
pkg/util/io
|
||||
pkg/util/json
|
||||
pkg/util/limitwriter
|
||||
pkg/util/logs
|
||||
pkg/util/maps
|
||||
pkg/util/metrics
|
||||
pkg/util/netsh
|
||||
pkg/util/ratelimit
|
||||
pkg/util/replicaset
|
||||
pkg/util/validation/field
|
||||
pkg/util/workqueue
|
||||
pkg/version/prometheus
|
||||
pkg/volume
|
||||
pkg/volume/downwardapi
|
||||
pkg/volume/quobyte
|
||||
pkg/volume/util/nestedpendingoperations
|
||||
pkg/volume/util/operationexecutor
|
||||
pkg/volume/util/types
|
||||
pkg/volume/util/volumehelper
|
||||
pkg/watch/json
|
||||
pkg/watch/versioned
|
||||
plugin/cmd/kube-scheduler
|
||||
plugin/cmd/kube-scheduler/app/options
|
||||
plugin/pkg/admission/admit
|
||||
plugin/pkg/admission/alwayspullimages
|
||||
plugin/pkg/admission/deny
|
||||
plugin/pkg/admission/exec
|
||||
plugin/pkg/admission/gc
|
||||
plugin/pkg/admission/imagepolicy
|
||||
plugin/pkg/admission/namespace/autoprovision
|
||||
plugin/pkg/admission/namespace/exists
|
||||
plugin/pkg/admission/securitycontext/scdeny
|
||||
plugin/pkg/auth
|
||||
plugin/pkg/auth/authenticator
|
||||
plugin/pkg/auth/authenticator/password
|
||||
plugin/pkg/auth/authenticator/password/allow
|
||||
plugin/pkg/auth/authenticator/request/basicauth
|
||||
plugin/pkg/auth/authenticator/request/union
|
||||
plugin/pkg/auth/authenticator/request/x509
|
||||
plugin/pkg/auth/authorizer
|
||||
plugin/pkg/auth/authorizer/rbac/bootstrappolicy
|
||||
plugin/pkg/client/auth
|
||||
plugin/pkg/client/auth/gcp
|
||||
test/e2e/cleanup
|
||||
test/e2e/generated
|
||||
test/e2e/perftype
|
||||
test/e2e_node/runner/local
|
||||
test/images/clusterapi-tester
|
||||
test/images/entrypoint-tester
|
||||
test/images/fakegitserver
|
||||
test/images/goproxy
|
||||
test/images/logs-generator
|
||||
test/images/mount-tester
|
||||
test/images/n-way-http
|
||||
test/images/net
|
||||
test/images/net/common
|
||||
test/images/port-forward-tester
|
||||
test/images/porter
|
||||
test/images/resource-consumer/consume-cpu
|
||||
test/images/serve_hostname
|
||||
test/integration/discoverysummarizer
|
||||
test/integration/examples
|
||||
test/integration/federation
|
||||
test/integration/metrics
|
||||
test/integration/objectmeta
|
||||
test/integration/openshift
|
||||
test/soak/cauldron
|
||||
test/soak/serve_hostnames
|
||||
third_party/forked/golang/expansion
|
||||
8
vendor/k8s.io/kubernetes/hack/OWNERS
generated
vendored
Normal file
8
vendor/k8s.io/kubernetes/hack/OWNERS
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
assignees:
|
||||
- eparis
|
||||
- ihmccreery
|
||||
- ixdy
|
||||
- jbeda
|
||||
- lavalamp
|
||||
- spxtr
|
||||
- zmerlynn
|
||||
3
vendor/k8s.io/kubernetes/hack/autogenerated_placeholder.txt
generated
vendored
Normal file
3
vendor/k8s.io/kubernetes/hack/autogenerated_placeholder.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
This file is autogenerated, but we've stopped checking such files into the
|
||||
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
|
||||
populate this file.
|
||||
27
vendor/k8s.io/kubernetes/hack/benchmark-go.sh
generated
vendored
Executable file
27
vendor/k8s.io/kubernetes/hack/benchmark-go.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
make test \
|
||||
WHAT="$*"
|
||||
KUBE_COVER="" \
|
||||
KUBE_RACE=" " \
|
||||
KUBE_TEST_ARGS="-- -test.run='^X' -benchtime=1s -bench=. -benchmem" \
|
||||
50
vendor/k8s.io/kubernetes/hack/benchmark-integration.sh
generated
vendored
Executable file
50
vendor/k8s.io/kubernetes/hack/benchmark-integration.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
BENCHMARK_REGEX=${BENCHMARK_REGEX:-"."}
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
cleanup() {
|
||||
kube::etcd::cleanup
|
||||
kube::log::status "Benchmark cleanup complete"
|
||||
}
|
||||
|
||||
ARGS="-bench-pods 3000 -bench-tasks 100 -bench-tasks 10"
|
||||
|
||||
runTests() {
|
||||
kube::etcd::start
|
||||
kube::log::status "Running benchmarks"
|
||||
KUBE_GOFLAGS="-tags 'benchmark no-docker' -bench . -benchmem -benchtime 1s -cpu 4" \
|
||||
KUBE_RACE="-race" \
|
||||
KUBE_TEST_API_VERSIONS="v1" \
|
||||
KUBE_TIMEOUT="-timeout 10m" \
|
||||
KUBE_TEST_ETCD_PREFIXES="registry" \
|
||||
ETCD_CUSTOM_PREFIX="None" \
|
||||
KUBE_TEST_ARGS="${ARGS}" \
|
||||
make test WHAT=test/integration
|
||||
cleanup
|
||||
}
|
||||
|
||||
# Run cleanup to stop etcd on interrupt or other kill signal.
|
||||
trap cleanup EXIT
|
||||
|
||||
runTests
|
||||
3
vendor/k8s.io/kubernetes/hack/boilerplate/BUILD
generated
vendored
Normal file
3
vendor/k8s.io/kubernetes/hack/boilerplate/BUILD
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
exports_files(glob(["*.txt"]))
|
||||
14
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.Dockerfile.txt
generated
vendored
Normal file
14
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.Dockerfile.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Copyright YEAR 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.
|
||||
|
||||
14
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.Makefile.txt
generated
vendored
Normal file
14
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.Makefile.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Copyright YEAR 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.
|
||||
|
||||
16
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt
generated
vendored
Normal file
16
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Copyright YEAR 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.
|
||||
*/
|
||||
|
||||
197
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.py
generated
vendored
Executable file
197
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.py
generated
vendored
Executable file
|
|
@ -0,0 +1,197 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2015 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 __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import difflib
|
||||
import glob
|
||||
import json
|
||||
import mmap
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"filenames",
|
||||
help="list of files to check, all files if unspecified",
|
||||
nargs='*')
|
||||
|
||||
rootdir = os.path.dirname(__file__) + "/../../"
|
||||
rootdir = os.path.abspath(rootdir)
|
||||
parser.add_argument(
|
||||
"--rootdir", default=rootdir, help="root directory to examine")
|
||||
|
||||
default_boilerplate_dir = os.path.join(rootdir, "hack/boilerplate")
|
||||
parser.add_argument(
|
||||
"--boilerplate-dir", default=default_boilerplate_dir)
|
||||
|
||||
parser.add_argument(
|
||||
"-v", "--verbose",
|
||||
help="give verbose output regarding why a file does not pass",
|
||||
action="store_true")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
verbose_out = sys.stderr if args.verbose else open("/dev/null", "w")
|
||||
|
||||
def get_refs():
|
||||
refs = {}
|
||||
|
||||
for path in glob.glob(os.path.join(args.boilerplate_dir, "boilerplate.*.txt")):
|
||||
extension = os.path.basename(path).split(".")[1]
|
||||
|
||||
ref_file = open(path, 'r')
|
||||
ref = ref_file.read().splitlines()
|
||||
ref_file.close()
|
||||
refs[extension] = ref
|
||||
|
||||
return refs
|
||||
|
||||
def file_passes(filename, refs, regexs):
|
||||
try:
|
||||
f = open(filename, 'r')
|
||||
except Exception as exc:
|
||||
print("Unable to open %s: %s" % (filename, exc), file=verbose_out)
|
||||
return False
|
||||
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
basename = os.path.basename(filename)
|
||||
extension = file_extension(filename)
|
||||
if extension != "":
|
||||
ref = refs[extension]
|
||||
else:
|
||||
ref = refs[basename]
|
||||
|
||||
# remove build tags from the top of Go files
|
||||
if extension == "go":
|
||||
p = regexs["go_build_constraints"]
|
||||
(data, found) = p.subn("", data, 1)
|
||||
|
||||
# remove shebang from the top of shell files
|
||||
if extension == "sh":
|
||||
p = regexs["shebang"]
|
||||
(data, found) = p.subn("", data, 1)
|
||||
|
||||
data = data.splitlines()
|
||||
|
||||
# if our test file is smaller than the reference it surely fails!
|
||||
if len(ref) > len(data):
|
||||
print('File %s smaller than reference (%d < %d)' %
|
||||
(filename, len(data), len(ref)),
|
||||
file=verbose_out)
|
||||
return False
|
||||
|
||||
# trim our file to the same number of lines as the reference file
|
||||
data = data[:len(ref)]
|
||||
|
||||
p = regexs["year"]
|
||||
for d in data:
|
||||
if p.search(d):
|
||||
print('File %s is missing the year' % filename, file=verbose_out)
|
||||
return False
|
||||
|
||||
# Replace all occurrences of the regex "2016|2015|2014" with "YEAR"
|
||||
p = regexs["date"]
|
||||
for i, d in enumerate(data):
|
||||
(data[i], found) = p.subn('YEAR', d)
|
||||
if found != 0:
|
||||
break
|
||||
|
||||
# if we don't match the reference at this point, fail
|
||||
if ref != data:
|
||||
print("Header in %s does not match reference, diff:" % filename, file=verbose_out)
|
||||
if args.verbose:
|
||||
print(file=verbose_out)
|
||||
for line in difflib.unified_diff(ref, data, 'reference', filename, lineterm=''):
|
||||
print(line, file=verbose_out)
|
||||
print(file=verbose_out)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def file_extension(filename):
|
||||
return os.path.splitext(filename)[1].split(".")[-1].lower()
|
||||
|
||||
skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh',
|
||||
"vendor", "test/e2e/generated/bindata.go", "hack/boilerplate/test"]
|
||||
|
||||
def normalize_files(files):
|
||||
newfiles = []
|
||||
for pathname in files:
|
||||
if any(x in pathname for x in skipped_dirs):
|
||||
continue
|
||||
newfiles.append(pathname)
|
||||
for i, pathname in enumerate(newfiles):
|
||||
if not os.path.isabs(pathname):
|
||||
newfiles[i] = os.path.join(args.rootdir, pathname)
|
||||
return newfiles
|
||||
|
||||
def get_files(extensions):
|
||||
files = []
|
||||
if len(args.filenames) > 0:
|
||||
files = args.filenames
|
||||
else:
|
||||
for root, dirs, walkfiles in os.walk(args.rootdir):
|
||||
# don't visit certain dirs. This is just a performance improvement
|
||||
# as we would prune these later in normalize_files(). But doing it
|
||||
# cuts down the amount of filesystem walking we do and cuts down
|
||||
# the size of the file list
|
||||
for d in skipped_dirs:
|
||||
if d in dirs:
|
||||
dirs.remove(d)
|
||||
|
||||
for name in walkfiles:
|
||||
pathname = os.path.join(root, name)
|
||||
files.append(pathname)
|
||||
|
||||
files = normalize_files(files)
|
||||
outfiles = []
|
||||
for pathname in files:
|
||||
basename = os.path.basename(pathname)
|
||||
extension = file_extension(pathname)
|
||||
if extension in extensions or basename in extensions:
|
||||
outfiles.append(pathname)
|
||||
return outfiles
|
||||
|
||||
def get_regexs():
|
||||
regexs = {}
|
||||
# Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing
|
||||
regexs["year"] = re.compile( 'YEAR' )
|
||||
# dates can be 2014, 2015 or 2016, company holder names can be anything
|
||||
regexs["date"] = re.compile( '(2014|2015|2016)' )
|
||||
# strip // +build \n\n build constraints
|
||||
regexs["go_build_constraints"] = re.compile(r"^(// \+build.*\n)+\n", re.MULTILINE)
|
||||
# strip #!.* from shell scripts
|
||||
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
|
||||
return regexs
|
||||
|
||||
def main():
|
||||
regexs = get_regexs()
|
||||
refs = get_refs()
|
||||
filenames = get_files(refs.keys())
|
||||
|
||||
for filename in filenames:
|
||||
if not file_passes(filename, refs, regexs):
|
||||
print(filename, file=sys.stdout)
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
16
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.py.txt
generated
vendored
Normal file
16
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.py.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright YEAR 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.
|
||||
|
||||
14
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.sh.txt
generated
vendored
Normal file
14
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate.sh.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Copyright YEAR 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.
|
||||
|
||||
52
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate_test.py
generated
vendored
Normal file
52
vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate_test.py
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# 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.
|
||||
|
||||
import boilerplate
|
||||
import unittest
|
||||
import StringIO
|
||||
import os
|
||||
import sys
|
||||
|
||||
class TestBoilerplate(unittest.TestCase):
|
||||
"""
|
||||
Note: run this test from the hack/boilerplate directory.
|
||||
|
||||
$ python -m unittest boilerplate_test
|
||||
"""
|
||||
|
||||
def test_boilerplate(self):
|
||||
os.chdir("test/")
|
||||
|
||||
class Args(object):
|
||||
def __init__(self):
|
||||
self.filenames = []
|
||||
self.rootdir = "."
|
||||
self.boilerplate_dir = "../"
|
||||
self.verbose = True
|
||||
|
||||
# capture stdout
|
||||
old_stdout = sys.stdout
|
||||
sys.stdout = StringIO.StringIO()
|
||||
|
||||
boilerplate.args = Args()
|
||||
ret = boilerplate.main()
|
||||
|
||||
output = sorted(sys.stdout.getvalue().split())
|
||||
|
||||
sys.stdout = old_stdout
|
||||
|
||||
self.assertEquals(
|
||||
output, ['././fail.go', '././fail.py'])
|
||||
19
vendor/k8s.io/kubernetes/hack/boilerplate/test/fail.go
generated
vendored
Normal file
19
vendor/k8s.io/kubernetes/hack/boilerplate/test/fail.go
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
fail
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package main
|
||||
17
vendor/k8s.io/kubernetes/hack/boilerplate/test/fail.py
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/hack/boilerplate/test/fail.py
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2015 The Kubernetes Authors.
|
||||
#
|
||||
# failed
|
||||
#
|
||||
# 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.
|
||||
17
vendor/k8s.io/kubernetes/hack/boilerplate/test/pass.go
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/hack/boilerplate/test/pass.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
Copyright 2014 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.
|
||||
*/
|
||||
|
||||
package main
|
||||
17
vendor/k8s.io/kubernetes/hack/boilerplate/test/pass.py
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/hack/boilerplate/test/pass.py
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
True
|
||||
31
vendor/k8s.io/kubernetes/hack/build-cross.sh
generated
vendored
Executable file
31
vendor/k8s.io/kubernetes/hack/build-cross.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script is a vestigial redirection. Please do not add "real" logic.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
echo "NOTE: $0 has been replaced by 'make cross'"
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make cross"
|
||||
echo
|
||||
echo
|
||||
make --no-print-directory -C "${KUBE_ROOT}" cross
|
||||
37
vendor/k8s.io/kubernetes/hack/build-go.sh
generated
vendored
Executable file
37
vendor/k8s.io/kubernetes/hack/build-go.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# This script is a vestigial redirection. Please do not add "real" logic.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# For help output
|
||||
ARGHELP=""
|
||||
if [[ "$#" -gt 0 ]]; then
|
||||
ARGHELP="WHAT='$@'"
|
||||
fi
|
||||
|
||||
echo "NOTE: $0 has been replaced by 'make' or 'make all'"
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make ${ARGHELP}"
|
||||
echo
|
||||
echo
|
||||
make --no-print-directory -C "${KUBE_ROOT}" all WHAT="$*"
|
||||
54
vendor/k8s.io/kubernetes/hack/build-ui.sh
generated
vendored
Executable file
54
vendor/k8s.io/kubernetes/hack/build-ui.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script builds ui assets into a single go datafile
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
cd "${KUBE_ROOT}"
|
||||
|
||||
if ! which go-bindata > /dev/null 2>&1 ; then
|
||||
echo "Cannot find go-bindata. Install with \"go get github.com/jteeuwen/go-bindata/...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly TMP_DATAFILE="/tmp/datafile.go"
|
||||
readonly SWAGGER_SRC="third_party/swagger-ui/..."
|
||||
readonly SWAGGER_PKG="swagger"
|
||||
|
||||
function kube::hack::build_ui() {
|
||||
local pkg="$1"
|
||||
local src="$2"
|
||||
local output_file="pkg/genericapiserver/routes/data/${pkg}/datafile.go"
|
||||
|
||||
go-bindata -nocompress -o "${output_file}" -prefix ${PWD} -pkg "${pkg}" "${src}"
|
||||
|
||||
local year=$(date +%Y)
|
||||
cat hack/boilerplate/boilerplate.go.txt | sed "s/YEAR/${year}/" > "${TMP_DATAFILE}"
|
||||
echo -e "// generated by hack/build-ui.sh; DO NOT EDIT\n" >> "${TMP_DATAFILE}"
|
||||
cat "${output_file}" >> "${TMP_DATAFILE}"
|
||||
|
||||
gofmt -s -w "${TMP_DATAFILE}"
|
||||
|
||||
mv "${TMP_DATAFILE}" "${output_file}"
|
||||
}
|
||||
|
||||
kube::hack::build_ui "${SWAGGER_PKG}" "${SWAGGER_SRC}"
|
||||
222
vendor/k8s.io/kubernetes/hack/cherry_pick_pull.sh
generated
vendored
Executable file
222
vendor/k8s.io/kubernetes/hack/cherry_pick_pull.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,222 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# Checkout a PR from GitHub. (Yes, this is sitting in a Git tree. How
|
||||
# meta.) Assumes you care about pulls from remote "upstream" and
|
||||
# checks thems out to a branch named:
|
||||
# automated-cherry-pick-of-<pr>-<target branch>-<timestamp>
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
declare -r KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
|
||||
cd "${KUBE_ROOT}"
|
||||
|
||||
declare -r STARTINGBRANCH=$(git symbolic-ref --short HEAD)
|
||||
declare -r REBASEMAGIC="${KUBE_ROOT}/.git/rebase-apply"
|
||||
DRY_RUN=${DRY_RUN:-""}
|
||||
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-upstream}
|
||||
FORK_REMOTE=${FORK_REMOTE:-origin}
|
||||
|
||||
if [[ -z ${GITHUB_USER:-} ]]; then
|
||||
echo "Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! which hub > /dev/null; then
|
||||
echo "Can't find 'hub' tool in PATH, please install from https://github.com/github/hub"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$#" -lt 2 ]]; then
|
||||
echo "${0} <remote branch> <pr-number>...: cherry pick one or more <pr> onto <remote branch> and leave instructions for proposing pull request"
|
||||
echo
|
||||
echo " Checks out <remote branch> and handles the cherry-pick of <pr> (possibly multiple) for you."
|
||||
echo " Examples:"
|
||||
echo " $0 upstream/release-3.14 12345 # Cherry-picks PR 12345 onto upstream/release-3.14 and proposes that as a PR."
|
||||
echo " $0 upstream/release-3.14 12345 56789 # Cherry-picks PR 12345, then 56789 and proposes the combination as a single PR."
|
||||
echo
|
||||
echo " Set the DRY_RUN environment var to skip git push and creating PR."
|
||||
echo " This is useful for creating patches to a release branch without making a PR."
|
||||
echo " When DRY_RUN is set the script will leave you in a branch containing the commits you cherry-picked."
|
||||
echo
|
||||
echo " Set UPSTREAM_REMOTE (default: upstream) and FORK_REMOTE (default: origin)"
|
||||
echo " To override the default remote names to what you have locally."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if git_status=$(git status --porcelain --untracked=no 2>/dev/null) && [[ -n "${git_status}" ]]; then
|
||||
echo "!!! Dirty tree. Clean up and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -e "${REBASEMAGIC}" ]]; then
|
||||
echo "!!! 'git rebase' or 'git am' in progress. Clean up and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -r BRANCH="$1"
|
||||
shift 1
|
||||
declare -r PULLS=( "$@" )
|
||||
|
||||
function join { local IFS="$1"; shift; echo "$*"; }
|
||||
declare -r PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
|
||||
declare -r PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
|
||||
|
||||
echo "+++ Updating remotes..."
|
||||
git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}"
|
||||
|
||||
if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then
|
||||
echo "!!! '${BRANCH}' not found. The second argument should be something like ${UPSTREAM_REMOTE}/release-0.21."
|
||||
echo " (In particular, it needs to be a valid, existing remote branch that I can 'git checkout'.)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -r NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
|
||||
declare -r NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
|
||||
declare -r NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
|
||||
echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
|
||||
|
||||
cleanbranch=""
|
||||
prtext=""
|
||||
gitamcleanup=false
|
||||
function return_to_kansas {
|
||||
if [[ "${gitamcleanup}" == "true" ]]; then
|
||||
echo
|
||||
echo "+++ Aborting in-progress git am."
|
||||
git am --abort >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# return to the starting branch and delete the PR text file
|
||||
if [[ -z "${DRY_RUN}" ]]; then
|
||||
echo
|
||||
echo "+++ Returning you to the ${STARTINGBRANCH} branch and cleaning up."
|
||||
git checkout -f "${STARTINGBRANCH}" >/dev/null 2>&1 || true
|
||||
if [[ -n "${cleanbranch}" ]]; then
|
||||
git branch -D "${cleanbranch}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [[ -n "${prtext}" ]]; then
|
||||
rm "${prtext}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
trap return_to_kansas EXIT
|
||||
|
||||
SUBJECTS=()
|
||||
function make-a-pr() {
|
||||
local rel="$(basename "${BRANCH}")"
|
||||
echo
|
||||
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
|
||||
|
||||
# This looks like an unnecessary use of a tmpfile, but it avoids
|
||||
# https://github.com/github/hub/issues/976 Otherwise stdin is stolen
|
||||
# when we shove the heredoc at hub directly, tickling the ioctl
|
||||
# crash.
|
||||
prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas
|
||||
cat >"${prtext}" <<EOF
|
||||
Automated cherry pick of ${PULLSUBJ}
|
||||
|
||||
Cherry pick of ${PULLSUBJ} on ${rel}.
|
||||
|
||||
$(printf '%s\n' "${SUBJECTS[@]}")
|
||||
EOF
|
||||
|
||||
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "kubernetes:${rel}"
|
||||
}
|
||||
|
||||
git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
|
||||
cleanbranch="${NEWBRANCHUNIQ}"
|
||||
|
||||
gitamcleanup=true
|
||||
for pull in "${PULLS[@]}"; do
|
||||
echo "+++ Downloading patch to /tmp/${pull}.patch (in case you need to do this again)"
|
||||
curl -o "/tmp/${pull}.patch" -sSL "http://pr.k8s.io/${pull}.patch"
|
||||
echo
|
||||
echo "+++ About to attempt cherry pick of PR. To reattempt:"
|
||||
echo " $ git am -3 /tmp/${pull}.patch"
|
||||
echo
|
||||
git am -3 "/tmp/${pull}.patch" || {
|
||||
conflicts=false
|
||||
while unmerged=$(git status --porcelain | grep ^U) && [[ -n ${unmerged} ]] \
|
||||
|| [[ -e "${REBASEMAGIC}" ]]; do
|
||||
conflicts=true # <-- We should have detected conflicts once
|
||||
echo
|
||||
echo "+++ Conflicts detected:"
|
||||
echo
|
||||
(git status --porcelain | grep ^U) || echo "!!! None. Did you git am --continue?"
|
||||
echo
|
||||
echo "+++ Please resolve the conflicts in another window (and remember to 'git add / git am --continue')"
|
||||
read -p "+++ Proceed (anything but 'y' aborts the cherry-pick)? [y/n] " -r
|
||||
echo
|
||||
if ! [[ "${REPLY}" =~ ^[yY]$ ]]; then
|
||||
echo "Aborting." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${conflicts}" != "true" ]]; then
|
||||
echo "!!! git am failed, likely because of an in-progress 'git am' or 'git rebase'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
# set the subject
|
||||
subject=$(grep -m 1 "^Subject" "/tmp/${pull}.patch" | sed -e 's/Subject: \[PATCH//g' | sed 's/.*] //')
|
||||
SUBJECTS+=("#${pull}: ${subject}")
|
||||
done
|
||||
gitamcleanup=false
|
||||
|
||||
if [[ -n "${DRY_RUN}" ]]; then
|
||||
echo "!!! Skipping git push and PR creation because you set DRY_RUN."
|
||||
echo "To return to the branch you were in when you invoked this script:"
|
||||
echo
|
||||
echo " git checkout ${STARTINGBRANCH}"
|
||||
echo
|
||||
echo "To delete this branch:"
|
||||
echo
|
||||
echo " git branch -D ${NEWBRANCHUNIQ}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if git remote -v | grep ^${FORK_REMOTE} | grep kubernetes/kubernetes.git; then
|
||||
echo "!!! You have ${FORK_REMOTE} configured as your kubernetes/kubernetes.git"
|
||||
echo "This isn't normal. Leaving you with push instructions:"
|
||||
echo
|
||||
echo "+++ First manually push the branch this script created:"
|
||||
echo
|
||||
echo " git push REMOTE ${NEWBRANCHUNIQ}:${NEWBRANCH}"
|
||||
echo
|
||||
echo "where REMOTE is your personal fork (maybe ${UPSTREAM_REMOTE}? Consider swapping those.)."
|
||||
echo "OR consider setting UPSTREAM_REMOTE and FORK_REMOTE to different values."
|
||||
echo
|
||||
make-a-pr
|
||||
cleanbranch=""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "+++ I'm about to do the following to push to GitHub (and I'm assuming ${FORK_REMOTE} is your personal fork):"
|
||||
echo
|
||||
echo " git push ${FORK_REMOTE} ${NEWBRANCHUNIQ}:${NEWBRANCH}"
|
||||
echo
|
||||
read -p "+++ Proceed (anything but 'y' aborts the cherry-pick)? [y/n] " -r
|
||||
if ! [[ "${REPLY}" =~ ^[yY]$ ]]; then
|
||||
echo "Aborting." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git push "${FORK_REMOTE}" -f "${NEWBRANCHUNIQ}:${NEWBRANCH}"
|
||||
make-a-pr
|
||||
209
vendor/k8s.io/kubernetes/hack/cmd/teststale/teststale.go
generated
vendored
Normal file
209
vendor/k8s.io/kubernetes/hack/cmd/teststale/teststale.go
generated
vendored
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// teststale checks the staleness of a test binary. go test -c builds a test
|
||||
// binary but it does no staleness check. In other words, every time one runs
|
||||
// go test -c, it compiles the test packages and links the binary even when
|
||||
// nothing has changed. This program helps to mitigate that problem by allowing
|
||||
// to check the staleness of a given test package and its binary.
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
const usageHelp = "" +
|
||||
`This program checks the staleness of a given test package and its test
|
||||
binary so that one can make a decision about re-building the test binary.
|
||||
|
||||
Usage:
|
||||
teststale -binary=/path/to/test/binary -package=package
|
||||
|
||||
Example:
|
||||
teststale -binary="$HOME/gosrc/bin/e2e.test" -package="k8s.io/kubernetes/test/e2e"
|
||||
|
||||
`
|
||||
|
||||
var (
|
||||
binary = flag.String("binary", "", "filesystem path to the test binary file. Example: \"$HOME/gosrc/bin/e2e.test\"")
|
||||
pkgPath = flag.String("package", "", "import path of the test package in the format used while importing packages. Example: \"k8s.io/kubernetes/test/e2e\"")
|
||||
)
|
||||
|
||||
func usage() {
|
||||
fmt.Fprintln(os.Stderr, usageHelp)
|
||||
fmt.Fprintln(os.Stderr, "Flags:")
|
||||
flag.PrintDefaults()
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// golist is an interface emulating the `go list` command to get package information.
|
||||
// TODO: Evaluate using `go/build` package instead. It doesn't provide staleness
|
||||
// information, but we can probably run `go list` and `go/build.Import()` concurrently
|
||||
// in goroutines and merge the results. Evaluate if that's faster.
|
||||
type golist interface {
|
||||
pkgInfo(pkgPaths []string) ([]pkg, error)
|
||||
}
|
||||
|
||||
// execmd implements the `golist` interface.
|
||||
type execcmd struct {
|
||||
cmd string
|
||||
args []string
|
||||
env []string
|
||||
}
|
||||
|
||||
func (e *execcmd) pkgInfo(pkgPaths []string) ([]pkg, error) {
|
||||
args := append(e.args, pkgPaths...)
|
||||
cmd := exec.Command(e.cmd, args...)
|
||||
cmd.Env = e.env
|
||||
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to obtain the metadata output stream: %v", err)
|
||||
}
|
||||
|
||||
dec := json.NewDecoder(stdout)
|
||||
|
||||
// Start executing the command
|
||||
if err := cmd.Start(); err != nil {
|
||||
return nil, fmt.Errorf("command did not start: %v", err)
|
||||
}
|
||||
|
||||
var pkgs []pkg
|
||||
for {
|
||||
var p pkg
|
||||
if err := dec.Decode(&p); err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal metadata for package %s: %v", p.ImportPath, err)
|
||||
}
|
||||
pkgs = append(pkgs, p)
|
||||
}
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
return nil, fmt.Errorf("command did not complete: %v", err)
|
||||
}
|
||||
return pkgs, nil
|
||||
}
|
||||
|
||||
type pkg struct {
|
||||
Dir string
|
||||
ImportPath string
|
||||
Target string
|
||||
Stale bool
|
||||
TestGoFiles []string
|
||||
TestImports []string
|
||||
XTestGoFiles []string
|
||||
XTestImports []string
|
||||
}
|
||||
|
||||
func (p *pkg) isNewerThan(cmd golist, buildTime time.Time) bool {
|
||||
// If the package itself is stale, then we have to rebuild the whole thing anyway.
|
||||
if p.Stale {
|
||||
return true
|
||||
}
|
||||
|
||||
// Test for file staleness
|
||||
for _, f := range p.TestGoFiles {
|
||||
if isNewerThan(filepath.Join(p.Dir, f), buildTime) {
|
||||
glog.V(4).Infof("test Go file %s is stale", f)
|
||||
return true
|
||||
}
|
||||
}
|
||||
for _, f := range p.XTestGoFiles {
|
||||
if isNewerThan(filepath.Join(p.Dir, f), buildTime) {
|
||||
glog.V(4).Infof("external test Go file %s is stale", f)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
imps := []string{}
|
||||
imps = append(imps, p.TestImports...)
|
||||
imps = append(imps, p.XTestImports...)
|
||||
|
||||
// This calls `go list` the second time. This is required because the first
|
||||
// call to `go list` checks the staleness of the package in question by
|
||||
// looking the non-test dependencies, but it doesn't look at the test
|
||||
// dependencies. However, it returns the list of test dependencies. This
|
||||
// second call to `go list` checks the staleness of all the test
|
||||
// dependencies.
|
||||
pkgs, err := cmd.pkgInfo(imps)
|
||||
if err != nil || len(pkgs) < 1 {
|
||||
glog.V(4).Infof("failed to obtain metadata for packages %s: %v", imps, err)
|
||||
return true
|
||||
}
|
||||
|
||||
for _, p := range pkgs {
|
||||
if p.Stale {
|
||||
glog.V(4).Infof("import %q is stale", p.ImportPath)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func isNewerThan(filename string, buildTime time.Time) bool {
|
||||
stat, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
return stat.ModTime().After(buildTime)
|
||||
}
|
||||
|
||||
// isTestStale checks if the test binary is stale and needs to rebuilt.
|
||||
// Some of the ideas here are inspired by how Go does staleness checks.
|
||||
func isTestStale(cmd golist, binPath, pkgPath string) bool {
|
||||
bStat, err := os.Stat(binPath)
|
||||
if err != nil {
|
||||
glog.V(4).Infof("Couldn't obtain the modified time of the binary %s: %v", binPath, err)
|
||||
return true
|
||||
}
|
||||
buildTime := bStat.ModTime()
|
||||
|
||||
pkgs, err := cmd.pkgInfo([]string{pkgPath})
|
||||
if err != nil || len(pkgs) < 1 {
|
||||
glog.V(4).Infof("Couldn't retrieve test package information for package %s: %v", pkgPath, err)
|
||||
return false
|
||||
}
|
||||
|
||||
return pkgs[0].isNewerThan(cmd, buildTime)
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
|
||||
cmd := &execcmd{
|
||||
cmd: "go",
|
||||
args: []string{
|
||||
"list",
|
||||
"-json",
|
||||
},
|
||||
env: os.Environ(),
|
||||
}
|
||||
if !isTestStale(cmd, *binary, *pkgPath) {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
325
vendor/k8s.io/kubernetes/hack/cmd/teststale/teststale_test.go
generated
vendored
Normal file
325
vendor/k8s.io/kubernetes/hack/cmd/teststale/teststale_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// seed for rand.Source to generate data for files
|
||||
seed int64 = 42
|
||||
|
||||
// 1K binary file
|
||||
binLen = 1024
|
||||
|
||||
// Directory of the test package relative to $GOPATH
|
||||
testImportDir = "example.com/proj/pkg"
|
||||
)
|
||||
|
||||
var (
|
||||
pastHour = time.Now().Add(-1 * time.Hour)
|
||||
|
||||
// The test package we are testing against
|
||||
testPkg = path.Join(testImportDir, "test")
|
||||
)
|
||||
|
||||
// fakegolist implements the `golist` interface providing fake package information for testing.
|
||||
type fakegolist struct {
|
||||
dir string
|
||||
importMap map[string]pkg
|
||||
testFiles []string
|
||||
binfile string
|
||||
}
|
||||
|
||||
func newFakegolist() (*fakegolist, error) {
|
||||
dir, err := ioutil.TempDir("", "teststale")
|
||||
if err != nil {
|
||||
// test can't proceed without a temp directory.
|
||||
return nil, fmt.Errorf("failed to create a temp directory for testing: %v", err)
|
||||
}
|
||||
|
||||
// Set the temp directory as the $GOPATH
|
||||
if err := os.Setenv("GOPATH", dir); err != nil {
|
||||
// can't proceed without pointing the $GOPATH to the temp directory.
|
||||
return nil, fmt.Errorf("failed to set \"$GOPATH\" pointing to %q: %v", dir, err)
|
||||
}
|
||||
|
||||
// Setup $GOPATH directory layout.
|
||||
// Yeah! I am bored of repeatedly writing "if err != nil {}"!
|
||||
if os.MkdirAll(filepath.Join(dir, "bin"), 0750) != nil ||
|
||||
os.MkdirAll(filepath.Join(dir, "pkg", "linux_amd64"), 0750) != nil ||
|
||||
os.MkdirAll(filepath.Join(dir, "src"), 0750) != nil {
|
||||
return nil, fmt.Errorf("failed to setup the $GOPATH directory structure")
|
||||
}
|
||||
|
||||
// Create a temp file to represent the test binary.
|
||||
binfile, err := ioutil.TempFile("", "testbin")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create the temp file to represent the test binary: %v", err)
|
||||
}
|
||||
|
||||
// Could have used crypto/rand instead, but it doesn't matter.
|
||||
rr := rand.New(rand.NewSource(42))
|
||||
bin := make([]byte, binLen)
|
||||
if _, err = rr.Read(bin); err != nil {
|
||||
return nil, fmt.Errorf("couldn't read from the random source: %v", err)
|
||||
}
|
||||
if _, err := binfile.Write(bin); err != nil {
|
||||
return nil, fmt.Errorf("couldn't write to the binary file %q: %v", binfile.Name(), err)
|
||||
}
|
||||
if err := binfile.Close(); err != nil {
|
||||
// It is arguable whether this should be fatal.
|
||||
return nil, fmt.Errorf("failed to close the binary file %q: %v", binfile.Name(), err)
|
||||
}
|
||||
|
||||
if err := os.Chtimes(binfile.Name(), time.Now(), time.Now()); err != nil {
|
||||
return nil, fmt.Errorf("failed to modify the mtime of the binary file %q: %v", binfile.Name(), err)
|
||||
}
|
||||
|
||||
// Create test source files directory.
|
||||
testdir := filepath.Join(dir, "src", testPkg)
|
||||
if err := os.MkdirAll(testdir, 0750); err != nil {
|
||||
return nil, fmt.Errorf("failed to create test source directory %q: %v", testdir, err)
|
||||
}
|
||||
|
||||
fgl := &fakegolist{
|
||||
dir: dir,
|
||||
importMap: map[string]pkg{
|
||||
"example.com/proj/pkg/test": {
|
||||
Dir: path.Join(dir, "src", testPkg),
|
||||
ImportPath: testPkg,
|
||||
Target: path.Join(dir, "pkg", "linux_amd64", testImportDir, "test.a"),
|
||||
Stale: false,
|
||||
TestGoFiles: []string{
|
||||
"foo_test.go",
|
||||
"bar_test.go",
|
||||
},
|
||||
TestImports: []string{
|
||||
"example.com/proj/pkg/p1",
|
||||
"example.com/proj/pkg/p1/c11",
|
||||
"example.com/proj/pkg/p2",
|
||||
"example.com/proj/cmd/p3/c12/c23",
|
||||
"strings",
|
||||
"testing",
|
||||
},
|
||||
XTestGoFiles: []string{
|
||||
"xfoo_test.go",
|
||||
"xbar_test.go",
|
||||
"xbaz_test.go",
|
||||
},
|
||||
XTestImports: []string{
|
||||
"example.com/proj/pkg/test",
|
||||
"example.com/proj/pkg/p1",
|
||||
"example.com/proj/cmd/p3/c12/c23",
|
||||
"os",
|
||||
"testing",
|
||||
},
|
||||
},
|
||||
"example.com/proj/pkg/p1": {Stale: false},
|
||||
"example.com/proj/pkg/p1/c11": {Stale: false},
|
||||
"example.com/proj/pkg/p2": {Stale: false},
|
||||
"example.com/proj/cmd/p3/c12/c23": {Stale: false},
|
||||
"strings": {Stale: false},
|
||||
"testing": {Stale: false},
|
||||
"os": {Stale: false},
|
||||
},
|
||||
testFiles: []string{
|
||||
"foo_test.go",
|
||||
"bar_test.go",
|
||||
"xfoo_test.go",
|
||||
"xbar_test.go",
|
||||
"xbaz_test.go",
|
||||
},
|
||||
binfile: binfile.Name(),
|
||||
}
|
||||
|
||||
// Create test source files.
|
||||
for _, fn := range fgl.testFiles {
|
||||
fp := filepath.Join(testdir, fn)
|
||||
if _, err := os.Create(fp); err != nil {
|
||||
return nil, fmt.Errorf("failed to create the test file %q: %v", fp, err)
|
||||
}
|
||||
if err := os.Chtimes(fp, time.Now(), pastHour); err != nil {
|
||||
return nil, fmt.Errorf("failed to modify the mtime of the test file %q: %v", binfile.Name(), err)
|
||||
}
|
||||
}
|
||||
|
||||
return fgl, nil
|
||||
}
|
||||
|
||||
func (fgl *fakegolist) pkgInfo(pkgPaths []string) ([]pkg, error) {
|
||||
var pkgs []pkg
|
||||
for _, path := range pkgPaths {
|
||||
p, ok := fgl.importMap[path]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("package %q not found", path)
|
||||
}
|
||||
pkgs = append(pkgs, p)
|
||||
}
|
||||
return pkgs, nil
|
||||
}
|
||||
|
||||
func (fgl *fakegolist) chMtime(filename string, mtime time.Time) error {
|
||||
for _, fn := range fgl.testFiles {
|
||||
if fn == filename {
|
||||
fp := filepath.Join(fgl.dir, "src", testPkg, fn)
|
||||
if err := os.Chtimes(fp, time.Now(), mtime); err != nil {
|
||||
return fmt.Errorf("failed to modify the mtime of %q: %v", filename, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("file %q not found", filename)
|
||||
}
|
||||
|
||||
func (fgl *fakegolist) chStale(pkg string, stale bool) error {
|
||||
if p, ok := fgl.importMap[pkg]; ok {
|
||||
p.Stale = stale
|
||||
fgl.importMap[pkg] = p
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("package %q not found", pkg)
|
||||
}
|
||||
|
||||
func (fgl *fakegolist) cleanup() {
|
||||
os.RemoveAll(fgl.dir)
|
||||
os.Remove(fgl.binfile)
|
||||
}
|
||||
|
||||
func TestIsTestStale(t *testing.T) {
|
||||
cases := []struct {
|
||||
fileMtime map[string]time.Time
|
||||
pkgStaleness map[string]bool
|
||||
result bool
|
||||
}{
|
||||
// Basic test: binary is fresh, all modifications were before the binary was built.
|
||||
{
|
||||
result: false,
|
||||
},
|
||||
// A local test file is new, hence binary must be stale.
|
||||
{
|
||||
fileMtime: map[string]time.Time{
|
||||
"foo_test.go": time.Now().Add(1 * time.Hour),
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
// Test package is new, so binary must be stale.
|
||||
{
|
||||
pkgStaleness: map[string]bool{
|
||||
"example.com/proj/pkg/test": true,
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
// Test package dependencies are new, so binary must be stale.
|
||||
{
|
||||
pkgStaleness: map[string]bool{
|
||||
"example.com/proj/cmd/p3/c12/c23": true,
|
||||
"strings": true,
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
// External test files are new, hence binary must be stale.
|
||||
{
|
||||
fileMtime: map[string]time.Time{
|
||||
"xfoo_test.go": time.Now().Add(1 * time.Hour),
|
||||
"xbar_test.go": time.Now().Add(2 * time.Hour),
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
// External test dependency is new, so binary must be stale.
|
||||
{
|
||||
pkgStaleness: map[string]bool{
|
||||
"os": true,
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
// Multiple source files and dependencies are new, so binary must be stale.
|
||||
{
|
||||
fileMtime: map[string]time.Time{
|
||||
"foo_test.go": time.Now().Add(1 * time.Hour),
|
||||
"xfoo_test.go": time.Now().Add(2 * time.Hour),
|
||||
"xbar_test.go": time.Now().Add(3 * time.Hour),
|
||||
},
|
||||
pkgStaleness: map[string]bool{
|
||||
"example.com/proj/pkg/p1": true,
|
||||
"example.com/proj/pkg/p1/c11": true,
|
||||
"example.com/proj/pkg/p2": true,
|
||||
"example.com/proj/cmd/p3/c12/c23": true,
|
||||
"strings": true,
|
||||
"os": true,
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
// Everything is new, so binary must be stale.
|
||||
{
|
||||
fileMtime: map[string]time.Time{
|
||||
"foo_test.go": time.Now().Add(3 * time.Hour),
|
||||
"bar_test.go": time.Now().Add(1 * time.Hour),
|
||||
"xfoo_test.go": time.Now().Add(2 * time.Hour),
|
||||
"xbar_test.go": time.Now().Add(1 * time.Hour),
|
||||
"xbaz_test.go": time.Now().Add(2 * time.Hour),
|
||||
},
|
||||
pkgStaleness: map[string]bool{
|
||||
"example.com/proj/pkg/p1": true,
|
||||
"example.com/proj/pkg/p1/c11": true,
|
||||
"example.com/proj/pkg/p2": true,
|
||||
"example.com/proj/cmd/p3/c12/c23": true,
|
||||
"example.com/proj/pkg/test": true,
|
||||
"strings": true,
|
||||
"testing": true,
|
||||
"os": true,
|
||||
},
|
||||
result: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
fgl, err := newFakegolist()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to setup the test: %v", err)
|
||||
}
|
||||
defer fgl.cleanup()
|
||||
|
||||
for fn, mtime := range tc.fileMtime {
|
||||
if err := fgl.chMtime(fn, mtime); err != nil {
|
||||
t.Fatalf("failed to change the mtime of %q: %v", fn, err)
|
||||
}
|
||||
}
|
||||
|
||||
for pkg, stale := range tc.pkgStaleness {
|
||||
if err := fgl.chStale(pkg, stale); err != nil {
|
||||
t.Fatalf("failed to change the staleness of %q: %v", pkg, err)
|
||||
}
|
||||
}
|
||||
|
||||
if tc.result != isTestStale(fgl, fgl.binfile, testPkg) {
|
||||
if tc.result {
|
||||
t.Errorf("Expected test package %q to be stale", testPkg)
|
||||
} else {
|
||||
t.Errorf("Expected test package %q to be not stale", testPkg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
vendor/k8s.io/kubernetes/hack/dev-build-and-push.sh
generated
vendored
Executable file
33
vendor/k8s.io/kubernetes/hack/dev-build-and-push.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script will build a dev release and push it to an existing cluster.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# Build a release
|
||||
"${KUBE_ROOT}/build-tools/release.sh"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Building a release failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now push this out to the cluster
|
||||
"${KUBE_ROOT}/cluster/kube-push.sh"
|
||||
34
vendor/k8s.io/kubernetes/hack/dev-build-and-up.sh
generated
vendored
Executable file
34
vendor/k8s.io/kubernetes/hack/dev-build-and-up.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script will build a dev release and bring up a new cluster with that
|
||||
# release.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# Then build a release
|
||||
"${KUBE_ROOT}/build-tools/release.sh"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Building the release failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now bring a new cluster up with that release.
|
||||
"${KUBE_ROOT}/cluster/kube-up.sh"
|
||||
49
vendor/k8s.io/kubernetes/hack/dev-push-hyperkube.sh
generated
vendored
Executable file
49
vendor/k8s.io/kubernetes/hack/dev-push-hyperkube.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script builds hyperkube and then the hyperkube image.
|
||||
# REGISTRY and VERSION must be set.
|
||||
# Example usage:
|
||||
# $ export REGISTRY=gcr.io/someone
|
||||
# $ export VERSION=v1.4.0-testfix
|
||||
# ./hack/dev-push-hyperkube.sh
|
||||
# That will build and push gcr.io/someone/hyperkube-amd64:v1.4.0-testfix
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
|
||||
source "${KUBE_ROOT}/build-tools/common.sh"
|
||||
|
||||
if [[ -z "${REGISTRY:-}" ]]; then
|
||||
echo "REGISTRY must be set"
|
||||
exit -1
|
||||
fi
|
||||
if [[ -z "${VERSION:-}" ]]; then
|
||||
echo "VERSION must be set"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
IMAGE="${REGISTRY}/hyperkube-amd64:${VERSION}"
|
||||
|
||||
kube::build::verify_prereqs
|
||||
kube::build::build_image
|
||||
kube::build::run_build_command make WHAT=cmd/hyperkube
|
||||
kube::build::copy_output
|
||||
|
||||
make -C "${KUBE_ROOT}/cluster/images/hyperkube" build
|
||||
docker push "${IMAGE}"
|
||||
26
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-add-master.sh
generated
vendored
Executable file
26
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-add-master.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
|
||||
if [[ ! -z "${1:-}" ]]; then
|
||||
export KUBE_GCE_ZONE="${1}"
|
||||
fi
|
||||
export KUBE_REPLICATE_EXISTING_MASTER=true
|
||||
export MULTIZONE=true
|
||||
|
||||
source "${KUBE_ROOT}/hack/e2e-internal/e2e-up.sh"
|
||||
|
||||
33
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-cluster-size.sh
generated
vendored
Executable file
33
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-cluster-size.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
|
||||
: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh}
|
||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
|
||||
|
||||
export KUBECTL KUBE_CONFIG_FILE
|
||||
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
prepare-e2e
|
||||
|
||||
#TODO(colhom): spec and implement federated version of this
|
||||
${KUBECTL} get nodes --no-headers | wc -l
|
||||
54
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-down.sh
generated
vendored
Executable file
54
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-down.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
|
||||
: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh}
|
||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
|
||||
|
||||
export KUBECTL KUBE_CONFIG_FILE
|
||||
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
prepare-e2e
|
||||
|
||||
if [[ "${FEDERATION:-}" == "true" ]];then
|
||||
source "${KUBE_ROOT}/federation/cluster/common.sh"
|
||||
for zone in ${E2E_ZONES};do
|
||||
# bring down an e2e cluster
|
||||
(
|
||||
set-federation-zone-vars "$zone"
|
||||
cleanup-federation-api-objects || echo "Couldn't cleanup federation api objects"
|
||||
|
||||
# TODO(madhusudancs): This is an arbitrary amount of sleep to give Kubernetes
|
||||
# clusters enough time to delete the underlying cloud provider resources
|
||||
# corresponding to the Kubernetes resources we deleted as part of the test
|
||||
# teardowns. It is shameful that we are doing this, but this is just a bandage
|
||||
# to stop the bleeding. Please don't use this pattern anywhere. Remove this
|
||||
# when proper cloud provider cleanups are implemented in the individual test
|
||||
# `AfterEach` blocks.
|
||||
sleep 2m
|
||||
|
||||
test-teardown
|
||||
)
|
||||
done
|
||||
else
|
||||
test-teardown
|
||||
fi
|
||||
25
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-remove-master.sh
generated
vendored
Executable file
25
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-remove-master.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
|
||||
if [[ ! -z "${1:-}" ]]; then
|
||||
export KUBE_GCE_ZONE="${1}"
|
||||
fi
|
||||
export KUBE_DELETE_NODES=false
|
||||
|
||||
source "${KUBE_ROOT}/hack/e2e-internal/e2e-down.sh"
|
||||
|
||||
47
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-status.sh
generated
vendored
Executable file
47
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-status.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
|
||||
: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh}
|
||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
|
||||
|
||||
export KUBECTL KUBE_CONFIG_FILE
|
||||
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
prepare-e2e
|
||||
|
||||
if [[ "${FEDERATION:-}" == "true" ]];then
|
||||
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation}
|
||||
#TODO(colhom): the last cluster that was created in the loop above is the current context.
|
||||
# Hence, it will be the cluster that hosts the federated components.
|
||||
# In the future, we will want to loop through the all the federated contexts,
|
||||
# select each one and call federated-up
|
||||
for zone in ${E2E_ZONES};do
|
||||
(
|
||||
set-federation-zone-vars "$zone"
|
||||
printf "\n\tChecking version for $OVERRIDE_CONTEXT\n"
|
||||
${KUBECTL} --context="$OVERRIDE_CONTEXT" version
|
||||
)
|
||||
done
|
||||
else
|
||||
${KUBECTL} version
|
||||
fi
|
||||
56
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-up.sh
generated
vendored
Executable file
56
vendor/k8s.io/kubernetes/hack/e2e-internal/e2e-up.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
|
||||
: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh}
|
||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
|
||||
|
||||
export KUBECTL KUBE_CONFIG_FILE
|
||||
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
prepare-e2e
|
||||
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
cur_ip_octet2=180
|
||||
# TODO(colhom): the last cluster that was created in the loop above is the current context.
|
||||
# Hence, it will be the cluster that hosts the federated components.
|
||||
# In the future, we will want to loop through the all the federated contexts,
|
||||
# select each one and call federated-up
|
||||
for zone in ${E2E_ZONES};do
|
||||
(
|
||||
export CLUSTER_IP_RANGE="10.${cur_ip_octet2}.0.0/16"
|
||||
set-federation-zone-vars "$zone"
|
||||
test-setup
|
||||
)
|
||||
cur_ip_octet2="$((cur_ip_octet2 + 1))"
|
||||
done
|
||||
tagfile="${KUBE_ROOT}/federation/manifests/federated-image.tag"
|
||||
if [[ ! -f "$tagfile" ]]; then
|
||||
echo "FATAL: tagfile ${tagfile} does not exist. Make sure that you have run build-tools/push-federation-images.sh"
|
||||
exit 1
|
||||
fi
|
||||
export FEDERATION_IMAGE_TAG="$(cat "${KUBE_ROOT}/federation/manifests/federated-image.tag")"
|
||||
|
||||
"${KUBE_ROOT}/federation/cluster/federation-up.sh"
|
||||
else
|
||||
test-setup
|
||||
fi
|
||||
43
vendor/k8s.io/kubernetes/hack/e2e-node-test.sh
generated
vendored
Executable file
43
vendor/k8s.io/kubernetes/hack/e2e-node-test.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# This script is a vestigial redirection. Please do not add "real" logic.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# For help output
|
||||
ARGHELP=""
|
||||
if [[ -n "${FOCUS:-}" ]]; then
|
||||
ARGHELP="FOCUS='${FOCUS}' "
|
||||
fi
|
||||
if [[ -n "${SKIP:-}" ]]; then
|
||||
ARGHELP="${ARGHELP}SKIP='${SKIP}'"
|
||||
fi
|
||||
|
||||
echo "NOTE: $0 has been replaced by 'make test-e2e-node'"
|
||||
echo
|
||||
echo "This script supports a number of parameters passed as environment variables."
|
||||
echo "Please see the Makfile for more details."
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make test-e2e-node ${ARGHELP}"
|
||||
echo
|
||||
echo
|
||||
make --no-print-directory -C "${KUBE_ROOT}" test-e2e-node FOCUS=${FOCUS:-} SKIP=${SKIP:-}
|
||||
963
vendor/k8s.io/kubernetes/hack/e2e.go
generated
vendored
Normal file
963
vendor/k8s.io/kubernetes/hack/e2e.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
34
vendor/k8s.io/kubernetes/hack/federated-ginkgo-e2e.sh
generated
vendored
Executable file
34
vendor/k8s.io/kubernetes/hack/federated-ginkgo-e2e.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
#A little hack to get the last zone. we always deploy federated cluster to the last zone.
|
||||
#TODO(colhom): deploy federated control plane to multiple underlying clusters in robust way
|
||||
lastZone=""
|
||||
for zone in ${E2E_ZONES};do
|
||||
lastZone="$zone"
|
||||
done
|
||||
(
|
||||
set-federation-zone-vars "$zone"
|
||||
"${KUBE_ROOT}/hack/ginkgo-e2e.sh" $@
|
||||
)
|
||||
45
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/Dockerfile
generated
vendored
Normal file
45
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/Dockerfile
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# 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 java:7-jre
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
asciidoctor \
|
||||
unzip \
|
||||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install gradle
|
||||
RUN wget -O /tmp/gradle.zip https://services.gradle.org/distributions/gradle-2.5-bin.zip \
|
||||
&& mkdir -p build/ \
|
||||
&& unzip /tmp/gradle.zip -d build/ \
|
||||
&& rm /tmp/gradle.zip \
|
||||
&& mkdir -p gradle-cache/
|
||||
|
||||
ENV GRADLE_USER_HOME=/gradle-cache
|
||||
|
||||
COPY build.gradle build/
|
||||
COPY gen-swagger-docs.sh build/
|
||||
|
||||
# Run the script once to download the dependent java libraries into the image
|
||||
RUN mkdir -p /output /swagger-source \
|
||||
&& wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1.json -O /swagger-source/v1.json \
|
||||
&& wget https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/pkg/api/v1/register.go -O /register.go \
|
||||
&& build/gen-swagger-docs.sh v1 \
|
||||
&& rm -rf /output/* /swagger-source/* /register.go
|
||||
|
||||
RUN chmod -R 777 build/ \
|
||||
&& chmod -R 777 gradle-cache/
|
||||
|
||||
ENTRYPOINT ["build/gen-swagger-docs.sh"]
|
||||
18
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/README.md
generated
vendored
Normal file
18
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
This folder contains the sources needed to build the gen-swagger-doc container.
|
||||
|
||||
To build the container image,
|
||||
|
||||
```
|
||||
$ sudo docker build -t gcr.io/google_containers/gen-swagger-docs:v1 .
|
||||
```
|
||||
|
||||
To generate the html docs,
|
||||
|
||||
```
|
||||
$ ./run-gen-swagger-docs.sh <API version> <absolute output path, default to PWD>
|
||||
```
|
||||
|
||||
The generated definitions.html and operations.html will be stored in output paths.
|
||||
|
||||
|
||||
[]()
|
||||
18
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/build.gradle
generated
vendored
Normal file
18
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/build.gradle
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.github.robwin:swagger2markup:0.6.0'
|
||||
}
|
||||
}
|
||||
|
||||
task gendocs << {
|
||||
io.github.robwin.swagger2markup.Swagger2MarkupConverter
|
||||
.from("./input.json")
|
||||
.build()
|
||||
.intoFolder("./");
|
||||
println '*** generating docs to ./'
|
||||
}
|
||||
5910
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/example-output/definitions.html
generated
vendored
Normal file
5910
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/example-output/definitions.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
23842
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/example-output/operations.html
generated
vendored
Normal file
23842
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/example-output/operations.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
69
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/gen-swagger-docs.sh
generated
vendored
Executable file
69
vendor/k8s.io/kubernetes/hack/gen-swagger-doc/gen-swagger-docs.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# Script to generate docs from the latest swagger spec.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
cd /build
|
||||
|
||||
# gendocs takes "input.json" as the input swagger spec.
|
||||
# $1 is expected to be <group>_<version>
|
||||
cp /swagger-source/"$1".json input.json
|
||||
|
||||
./gradle-2.5/bin/gradle gendocs --info
|
||||
|
||||
#insert a TOC for top level API objects
|
||||
buf="== Top Level API Objects\n\n"
|
||||
top_level_models=$(grep '&[A-Za-z]*{},' /register.go | sed 's/.*&//;s/{},//')
|
||||
|
||||
# check if the top level models exist in the definitions.adoc. If they exist,
|
||||
# their name will be <version>.<model_name>
|
||||
VERSION="${1#*_}"
|
||||
for m in $top_level_models
|
||||
do
|
||||
if grep -xq "=== ${VERSION}.$m" ./definitions.adoc
|
||||
then
|
||||
buf+="* <<${VERSION}.$m>>\n"
|
||||
fi
|
||||
done
|
||||
sed -i "1i $buf" ./definitions.adoc
|
||||
|
||||
# fix the links in .adoc, replace <<x.y>> with link:definitions.html#_x_y[x.y], and lowercase the _x_y part
|
||||
sed -i -e 's|<<\(.*\)\.\(.*\)>>|link:#_\L\1_\2\E[\1.\2]|g' ./definitions.adoc
|
||||
sed -i -e 's|<<\(.*\)\.\(.*\)>>|link:../definitions#_\L\1_\2\E[\1.\2]|g' ./paths.adoc
|
||||
|
||||
# fix the link to <<any>>
|
||||
sed -i -e 's|<<any>>|link:#_any[any]|g' ./definitions.adoc
|
||||
sed -i -e 's|<<any>>|link:../definitions#_any[any]|g' ./paths.adoc
|
||||
|
||||
# change the title of paths.adoc from "paths" to "operations"
|
||||
sed -i 's|== Paths|== Operations|g' ./paths.adoc
|
||||
|
||||
# $$ has special meaning in asciidoc, we need to escape it
|
||||
sed -i 's|\$\$|+++$$+++|g' ./definitions.adoc
|
||||
|
||||
echo -e "=== any\nRepresents an untyped JSON map - see the description of the field for more info about the structure of this object." >> ./definitions.adoc
|
||||
|
||||
asciidoctor definitions.adoc
|
||||
asciidoctor paths.adoc
|
||||
|
||||
cp definitions.html /output/
|
||||
cp paths.html /output/operations.html
|
||||
|
||||
echo "SUCCESS"
|
||||
61
vendor/k8s.io/kubernetes/hack/generate-bindata.sh
generated
vendored
Executable file
61
vendor/k8s.io/kubernetes/hack/generate-bindata.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
if [[ -z "${KUBE_ROOT:-}" ]]; then
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
fi
|
||||
|
||||
source "${KUBE_ROOT}/cluster/lib/logging.sh"
|
||||
|
||||
if [[ ! -d "${KUBE_ROOT}/examples" ]]; then
|
||||
echo "${KUBE_ROOT}/examples not detected. This script should be run from a location where the source dirs are available."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# kube::golang::build_kube_toolchain installs the vendored go-bindata in
|
||||
# $GOPATH/bin, so make sure that's explicitly part of our $PATH.
|
||||
export PATH="${GOPATH}/bin:${PATH}"
|
||||
|
||||
if ! which go-bindata &>/dev/null ; then
|
||||
echo "Cannot find go-bindata."
|
||||
exit 5
|
||||
fi
|
||||
|
||||
BINDATA_OUTPUT="${KUBE_ROOT}/test/e2e/generated/bindata.go"
|
||||
go-bindata -nometadata -prefix "${KUBE_ROOT}" -o "${BINDATA_OUTPUT}.tmp" -pkg generated \
|
||||
-ignore .jpg -ignore .png -ignore .md \
|
||||
"${KUBE_ROOT}/examples/..." \
|
||||
"${KUBE_ROOT}/test/e2e/testing-manifests/..." \
|
||||
"${KUBE_ROOT}/test/images/..." \
|
||||
"${KUBE_ROOT}/test/fixtures/..."
|
||||
|
||||
gofmt -s -w "${BINDATA_OUTPUT}.tmp"
|
||||
|
||||
# Here we compare and overwrite only if different to avoid updating the
|
||||
# timestamp and triggering a rebuild. The 'cat' redirect trick to preserve file
|
||||
# permissions of the target file.
|
||||
if ! cmp -s "${BINDATA_OUTPUT}.tmp" "${BINDATA_OUTPUT}" ; then
|
||||
cat "${BINDATA_OUTPUT}.tmp" > "${BINDATA_OUTPUT}"
|
||||
V=2 kube::log::info "Generated bindata file : ${BINDATA_OUTPUT} has $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"
|
||||
else
|
||||
V=2 kube::log::info "No changes in generated bindata file: ${BINDATA_OUTPUT}"
|
||||
fi
|
||||
|
||||
rm -f "${BINDATA_OUTPUT}.tmp"
|
||||
54
vendor/k8s.io/kubernetes/hack/generate-docs.sh
generated
vendored
Executable file
54
vendor/k8s.io/kubernetes/hack/generate-docs.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This file is not intended to be run automatically. It is meant to be run
|
||||
# immediately before exporting docs. We do not want to check these documents in
|
||||
# by default.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
BINS=(
|
||||
cmd/gendocs
|
||||
cmd/genkubedocs
|
||||
cmd/genman
|
||||
cmd/genyaml
|
||||
federation/cmd/genfeddocs
|
||||
)
|
||||
make -C "${KUBE_ROOT}" WHAT="${BINS[*]}"
|
||||
|
||||
kube::util::ensure-temp-dir
|
||||
|
||||
kube::util::gen-docs "${KUBE_TEMP}"
|
||||
|
||||
# remove all of the old docs
|
||||
kube::util::remove-gen-docs
|
||||
|
||||
# Copy fresh docs into the repo.
|
||||
# the shopt is so that we get .generated_docs from the glob.
|
||||
shopt -s dotglob
|
||||
cp -af "${KUBE_TEMP}"/* "${KUBE_ROOT}"
|
||||
shopt -u dotglob
|
||||
|
||||
echo "Generated docs have been placed in the repository tree. Running hack/update-munge-docs.sh."
|
||||
|
||||
"${KUBE_ROOT}/hack/update-munge-docs.sh"
|
||||
83
vendor/k8s.io/kubernetes/hack/get-build.sh
generated
vendored
Executable file
83
vendor/k8s.io/kubernetes/hack/get-build.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
source "${KUBE_ROOT}/cluster/common.sh"
|
||||
|
||||
declare -r KUBE_RELEASE_BUCKET_URL="https://storage.googleapis.com/kubernetes-release"
|
||||
declare -r KUBE_DEV_RELEASE_BUCKET_URL="https://storage.googleapis.com/kubernetes-release-dev"
|
||||
declare -r KUBE_TAR_NAME="kubernetes.tar.gz"
|
||||
|
||||
usage() {
|
||||
echo "${0} [-v] <version number or publication>"
|
||||
echo " -v: Don't get tars, just print the version number"
|
||||
echo ""
|
||||
echo ' Version number or publication is either a proper version number'
|
||||
echo ' (e.g. "v1.0.6", "v1.2.0-alpha.1.881+376438b69c7612") or a version'
|
||||
echo ' publication of the form <bucket>/<version> (e.g. "release/stable",'
|
||||
echo ' "ci/latest-1"). Some common ones are:'
|
||||
echo ' - "release/stable"'
|
||||
echo ' - "release/latest"'
|
||||
echo ' - "ci/latest"'
|
||||
echo ' See the docs on getting builds for more information about version'
|
||||
echo ' publication.'
|
||||
}
|
||||
|
||||
print_version=false
|
||||
|
||||
while getopts ":vh" opt; do
|
||||
case ${opt} in
|
||||
v)
|
||||
print_version="true"
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set_binary_version "${1}"
|
||||
|
||||
if [[ "${print_version}" == "true" ]]; then
|
||||
echo "${KUBE_VERSION}"
|
||||
else
|
||||
echo "Using version at ${1}: ${KUBE_VERSION}" >&2
|
||||
if [[ ${KUBE_VERSION} =~ ${KUBE_RELEASE_VERSION_REGEX} ]]; then
|
||||
curl --fail -o "kubernetes-${KUBE_VERSION}.tar.gz" "${KUBE_RELEASE_BUCKET_URL}/release/${KUBE_VERSION}/${KUBE_TAR_NAME}"
|
||||
elif [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
|
||||
curl --fail -o "kubernetes-${KUBE_VERSION}.tar.gz" "${KUBE_DEV_RELEASE_BUCKET_URL}/ci/${KUBE_VERSION}/${KUBE_TAR_NAME}"
|
||||
else
|
||||
echo "Version doesn't match regexp" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
139
vendor/k8s.io/kubernetes/hack/ginkgo-e2e.sh
generated
vendored
Executable file
139
vendor/k8s.io/kubernetes/hack/ginkgo-e2e.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,139 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/cluster/common.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
# Find the ginkgo binary build as part of the release.
|
||||
ginkgo=$(kube::util::find-binary "ginkgo")
|
||||
e2e_test=$(kube::util::find-binary "e2e.test")
|
||||
|
||||
# --- Setup some env vars.
|
||||
|
||||
GINKGO_PARALLEL=${GINKGO_PARALLEL:-n} # set to 'y' to run tests in parallel
|
||||
|
||||
# If 'y', will rerun failed tests once to give them a second chance.
|
||||
GINKGO_TOLERATE_FLAKES=${GINKGO_TOLERATE_FLAKES:-n}
|
||||
|
||||
# The number of tests that can run in parallel depends on what tests
|
||||
# are running and on the size of the cluster. Too many, and tests will
|
||||
# fail due to resource contention. 25 is a reasonable default for a
|
||||
# 3-node (n1-standard-1) cluster running all fast, non-disruptive tests.
|
||||
GINKGO_PARALLELISM=${GINKGO_PARALLELISM:-25}
|
||||
|
||||
: ${KUBECTL:="${KUBE_ROOT}/cluster/kubectl.sh"}
|
||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
|
||||
|
||||
export KUBECTL KUBE_CONFIG_FILE
|
||||
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
# ---- Do cloud-provider-specific setup
|
||||
if [[ -n "${KUBERNETES_CONFORMANCE_TEST:-}" ]]; then
|
||||
echo "Conformance test: not doing test setup."
|
||||
KUBERNETES_PROVIDER=${KUBERNETES_CONFORMANCE_PROVIDER:-"skeleton"}
|
||||
|
||||
detect-master-from-kubeconfig
|
||||
|
||||
auth_config=(
|
||||
"--kubeconfig=${KUBECONFIG}"
|
||||
)
|
||||
else
|
||||
echo "Setting up for KUBERNETES_PROVIDER=\"${KUBERNETES_PROVIDER}\"."
|
||||
|
||||
prepare-e2e
|
||||
|
||||
detect-master >/dev/null
|
||||
KUBE_MASTER_URL="${KUBE_MASTER_URL:-https://${KUBE_MASTER_IP:-}}"
|
||||
|
||||
auth_config=(
|
||||
"--kubeconfig=${KUBECONFIG:-$DEFAULT_KUBECONFIG}"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
|
||||
NODE_INSTANCE_GROUP="${NODE_INSTANCE_PREFIX}-group"
|
||||
else
|
||||
NODE_INSTANCE_GROUP=""
|
||||
fi
|
||||
|
||||
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
|
||||
set_num_migs
|
||||
NODE_INSTANCE_GROUP=""
|
||||
for ((i=1; i<=${NUM_MIGS}; i++)); do
|
||||
if [[ $i == ${NUM_MIGS} ]]; then
|
||||
# We are assigning the same mig names as create-nodes function from cluster/gce/util.sh.
|
||||
NODE_INSTANCE_GROUP="${NODE_INSTANCE_GROUP}${NODE_INSTANCE_PREFIX}-group"
|
||||
else
|
||||
NODE_INSTANCE_GROUP="${NODE_INSTANCE_GROUP}${NODE_INSTANCE_PREFIX}-group-${i},"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
|
||||
detect-node-instance-groups
|
||||
NODE_INSTANCE_GROUP=$(kube::util::join , "${NODE_INSTANCE_GROUPS[@]}")
|
||||
fi
|
||||
|
||||
ginkgo_args=()
|
||||
if [[ -n "${CONFORMANCE_TEST_SKIP_REGEX:-}" ]]; then
|
||||
ginkgo_args+=("--skip=${CONFORMANCE_TEST_SKIP_REGEX}")
|
||||
ginkgo_args+=("--seed=1436380640")
|
||||
fi
|
||||
if [[ -n "${GINKGO_PARALLEL_NODES:-}" ]]; then
|
||||
ginkgo_args+=("--nodes=${GINKGO_PARALLEL_NODES}")
|
||||
elif [[ ${GINKGO_PARALLEL} =~ ^[yY]$ ]]; then
|
||||
ginkgo_args+=("--nodes=25")
|
||||
fi
|
||||
|
||||
FLAKE_ATTEMPTS=1
|
||||
if [[ "${GINKGO_TOLERATE_FLAKES}" == "y" ]]; then
|
||||
FLAKE_ATTEMPTS=2
|
||||
fi
|
||||
|
||||
# The --host setting is used only when providing --auth_config
|
||||
# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig
|
||||
# file and the one provided with --host is ignored.
|
||||
# Add path for things like running kubectl binary.
|
||||
export PATH=$(dirname "${e2e_test}"):"${PATH}"
|
||||
"${ginkgo}" "${ginkgo_args[@]:+${ginkgo_args[@]}}" "${e2e_test}" -- \
|
||||
"${auth_config[@]:+${auth_config[@]}}" \
|
||||
--ginkgo.flakeAttempts="${FLAKE_ATTEMPTS}" \
|
||||
--host="${KUBE_MASTER_URL}" \
|
||||
--provider="${KUBERNETES_PROVIDER}" \
|
||||
--gce-project="${PROJECT:-}" \
|
||||
--gce-zone="${ZONE:-}" \
|
||||
--gke-cluster="${CLUSTER_NAME:-}" \
|
||||
--kube-master="${KUBE_MASTER:-}" \
|
||||
--cluster-tag="${CLUSTER_ID:-}" \
|
||||
--repo-root="${KUBE_ROOT}" \
|
||||
--node-instance-group="${NODE_INSTANCE_GROUP:-}" \
|
||||
--prefix="${KUBE_GCE_INSTANCE_PREFIX:-e2e}" \
|
||||
--network="${KUBE_GCE_NETWORK:-${KUBE_GKE_NETWORK:-e2e}}" \
|
||||
${KUBE_CONTAINER_RUNTIME:+"--container-runtime=${KUBE_CONTAINER_RUNTIME}"} \
|
||||
${MASTER_OS_DISTRIBUTION:+"--master-os-distro=${MASTER_OS_DISTRIBUTION}"} \
|
||||
${NODE_OS_DISTRIBUTION:+"--node-os-distro=${NODE_OS_DISTRIBUTION}"} \
|
||||
${NUM_NODES:+"--num-nodes=${NUM_NODES}"} \
|
||||
${E2E_CLEAN_START:+"--clean-start=true"} \
|
||||
${E2E_MIN_STARTUP_PODS:+"--minStartupPods=${E2E_MIN_STARTUP_PODS}"} \
|
||||
${E2E_REPORT_DIR:+"--report-dir=${E2E_REPORT_DIR}"} \
|
||||
${E2E_REPORT_PREFIX:+"--report-prefix=${E2E_REPORT_PREFIX}"} \
|
||||
"${@:-}"
|
||||
46
vendor/k8s.io/kubernetes/hack/godep-save.sh
generated
vendored
Executable file
46
vendor/k8s.io/kubernetes/hack/godep-save.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
export GOPATH=${GOPATH}:${KUBE_ROOT}/staging
|
||||
GODEP="${GODEP:-godep}"
|
||||
|
||||
|
||||
# Some things we want in godeps aren't code dependencies, so ./...
|
||||
# won't pick them up.
|
||||
REQUIRED_BINS=(
|
||||
"github.com/ugorji/go/codec/codecgen"
|
||||
"github.com/onsi/ginkgo/ginkgo"
|
||||
"github.com/jteeuwen/go-bindata/go-bindata"
|
||||
"./..."
|
||||
)
|
||||
|
||||
pushd "${KUBE_ROOT}" > /dev/null
|
||||
"${GODEP}" version
|
||||
GO15VENDOREXPERIMENT=1 ${GODEP} save "${REQUIRED_BINS[@]}"
|
||||
# create a symlink in vendor directory pointing to the staging client. This
|
||||
# let other packages use the staging client as if it were vendored.
|
||||
if [ ! -e "vendor/k8s.io/client-go" ]; then
|
||||
ln -s ../../staging/src/k8s.io/client-go vendor/k8s.io/client-go
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
echo "Don't forget to run hack/update-godep-licenses.sh if you added or removed a dependency!"
|
||||
300
vendor/k8s.io/kubernetes/hack/grab-profiles.sh
generated
vendored
Executable file
300
vendor/k8s.io/kubernetes/hack/grab-profiles.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,300 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
function grab_profiles_from_component {
|
||||
local requested_profiles=$1
|
||||
local mem_pprof_flags=$2
|
||||
local binary=$3
|
||||
local tunnel_port=$4
|
||||
local path=$5
|
||||
local output_prefix=$6
|
||||
local timestamp=$7
|
||||
|
||||
echo "binary: $binary"
|
||||
|
||||
for profile in ${requested_profiles}; do
|
||||
case ${profile} in
|
||||
cpu)
|
||||
go tool pprof "-pdf" "${binary}" "http://localhost:${tunnel_port}${path}/debug/pprof/profile" > "${output_prefix}-${profile}-profile-${timestamp}.pdf"
|
||||
;;
|
||||
mem)
|
||||
# There are different kinds of memory profiles that are available that
|
||||
# had to be grabbed separately: --inuse-space, --inuse-objects,
|
||||
# --alloc-space, --alloc-objects. We need to iterate over all requested
|
||||
# kinds.
|
||||
for flag in ${mem_pprof_flags}; do
|
||||
go tool pprof "-${flag}" "-pdf" "${binary}" "http://localhost:${tunnel_port}${path}/debug/pprof/heap" > "${output_prefix}-${profile}-${flag}-profile-${timestamp}.pdf"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
server_addr=""
|
||||
kubelet_addreses=""
|
||||
kubelet_binary=""
|
||||
master_binary=""
|
||||
scheduler_binary=""
|
||||
scheduler_port="10251"
|
||||
controller_manager_port="10252"
|
||||
controller_manager_binary=""
|
||||
requested_profiles=""
|
||||
mem_pprof_flags=""
|
||||
profile_components=""
|
||||
output_dir="."
|
||||
tunnel_port="${tunnel_port:-1234}"
|
||||
|
||||
args=$(getopt -o s:mho:k:c -l server:,master,heapster,output:,kubelet:,scheduler,controller-manager,help,inuse-space,inuse-objects,alloc-space,alloc-objects,cpu,kubelet-binary:,master-binary:,scheduler-binary:,controller-manager-binary:,scheduler-port:,controller-manager-port: -- "$@")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
>&2 echo "Error in getopt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HEAPSTER_VERSION="v0.18.2"
|
||||
MASTER_PPROF_PATH=""
|
||||
HEAPSTER_PPROF_PATH="/api/v1/proxy/namespaces/kube-system/services/monitoring-heapster"
|
||||
KUBELET_PPROF_PATH_PREFIX="/api/v1/proxy/nodes"
|
||||
SCHEDULER_PPROF_PATH_PREFIX="/api/v1/proxy/namespaces/kube-system/pods/kube-scheduler"
|
||||
CONTROLLER_MANAGER_PPROF_PATH_PREFIX="/api/v1/proxy/namespaces/kube-system/pods/kube-controller-manager"
|
||||
|
||||
eval set -- "${args}"
|
||||
|
||||
while true; do
|
||||
case $1 in
|
||||
-s|--server)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argument to --server flag"
|
||||
exit 1
|
||||
fi
|
||||
server_addr=$1
|
||||
shift
|
||||
;;
|
||||
-m|--master)
|
||||
shift
|
||||
profile_components="master ${profile_components}"
|
||||
;;
|
||||
--master-binary)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --master-binary flag"
|
||||
exit 1
|
||||
fi
|
||||
master_binary=$1
|
||||
shift
|
||||
;;
|
||||
-h|--heapster)
|
||||
shift
|
||||
profile_components="heapster ${profile_components}"
|
||||
;;
|
||||
-k|--kubelet)
|
||||
shift
|
||||
profile_components="kubelet ${profile_components}"
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --kubelet flag"
|
||||
exit 1
|
||||
fi
|
||||
kubelet_addreses="$1 $kubelet_addreses"
|
||||
shift
|
||||
;;
|
||||
--kubelet-binary)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --kubelet-binary flag"
|
||||
exit 1
|
||||
fi
|
||||
kubelet_binary=$1
|
||||
shift
|
||||
;;
|
||||
--scheduler)
|
||||
shift
|
||||
profile_components="scheduler ${profile_components}"
|
||||
;;
|
||||
--scheduler-binary)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --scheduler-binary flag"
|
||||
exit 1
|
||||
fi
|
||||
scheduler_binary=$1
|
||||
shift
|
||||
;;
|
||||
--scheduler-port)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --scheduler-port flag"
|
||||
exit 1
|
||||
fi
|
||||
scheduler_port=$1
|
||||
shift
|
||||
;;
|
||||
-c|--controller-manager)
|
||||
shift
|
||||
profile_components="controller-manager ${profile_components}"
|
||||
;;
|
||||
--controller-manager-binary)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --controller-manager-binary flag"
|
||||
exit 1
|
||||
fi
|
||||
controller_manager_binary=$1
|
||||
shift
|
||||
;;
|
||||
--controller-manager-port)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argumet to --controller-manager-port flag"
|
||||
exit 1
|
||||
fi
|
||||
controller-managerr_port=$1
|
||||
shift
|
||||
;;
|
||||
-o|--output)
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "empty argument to --output flag"
|
||||
exit 1
|
||||
fi
|
||||
output_dir=$1
|
||||
shift
|
||||
;;
|
||||
--inuse-space)
|
||||
shift
|
||||
requested_profiles="mem ${requested_profiles}"
|
||||
mem_pprof_flags="inuse_space ${mem_pprof_flags}"
|
||||
;;
|
||||
--inuse-objects)
|
||||
shift
|
||||
requested_profiles="mem ${requested_profiles}"
|
||||
mem_pprof_flags="inuse_objects ${mem_pprof_flags}"
|
||||
;;
|
||||
--alloc-space)
|
||||
shift
|
||||
requested_profiles="mem ${requested_profiles}"
|
||||
mem_pprof_flags="alloc_space ${mem_pprof_flags}"
|
||||
;;
|
||||
--alloc-objects)
|
||||
shift
|
||||
requested_profiles="mem ${requested_profiles}"
|
||||
mem_pprof_flags="alloc_objects ${mem_pprof_flags}"
|
||||
;;
|
||||
--cpu)
|
||||
shift
|
||||
requested_profiles="cpu ${requested_profiles}"
|
||||
;;
|
||||
--help)
|
||||
shift
|
||||
echo "Recognized options:
|
||||
-o/--output,
|
||||
-s/--server,
|
||||
-m/--master,
|
||||
-h/--heapster,
|
||||
--inuse-space,
|
||||
--inuse-objects,
|
||||
--alloc-space,
|
||||
--alloc-objects,
|
||||
--cpu,
|
||||
--help"
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "${server_addr}" ]]; then
|
||||
>&2 echo "Server flag is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${profile_components}" ]]; then
|
||||
>&2 echo "Choose at least one component to profile"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${requested_profiles}" ]]; then
|
||||
>&2 echo "Choose at least one profiling option"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gcloud compute ssh "${server_addr}" --ssh-flag=-nN --ssh-flag=-L${tunnel_port}:localhost:8080 &
|
||||
|
||||
echo "Waiting for tunnel to be created..."
|
||||
kube::util::wait_for_url http://localhost:${tunnel_port}/healthz
|
||||
|
||||
SSH_PID=$(pgrep -f "/usr/bin/ssh.*${tunnel_port}:localhost:8080")
|
||||
kube::util::trap_add 'kill $SSH_PID' EXIT
|
||||
kube::util::trap_add 'kill $SSH_PID' SIGTERM
|
||||
|
||||
requested_profiles=$(echo ${requested_profiles} | xargs -n1 | LC_ALL=C sort -u | xargs)
|
||||
profile_components=$(echo ${profile_components} | xargs -n1 | LC_ALL=C sort -u | xargs)
|
||||
kubelet_addreses=$(echo ${kubelet_addreses} | xargs -n1 | LC_ALL=C sort -u | xargs)
|
||||
echo "requested profiles: ${requested_profiles}"
|
||||
echo "flags for heap profile: ${mem_pprof_flags}"
|
||||
|
||||
timestamp=$(date +%Y%m%d%H%M%S)
|
||||
binary=""
|
||||
|
||||
for component in ${profile_components}; do
|
||||
case ${component} in
|
||||
master)
|
||||
path=${MASTER_PPROF_PATH}
|
||||
binary=${master_binary}
|
||||
;;
|
||||
controller-manager)
|
||||
path="${CONTROLLER_MANAGER_PPROF_PATH_PREFIX}-${server_addr}:${controller_manager_port}"
|
||||
binary=${controller_manager_binary}
|
||||
;;
|
||||
scheduler)
|
||||
path="${SCHEDULER_PPROF_PATH_PREFIX}-${server_addr}:${scheduler_port}"
|
||||
binary=${scheduler_binary}
|
||||
;;
|
||||
heapster)
|
||||
rm heapster
|
||||
wget https://github.com/kubernetes/heapster/releases/download/${HEAPSTER_VERSION}/heapster
|
||||
kube::util::trap_add 'rm -f heapster' EXIT
|
||||
kube::util::trap_add 'rm -f heapster' SIGTERM
|
||||
binary=heapster
|
||||
path=${HEAPSTER_PPROF_PATH}
|
||||
;;
|
||||
kubelet)
|
||||
path="${KUBELET_PPROF_PATH_PREFIX}"
|
||||
if [[ -z "${kubelet_binary}" ]]; then
|
||||
binary="${KUBE_ROOT}/_output/local/bin/linux/amd64/kubelet"
|
||||
else
|
||||
binary=${kubelet_binary}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${component}" == "kubelet" ]]; then
|
||||
for node in $(echo ${kubelet_addreses} | sed 's/[,;]/\n/g'); do
|
||||
grab_profiles_from_component "${requested_profiles}" "${mem_pprof_flags}" "${binary}" "${tunnel_port}" "${path}/${node}" "${output_dir}/${component}" "${timestamp}"
|
||||
done
|
||||
else
|
||||
grab_profiles_from_component "${requested_profiles}" "${mem_pprof_flags}" "${binary}" "${tunnel_port}" "${path}" "${output_dir}/${component}" "${timestamp}"
|
||||
fi
|
||||
done
|
||||
27
vendor/k8s.io/kubernetes/hack/install-etcd.sh
generated
vendored
Executable file
27
vendor/k8s.io/kubernetes/hack/install-etcd.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# Convenience script to download and install etcd in third_party.
|
||||
# Mostly just used by CI.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::etcd::install
|
||||
5
vendor/k8s.io/kubernetes/hack/jenkins/OWNERS
generated
vendored
Normal file
5
vendor/k8s.io/kubernetes/hack/jenkins/OWNERS
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
assignees:
|
||||
- fejta
|
||||
- ixdy
|
||||
- rmmh
|
||||
- spxtr
|
||||
100
vendor/k8s.io/kubernetes/hack/jenkins/README.md
generated
vendored
Normal file
100
vendor/k8s.io/kubernetes/hack/jenkins/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# Jenkins
|
||||
|
||||
[Jenkins](http://jenkins-ci.org/) is a pluggable continuous
|
||||
integration system. The Google team is running two Jenkins servers in GCE for
|
||||
the Kubernetes project. The post-commit instance runs continuous builds, unit
|
||||
tests, integration tests, code verification tests, and end-to-end tests on
|
||||
multiple providers using the latest commits to the Kubernetes repo from the
|
||||
master and release branches. The PR Jenkins instance runs these tests on each
|
||||
PR by a trusted contributor, it but only runs a subset of the end-to-end tests
|
||||
and only on GCE.
|
||||
|
||||
## General flow
|
||||
The flow of the post-commit Jenkins instance:
|
||||
* Under the `kubernetes-build` job: Every 2 minutes, Jenkins polls for a batch
|
||||
of new commits, after which it runs the `build.sh` script (in this directory)
|
||||
on the latest tip. This results in build assets getting pushed to GCS and the
|
||||
`latest.txt` file in the `ci` bucket being updated.
|
||||
* On trigger, and every half hour (which effectively means all the time, unless
|
||||
we're failing cluster creation), e2e variants run, on the latest build assets
|
||||
in GCS:
|
||||
* `kubernetes-e2e-gce`: Standard GCE e2e.
|
||||
* `kubernetes-e2e-gke`: GKE provider e2e, with head k8s client and GKE
|
||||
creating clusters at its default version.
|
||||
* `kubernetes-e2e-aws`: AWS provider e2e. This only runs once a day.
|
||||
* Each job will not run concurrently with itself, so, for instance,
|
||||
Jenkins executor will only ever run one `kubernetes-build`
|
||||
job. However, it may run the jobs in parallel,
|
||||
i.e. `kubernetes-build` may be run at the same time as
|
||||
`kubernetes-e2e-gce`. For this reason, you may see your changes
|
||||
pushed to our GCS bucket rapidly, but they may take some time to
|
||||
fully work through Jenkins. Or you may get lucky and catch the
|
||||
train in 5 minutes.
|
||||
* There are many jobs not listed here, including upgrade tests, soak tests, and
|
||||
tests for previous releases.
|
||||
|
||||
## Scripts
|
||||
|
||||
The scripts in this directory are directly used by Jenkins, either by
|
||||
curl from githubusercontent (if we don't have a git checkout handy) or
|
||||
by executing it from the git checkout. Since Jenkins is an entity
|
||||
outside this repository, it's tricky to keep documentation for it up
|
||||
to date quickly. However, the scripts themselves attempt to provide
|
||||
color for the configuration(s) that each script runs in.
|
||||
|
||||
## GCS Log Format
|
||||
|
||||
Our `upload-to-gcs.sh` script runs at the start and end of every job. Logs on
|
||||
post-commit Jenkins go under `gs://kubernetes-jenkins/logs/`. Logs on PR
|
||||
Jenkins go under `gs://kubernetes-jenkins-pull/pr-logs/pull/PULL_NUMBER/`.
|
||||
Individual run logs go into the `JOB_NAME/BUILD_NUMBER` folder.
|
||||
|
||||
At the start of the job, it uploads `started.json` containing the version of
|
||||
Kubernetes under test and the timestamp.
|
||||
|
||||
At the end, it uploads `finished.json` containing the result and timestamp, as
|
||||
well as the build log into `build-log.txt`. Under `artifacts/` we put our
|
||||
test results in `junit_XY.xml`, along with gcp resource lists and cluster logs.
|
||||
|
||||
It also updates `latest-build.txt` at the end to point to this build number.
|
||||
In the end, the directory structure looks like this:
|
||||
|
||||
```
|
||||
gs://kubernetes-jenkins/logs/kubernetes-e2e-gce/
|
||||
latest-build.txt
|
||||
12345/
|
||||
build-log.txt
|
||||
started.json
|
||||
finished.json
|
||||
artifacts/
|
||||
gcp-resources-{before, after}.txt
|
||||
junit_{00, 01, ...}.xml
|
||||
jenkins-e2e-master/{kube-apiserver.log, ...}
|
||||
jenkins-e2e-node-abcd/{kubelet.log, ...}
|
||||
12344/
|
||||
...
|
||||
```
|
||||
|
||||
The munger uses `latest-build.txt` and the JUnit reports to figure out whether
|
||||
or not the job is healthy.
|
||||
|
||||
## Job Builder
|
||||
|
||||
New jobs should be specified as YAML files to be processed by [Jenkins Job
|
||||
Builder](http://docs.openstack.org/infra/jenkins-job-builder/). The YAML files
|
||||
live in `jenkins/job-configs` and its subfolders **in the
|
||||
[kubernetes/test-infra repository](https://github.com/kubernetes/test-infra)**.
|
||||
Jenkins runs Jenkins Job Builder in a Docker container defined in
|
||||
`job-builder-image`, and triggers it using `update-jobs.sh`. Jenkins Job Builder
|
||||
uses a config file called
|
||||
[jenkins_jobs.ini](http://docs.openstack.org/infra/jenkins-job-builder/execution.html)
|
||||
which contains the location and credentials of the Jenkins server.
|
||||
|
||||
E2E Job definitions are templated to avoid code duplication. To add a new job,
|
||||
add a new entry to the appropriate `project`.
|
||||
[This](https://github.com/kubernetes/kubernetes/commit/eb273e5a4bdd3905f881563ada4e6543c7eb96b5)
|
||||
is an example of a commit which does this. If necessary, create a new project, as in
|
||||
[this](https://github.com/kubernetes/kubernetes/commit/09c27cdabc300e0420a2914100bedb565c23ed73)
|
||||
commit.
|
||||
|
||||
[]()
|
||||
77
vendor/k8s.io/kubernetes/hack/jenkins/build.sh
generated
vendored
Executable file
77
vendor/k8s.io/kubernetes/hack/jenkins/build.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# kubernetes-build job: Triggered by github checkins on a 5 minute
|
||||
# poll. We abort this job if it takes longer than 10m. (Typically this
|
||||
# job takes about ~5m as of 0.8.0, but it's actually not completely
|
||||
# hermetic right now due to things like the golang image. It can take
|
||||
# ~8m if you force it to be totally hermetic.)
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
# !!! ALERT !!! Jenkins default $HOME is /var/lib/jenkins, which is
|
||||
# global across jobs. We change $HOME instead to ${WORKSPACE}, which
|
||||
# is an incoming variable Jenkins provides us for this job's scratch
|
||||
# space.
|
||||
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
|
||||
# Skip gcloud update checking
|
||||
export CLOUDSDK_COMPONENT_MANAGER_DISABLE_UPDATE_CHECK=true
|
||||
|
||||
# FEDERATION?
|
||||
: ${FEDERATION:="false"}
|
||||
: ${KUBE_RELEASE_RUN_TESTS:="n"}
|
||||
export KUBE_RELEASE_RUN_TESTS
|
||||
|
||||
# Clean stuff out. Assume the last build left the tree in an odd
|
||||
# state.
|
||||
rm -rf ~/.kube*
|
||||
make clean
|
||||
|
||||
# Uncomment if you want to purge the Docker cache completely each
|
||||
# build. It costs about 150s each build to pull the golang image and
|
||||
# rebuild the kube-build:cross image, but these rarely change.
|
||||
# docker ps -aq | xargs -r docker rm
|
||||
# docker images -q | xargs -r docker rmi
|
||||
|
||||
# Build
|
||||
# Jobs explicitly set KUBE_FASTBUILD to desired settings.
|
||||
make release
|
||||
|
||||
# Push to GCS?
|
||||
if [[ ${KUBE_SKIP_PUSH_GCS:-} =~ ^[yY]$ ]]; then
|
||||
echo "Not pushed to GCS..."
|
||||
else
|
||||
readonly release_infra_clone="${WORKSPACE}/_tmp/release.git"
|
||||
mkdir -p ${WORKSPACE}/_tmp
|
||||
git clone https://github.com/kubernetes/release ${release_infra_clone}
|
||||
|
||||
push_build=${release_infra_clone}/push-build.sh
|
||||
|
||||
[[ -n "${KUBE_GCS_RELEASE_BUCKET-}" ]] \
|
||||
&& bucket_flag="--bucket=${KUBE_GCS_RELEASE_BUCKET-}"
|
||||
${FEDERATION} && federation_flag="--federation"
|
||||
[[ -n "${KUBE_GCS_RELEASE_SUFFIX-}" ]] \
|
||||
&& gcs_suffix_flag="--gcs-suffix=${KUBE_GCS_RELEASE_SUFFIX-}"
|
||||
${push_build} ${bucket_flag-} ${federation_flag-} ${gcs_suffix_flag-} \
|
||||
--nomock --verbose --ci
|
||||
fi
|
||||
|
||||
sha256sum _output/release-tars/kubernetes*.tar.gz
|
||||
45
vendor/k8s.io/kubernetes/hack/jenkins/gotest.sh
generated
vendored
Executable file
45
vendor/k8s.io/kubernetes/hack/jenkins/gotest.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# Runs the unit and integration tests, production JUnit-style XML test reports
|
||||
# in ${WORKSPACE}/_artifacts.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
# !!! ALERT !!! Jenkins default $HOME is /var/lib/jenkins, which is
|
||||
# global across jobs. We change $HOME instead to ${WORKSPACE}, which
|
||||
# is an incoming variable Jenkins provides us for this job's scratch
|
||||
# space.
|
||||
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
|
||||
export GOPATH=${HOME}/_gopath
|
||||
export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:$PATH
|
||||
|
||||
# Install a few things needed by unit and /integration tests.
|
||||
command -v etcd &>/dev/null || ./hack/install-etcd.sh
|
||||
go get -u github.com/jstemmer/go-junit-report
|
||||
|
||||
# Enable the Go race detector.
|
||||
export KUBE_RACE=-race
|
||||
# Produce a JUnit-style XML test report for Jenkins.
|
||||
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/_artifacts
|
||||
# Save the verbose stdout as well.
|
||||
export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y
|
||||
|
||||
make test
|
||||
make test-integration
|
||||
62
vendor/k8s.io/kubernetes/hack/jenkins/test-dockerized.sh
generated
vendored
Executable file
62
vendor/k8s.io/kubernetes/hack/jenkins/test-dockerized.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
retry() {
|
||||
for i in {1..5}; do
|
||||
"$@" && return 0 || sleep $i
|
||||
done
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Runs the unit and integration tests, producing JUnit-style XML test
|
||||
# reports in ${WORKSPACE}/artifacts. This script is intended to be run from
|
||||
# kubekins-test container with a kubernetes repo mapped in. See
|
||||
# hack/jenkins/gotest-dockerized.sh
|
||||
|
||||
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
|
||||
|
||||
retry go get github.com/tools/godep && godep version
|
||||
retry go get github.com/jstemmer/go-junit-report
|
||||
|
||||
# Enable the Go race detector.
|
||||
export KUBE_RACE=-race
|
||||
# Disable coverage report
|
||||
export KUBE_COVER="n"
|
||||
# Produce a JUnit-style XML test report for Jenkins.
|
||||
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/artifacts
|
||||
export ARTIFACTS_DIR=${WORKSPACE}/artifacts
|
||||
# Save the verbose stdout as well.
|
||||
export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y
|
||||
export KUBE_TIMEOUT='-timeout 300s'
|
||||
export KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4
|
||||
export LOG_LEVEL=4
|
||||
|
||||
cd /go/src/k8s.io/kubernetes
|
||||
rm -rf Godeps/_workspace # Temporary until _workspace is fully obliterated
|
||||
|
||||
make generated_files
|
||||
go install ./cmd/...
|
||||
./hack/install-etcd.sh
|
||||
|
||||
make test
|
||||
make test-cmd
|
||||
make test-integration
|
||||
./hack/test-update-storage-objects.sh
|
||||
295
vendor/k8s.io/kubernetes/hack/jenkins/upload-to-gcs.sh
generated
vendored
Executable file
295
vendor/k8s.io/kubernetes/hack/jenkins/upload-to-gcs.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,295 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# This script uploads metadata and test results to Google Cloud Storage, in the
|
||||
# location indicated by JENKINS_GCS_LOGS_PATH. By default, we use the Google
|
||||
# kubernetes-jenkins bucket.
|
||||
#
|
||||
# The script looks for one of two environment variables to be set:
|
||||
# JENKINS_BUILD_STARTED: set to a nonempty string to upload version
|
||||
# information to 'started.json'. The value of the variable is not
|
||||
# currently used.
|
||||
# JENKINS_BUILD_FINISHED: set to the Jenkins build result to upload the build
|
||||
# result to 'finished.json', any test artifacts, and update the
|
||||
# 'latest-build.txt' file pointer. Since this script uses gsutil directly,
|
||||
# it's a bit faster at uploading large numbers of files than the GCS Jenkins
|
||||
# plugin. It also makes use of gsutil's gzip functionality.
|
||||
#
|
||||
# Note: for magicfile support to work correctly, the "file" utility must be
|
||||
# installed.
|
||||
|
||||
# TODO(rmmh): rewrite this script in Python so we can actually test it!
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [[ -n "${JENKINS_BUILD_STARTED:-}" && -n "${JENKINS_BUILD_FINISHED:-}" ]]; then
|
||||
echo "Error: JENKINS_BUILD_STARTED and JENKINS_BUILD_FINISHED should not both be set!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! ${JENKINS_UPLOAD_TO_GCS:-y} =~ ^[yY]$ ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Attempt to determine if we're running against a repo other than
|
||||
# kubernetes/kubernetes to determine whether to place PR logs in a different
|
||||
# location.
|
||||
#
|
||||
# In the current CI system, the tracked repo is named remote. This is not true
|
||||
# in general for most devs, where origin and upstream are more common.
|
||||
GCS_SUBDIR=""
|
||||
readonly remote_git_repo=$(git config --get remote.remote.url | sed 's:.*github.com/::' || true)
|
||||
if [[ -n "${remote_git_repo}" ]]; then
|
||||
case "${remote_git_repo}" in
|
||||
# main repo: nothing extra
|
||||
kubernetes/kubernetes) GCS_SUBDIR="" ;;
|
||||
# a different repo on the k8s org: just the repo name (strip kubernetes/)
|
||||
kubernetes/*) GCS_SUBDIR="${remote_git_repo#kubernetes/}/" ;;
|
||||
# any other repo: ${org}_${repo} (replace / with _)
|
||||
*) GCS_SUBDIR="${remote_git_repo/\//_}/" ;;
|
||||
esac
|
||||
if [[ "${remote_git_repo}" != "kubernetes/kubernetes" ]]; then
|
||||
# also store the repo in started.json, so Gubernator can link it properly.
|
||||
export BUILD_METADATA_REPO="${remote_git_repo}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${JOB_NAME} =~ -pull- ]]; then
|
||||
: ${JENKINS_GCS_LOGS_PATH:="gs://kubernetes-jenkins/pr-logs/pull/${GCS_SUBDIR}${ghprbPullId:-unknown}"}
|
||||
: ${JENKINS_GCS_LATEST_PATH:="gs://kubernetes-jenkins/pr-logs/directory"}
|
||||
: ${JENKINS_GCS_LOGS_INDIRECT:="gs://kubernetes-jenkins/pr-logs/directory/${JOB_NAME}"}
|
||||
else
|
||||
: ${JENKINS_GCS_LOGS_PATH:="gs://kubernetes-jenkins/logs"}
|
||||
: ${JENKINS_GCS_LATEST_PATH:="gs://kubernetes-jenkins/logs"}
|
||||
: ${JENKINS_GCS_LOGS_INDIRECT:=""}
|
||||
fi
|
||||
|
||||
readonly artifacts_path="${WORKSPACE}/_artifacts"
|
||||
readonly gcs_job_path="${JENKINS_GCS_LOGS_PATH}/${JOB_NAME}"
|
||||
readonly gcs_build_path="${gcs_job_path}/${BUILD_NUMBER}"
|
||||
readonly gcs_latest_path="${JENKINS_GCS_LATEST_PATH}/${JOB_NAME}"
|
||||
readonly gcs_indirect_path="${JENKINS_GCS_LOGS_INDIRECT}"
|
||||
readonly gcs_acl="public-read"
|
||||
readonly results_url=${gcs_build_path//"gs:/"/"https://console.cloud.google.com/storage/browser"}
|
||||
readonly timestamp=$(date +%s)
|
||||
|
||||
#########################################################################
|
||||
# $0 is called from different contexts so figure out where kubernetes is.
|
||||
# Sets non-exported global kubernetes_base_path and defaults to "."
|
||||
function set_kubernetes_base_path () {
|
||||
for kubernetes_base_path in kubernetes go/src/k8s.io/kubernetes .; do
|
||||
# Pick a canonical item to find in a kubernetes tree which could be a
|
||||
# raw source tree or an expanded tarball.
|
||||
|
||||
[[ -f ${kubernetes_base_path}/cluster/common.sh ]] && break
|
||||
done
|
||||
}
|
||||
|
||||
#########################################################################
|
||||
# Try to discover the kubernetes version.
|
||||
# prints version
|
||||
function find_version() {
|
||||
(
|
||||
# Where are we?
|
||||
# This could be set in the global scope at some point if we need to
|
||||
# discover the kubernetes path elsewhere.
|
||||
set_kubernetes_base_path
|
||||
|
||||
cd ${kubernetes_base_path}
|
||||
|
||||
if [[ -e "version" ]]; then
|
||||
cat version
|
||||
elif [[ -e "hack/lib/version.sh" ]]; then
|
||||
export KUBE_ROOT="."
|
||||
source "hack/lib/version.sh"
|
||||
kube::version::get_version_vars
|
||||
echo "${KUBE_GIT_VERSION-}"
|
||||
else
|
||||
# Last resort from the started.json
|
||||
gsutil cat ${gcs_build_path}/started.json 2>/dev/null |\
|
||||
sed -n 's/ *"version": *"\([^"]*\)",*/\1/p'
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
# Output started.json. Use test function below!
|
||||
function print_started() {
|
||||
local metadata_keys=$(compgen -e | grep ^BUILD_METADATA_)
|
||||
echo "{"
|
||||
echo " \"version\": \"${version}\"," # TODO(fejta): retire
|
||||
echo " \"job-version\": \"${version}\","
|
||||
echo " \"timestamp\": ${timestamp},"
|
||||
if [[ -n "${metadata_keys}" ]]; then
|
||||
# Any exported variables of the form BUILD_METADATA_KEY=VALUE
|
||||
# will be available as started["metadata"][KEY.lower()].
|
||||
echo " \"metadata\": {"
|
||||
local sep="" # leading commas are easy to track
|
||||
for env_var in $metadata_keys; do
|
||||
local var_upper="${env_var#BUILD_METADATA_}"
|
||||
echo " $sep\"${var_upper,,}\": \"${!env_var}\""
|
||||
sep=","
|
||||
done
|
||||
echo " },"
|
||||
fi
|
||||
echo " \"jenkins-node\": \"${NODE_NAME:-}\""
|
||||
echo "}"
|
||||
}
|
||||
|
||||
# Use this to test changes to print_started.
|
||||
if [[ -n "${TEST_STARTED_JSON:-}" ]]; then
|
||||
version=$(find_version)
|
||||
cat <(print_started) | jq .
|
||||
exit
|
||||
fi
|
||||
|
||||
function upload_version() {
|
||||
local -r version=$(find_version)
|
||||
local upload_attempt
|
||||
|
||||
echo -n 'Run starting at '; date -d "@${timestamp}"
|
||||
|
||||
if [[ -n "${version}" ]]; then
|
||||
echo "Found Kubernetes version: ${version}"
|
||||
else
|
||||
echo "Could not find Kubernetes version"
|
||||
fi
|
||||
|
||||
local -r json_file="${gcs_build_path}/started.json"
|
||||
for upload_attempt in {1..3}; do
|
||||
echo "Uploading version to: ${json_file} (attempt ${upload_attempt})"
|
||||
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(print_started) "${json_file}" || continue
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
#########################################################################
|
||||
# Maintain a single file storing the full build version, Jenkins' job number
|
||||
# build state. Limit its size so it does not grow unbounded.
|
||||
# This is primarily used for and by the
|
||||
# github.com/kubernetes/release/find_green_build tool.
|
||||
# @param build_result - the state of the build
|
||||
#
|
||||
function update_job_result_cache() {
|
||||
local -r build_result=$1
|
||||
local -r version=$(find_version)
|
||||
local -r job_results=${gcs_job_path}/jobResultsCache.json
|
||||
local -r tmp_results="${WORKSPACE}/_tmp/jobResultsCache.tmp"
|
||||
# TODO: This constraint is insufficient. The boundary for secondary
|
||||
# job cache should be date based on the last primary build.
|
||||
# The issue is we are trying to find a matched green set of results
|
||||
# at a given hash, but all of the jobs run at wildly different lengths.
|
||||
local -r cache_size=300
|
||||
local upload_attempt
|
||||
|
||||
if [[ -n "${version}" ]]; then
|
||||
echo "Found Kubernetes version: ${version}"
|
||||
else
|
||||
echo "Could not find Kubernetes version"
|
||||
fi
|
||||
|
||||
mkdir -p ${tmp_results%/*}
|
||||
|
||||
# Construct a valid json file
|
||||
echo "[" > ${tmp_results}
|
||||
|
||||
for upload_attempt in $(seq 3); do
|
||||
echo "Copying ${job_results} to ${tmp_results} (attempt ${upload_attempt})"
|
||||
# The sed construct below is stripping out only the "version" lines
|
||||
# and then ensuring there's a single comma at the end of the line.
|
||||
gsutil -q cat ${job_results} 2>&- |\
|
||||
sed -n 's/^\({"version".*}\),*/\1,/p' |\
|
||||
tail -${cache_size} >> ${tmp_results} || continue
|
||||
break
|
||||
done
|
||||
|
||||
echo "{\"version\": \"${version}\", \"buildnumber\": \"${BUILD_NUMBER}\"," \
|
||||
"\"result\": \"${build_result}\"}" >> ${tmp_results}
|
||||
|
||||
echo "]" >> ${tmp_results}
|
||||
|
||||
for upload_attempt in $(seq 3); do
|
||||
echo "Copying ${tmp_results} to ${job_results} (attempt ${upload_attempt})"
|
||||
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" \
|
||||
${tmp_results} ${job_results} || continue
|
||||
break
|
||||
done
|
||||
|
||||
rm -f ${tmp_results}
|
||||
}
|
||||
|
||||
function upload_artifacts_and_build_result() {
|
||||
local -r build_result=$1
|
||||
local upload_attempt
|
||||
|
||||
echo -n 'Run finished at '; date -d "@${timestamp}"
|
||||
|
||||
for upload_attempt in {1..3}; do
|
||||
echo "Uploading to ${gcs_build_path} (attempt ${upload_attempt})"
|
||||
echo "Uploading build result: ${build_result}"
|
||||
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(
|
||||
echo "{"
|
||||
echo " \"result\": \"${build_result}\","
|
||||
echo " \"timestamp\": ${timestamp}"
|
||||
echo "}"
|
||||
) "${gcs_build_path}/finished.json" || continue
|
||||
if [[ -d "${artifacts_path}" && -n $(ls -A "${artifacts_path}") ]]; then
|
||||
echo "Uploading artifacts"
|
||||
gsutil -m -q -o "GSUtil:use_magicfile=True" cp -a "${gcs_acl}" -r -c \
|
||||
-z log,txt,xml "${artifacts_path}" "${gcs_build_path}/artifacts" || continue
|
||||
fi
|
||||
if [[ -e "${WORKSPACE}/build-log.txt" ]]; then
|
||||
echo "Uploading build log"
|
||||
gsutil -q cp -Z -a "${gcs_acl}" "${WORKSPACE}/build-log.txt" "${gcs_build_path}"
|
||||
fi
|
||||
|
||||
# For pull jobs, keep a canonical ordering for tools that want to examine
|
||||
# the output.
|
||||
if [[ "${gcs_indirect_path}" != "" ]]; then
|
||||
echo "Writing ${gcs_build_path} to ${gcs_indirect_path}/${BUILD_NUMBER}.txt"
|
||||
echo "${gcs_build_path}" | \
|
||||
gsutil -q -h "Content-Type:text/plain" \
|
||||
cp -a "${gcs_acl}" - "${gcs_indirect_path}/${BUILD_NUMBER}.txt" || continue
|
||||
echo "Marking build ${BUILD_NUMBER} as the latest completed build for this PR"
|
||||
echo "${BUILD_NUMBER}" | \
|
||||
gsutil -q -h "Content-Type:text/plain" -h "Cache-Control:private, max-age=0, no-transform" \
|
||||
cp -a "${gcs_acl}" - "${gcs_job_path}/latest-build.txt" || continue
|
||||
fi
|
||||
|
||||
# Mark this build as the latest completed.
|
||||
echo "Marking build ${BUILD_NUMBER} as the latest completed build"
|
||||
echo "${BUILD_NUMBER}" | \
|
||||
gsutil -q -h "Content-Type:text/plain" -h "Cache-Control:private, max-age=0, no-transform" \
|
||||
cp -a "${gcs_acl}" - "${gcs_latest_path}/latest-build.txt" || continue
|
||||
break # all uploads succeeded if we hit this point
|
||||
done
|
||||
|
||||
echo -e "\n\n\n*** View logs and artifacts at ${results_url} ***\n\n"
|
||||
}
|
||||
|
||||
if [[ -z "${BOOTSTRAP_MIGRATION:-}" ]]; then
|
||||
if [[ -n "${JENKINS_BUILD_STARTED:-}" ]]; then
|
||||
upload_version
|
||||
elif [[ -n "${JENKINS_BUILD_FINISHED:-}" ]]; then
|
||||
upload_artifacts_and_build_result ${JENKINS_BUILD_FINISHED}
|
||||
update_job_result_cache ${JENKINS_BUILD_FINISHED}
|
||||
else
|
||||
echo "ERROR: Called without JENKINS_BUILD_STARTED or JENKINS_BUILD_FINISHED set."
|
||||
echo "ERROR: this should not happen"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
45
vendor/k8s.io/kubernetes/hack/jenkins/verify-dockerized.sh
generated
vendored
Executable file
45
vendor/k8s.io/kubernetes/hack/jenkins/verify-dockerized.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
retry() {
|
||||
for i in {1..5}; do
|
||||
"$@" && return 0 || sleep $i
|
||||
done
|
||||
"$@"
|
||||
}
|
||||
|
||||
# This script is intended to be run from kubekins-test container with a
|
||||
# kubernetes repo mapped in. See hack/jenkins/gotest-dockerized.sh
|
||||
|
||||
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
|
||||
|
||||
retry go get github.com/tools/godep && godep version
|
||||
|
||||
export LOG_LEVEL=4
|
||||
|
||||
cd /go/src/k8s.io/kubernetes
|
||||
|
||||
# hack/verify-client-go.sh requires all dependencies exist in the GOPATH.
|
||||
# the retry helps avoid flakes while keeping total time bounded.
|
||||
godep restore || godep restore
|
||||
|
||||
./hack/install-etcd.sh
|
||||
make verify
|
||||
37
vendor/k8s.io/kubernetes/hack/jenkins/verify.sh
generated
vendored
Executable file
37
vendor/k8s.io/kubernetes/hack/jenkins/verify.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# Sets up the environment (e.g. installing godep and etcd if necessary)
|
||||
# and then runs all of the verification checks.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
# !!! ALERT !!! Jenkins default $HOME is /var/lib/jenkins, which is
|
||||
# global across jobs. We change $HOME instead to ${WORKSPACE}, which
|
||||
# is an incoming variable Jenkins provides us for this job's scratch
|
||||
# space.
|
||||
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
|
||||
export GOPATH=${HOME}/_gopath
|
||||
export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:$PATH
|
||||
|
||||
# Install a few things needed by the verification tests.
|
||||
command -v etcd &>/dev/null || ./hack/install-etcd.sh
|
||||
go get -u github.com/tools/godep
|
||||
|
||||
make verify
|
||||
92
vendor/k8s.io/kubernetes/hack/lib/etcd.sh
generated
vendored
Executable file
92
vendor/k8s.io/kubernetes/hack/lib/etcd.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# A set of helpers for starting/running etcd for tests
|
||||
|
||||
ETCD_VERSION=${ETCD_VERSION:-3.0.14}
|
||||
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${ETCD_PORT:-2379}
|
||||
|
||||
kube::etcd::start() {
|
||||
which etcd >/dev/null || {
|
||||
kube::log::usage "etcd must be in your PATH"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if pgrep etcd >/dev/null 2>&1; then
|
||||
kube::log::usage "etcd appears to already be running on this machine (`pgrep -l etcd`) (or its a zombie and you need to kill its parent)."
|
||||
kube::log::usage "retry after you resolve this etcd error."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$(etcd --version | head -n 1 | cut -d " " -f 3)
|
||||
if [[ "${version}" < "${ETCD_VERSION}" ]]; then
|
||||
kube::log::usage "etcd version ${ETCD_VERSION} or greater required."
|
||||
kube::log::info "You can use 'hack/install-etcd.sh' to install a copy in third_party/."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start etcd
|
||||
ETCD_DIR=${ETCD_DIR:-$(mktemp -d 2>/dev/null || mktemp -d -t test-etcd.XXXXXX)}
|
||||
if [[ -d "${ARTIFACTS_DIR:-}" ]]; then
|
||||
ETCD_LOGFILE="${ARTIFACTS_DIR}/etcd.$(uname -n).$(id -un).log.DEBUG.$(date +%Y%m%d-%H%M%S).$$"
|
||||
else
|
||||
ETCD_LOGFILE=/dev/null
|
||||
fi
|
||||
kube::log::info "etcd --advertise-client-urls http://${ETCD_HOST}:${ETCD_PORT} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} --debug > \"${ETCD_LOGFILE}\" 2>/dev/null"
|
||||
etcd --advertise-client-urls http://${ETCD_HOST}:${ETCD_PORT} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} --debug 2> "${ETCD_LOGFILE}" >/dev/null &
|
||||
ETCD_PID=$!
|
||||
|
||||
echo "Waiting for etcd to come up."
|
||||
kube::util::wait_for_url "http://${ETCD_HOST}:${ETCD_PORT}/v2/machines" "etcd: " 0.25 80
|
||||
curl -fs -X PUT "http://${ETCD_HOST}:${ETCD_PORT}/v2/keys/_test"
|
||||
}
|
||||
|
||||
kube::etcd::stop() {
|
||||
kill "${ETCD_PID-}" >/dev/null 2>&1 || :
|
||||
wait "${ETCD_PID-}" >/dev/null 2>&1 || :
|
||||
}
|
||||
|
||||
kube::etcd::clean_etcd_dir() {
|
||||
rm -rf "${ETCD_DIR-}"
|
||||
}
|
||||
|
||||
kube::etcd::cleanup() {
|
||||
kube::etcd::stop
|
||||
kube::etcd::clean_etcd_dir
|
||||
}
|
||||
|
||||
kube::etcd::install() {
|
||||
(
|
||||
cd "${KUBE_ROOT}/third_party"
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
|
||||
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"
|
||||
kube::util::download_file "${url}" "${download_file}"
|
||||
unzip -o "${download_file}"
|
||||
ln -fns "etcd-v${ETCD_VERSION}-darwin-amd64" etcd
|
||||
rm "${download_file}"
|
||||
else
|
||||
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz"
|
||||
download_file="etcd-v${ETCD_VERSION}-linux-amd64.tar.gz"
|
||||
kube::util::download_file "${url}" "${download_file}"
|
||||
tar xzf "${download_file}"
|
||||
ln -fns "etcd-v${ETCD_VERSION}-linux-amd64" etcd
|
||||
fi
|
||||
kube::log::info "etcd v${ETCD_VERSION} installed. To use:"
|
||||
kube::log::info "export PATH=$(pwd)/etcd:\${PATH}"
|
||||
)
|
||||
}
|
||||
700
vendor/k8s.io/kubernetes/hack/lib/golang.sh
generated
vendored
Executable file
700
vendor/k8s.io/kubernetes/hack/lib/golang.sh
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
154
vendor/k8s.io/kubernetes/hack/lib/init.sh
generated
vendored
Normal file
154
vendor/k8s.io/kubernetes/hack/lib/init.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# The root of the build/dist directory
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE}")/../.." && pwd -P)"
|
||||
|
||||
KUBE_OUTPUT_SUBPATH="${KUBE_OUTPUT_SUBPATH:-_output/local}"
|
||||
KUBE_OUTPUT="${KUBE_ROOT}/${KUBE_OUTPUT_SUBPATH}"
|
||||
KUBE_OUTPUT_BINPATH="${KUBE_OUTPUT}/bin"
|
||||
|
||||
# Set no_proxy for localhost if behind a proxy, otherwise,
|
||||
# the connections to localhost in scripts will time out
|
||||
export no_proxy=127.0.0.1,localhost
|
||||
|
||||
# This is a symlink to binaries for "this platform", e.g. build tools.
|
||||
THIS_PLATFORM_BIN="${KUBE_ROOT}/_output/bin"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
source "${KUBE_ROOT}/cluster/lib/util.sh"
|
||||
source "${KUBE_ROOT}/cluster/lib/logging.sh"
|
||||
|
||||
kube::log::install_errexit
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/version.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/golang.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/etcd.sh"
|
||||
|
||||
KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"
|
||||
|
||||
# list of all available group versions. This should be used when generated code
|
||||
# or when starting an API server that you want to have everything.
|
||||
# most preferred version for a group should appear first
|
||||
KUBE_AVAILABLE_GROUP_VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS:-\
|
||||
v1 \
|
||||
apps/v1beta1 \
|
||||
authentication.k8s.io/v1beta1 \
|
||||
authorization.k8s.io/v1beta1 \
|
||||
autoscaling/v1 \
|
||||
batch/v1 \
|
||||
batch/v2alpha1 \
|
||||
certificates.k8s.io/v1alpha1 \
|
||||
extensions/v1beta1 \
|
||||
imagepolicy.k8s.io/v1alpha1 \
|
||||
policy/v1beta1 \
|
||||
rbac.authorization.k8s.io/v1alpha1 \
|
||||
storage.k8s.io/v1beta1\
|
||||
}"
|
||||
|
||||
# not all group versions are exposed by the server. This list contains those
|
||||
# which are not available so we don't generate clients or swagger for them
|
||||
KUBE_NONSERVER_GROUP_VERSIONS="
|
||||
abac.authorization.kubernetes.io/v0 \
|
||||
abac.authorization.kubernetes.io/v1beta1 \
|
||||
componentconfig/v1alpha1 \
|
||||
imagepolicy.k8s.io/v1alpha1\
|
||||
"
|
||||
|
||||
# This emulates "readlink -f" which is not available on MacOS X.
|
||||
# Test:
|
||||
# T=/tmp/$$.$RANDOM
|
||||
# mkdir $T
|
||||
# touch $T/file
|
||||
# mkdir $T/dir
|
||||
# ln -s $T/file $T/linkfile
|
||||
# ln -s $T/dir $T/linkdir
|
||||
# function testone() {
|
||||
# X=$(readlink -f $1 2>&1)
|
||||
# Y=$(kube::readlinkdashf $1 2>&1)
|
||||
# if [ "$X" != "$Y" ]; then
|
||||
# echo readlinkdashf $1: expected "$X", got "$Y"
|
||||
# fi
|
||||
# }
|
||||
# testone /
|
||||
# testone /tmp
|
||||
# testone $T
|
||||
# testone $T/file
|
||||
# testone $T/dir
|
||||
# testone $T/linkfile
|
||||
# testone $T/linkdir
|
||||
# testone $T/nonexistant
|
||||
# testone $T/linkdir/file
|
||||
# testone $T/linkdir/dir
|
||||
# testone $T/linkdir/linkfile
|
||||
# testone $T/linkdir/linkdir
|
||||
function kube::readlinkdashf {
|
||||
# run in a subshell for simpler 'cd'
|
||||
(
|
||||
if [[ -d "$1" ]]; then # This also catch symlinks to dirs.
|
||||
cd "$1"
|
||||
pwd -P
|
||||
else
|
||||
cd $(dirname "$1")
|
||||
local f
|
||||
f=$(basename "$1")
|
||||
if [[ -L "$f" ]]; then
|
||||
readlink "$f"
|
||||
else
|
||||
echo "$(pwd -P)/${f}"
|
||||
fi
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
# This emulates "realpath" which is not available on MacOS X
|
||||
# Test:
|
||||
# T=/tmp/$$.$RANDOM
|
||||
# mkdir $T
|
||||
# touch $T/file
|
||||
# mkdir $T/dir
|
||||
# ln -s $T/file $T/linkfile
|
||||
# ln -s $T/dir $T/linkdir
|
||||
# function testone() {
|
||||
# X=$(realpath $1 2>&1)
|
||||
# Y=$(kube::realpath $1 2>&1)
|
||||
# if [ "$X" != "$Y" ]; then
|
||||
# echo realpath $1: expected "$X", got "$Y"
|
||||
# fi
|
||||
# }
|
||||
# testone /
|
||||
# testone /tmp
|
||||
# testone $T
|
||||
# testone $T/file
|
||||
# testone $T/dir
|
||||
# testone $T/linkfile
|
||||
# testone $T/linkdir
|
||||
# testone $T/nonexistant
|
||||
# testone $T/linkdir/file
|
||||
# testone $T/linkdir/dir
|
||||
# testone $T/linkdir/linkfile
|
||||
# testone $T/linkdir/linkdir
|
||||
kube::realpath() {
|
||||
if [[ ! -e "$1" ]]; then
|
||||
echo "$1: No such file or directory" >&2
|
||||
return 1
|
||||
fi
|
||||
kube::readlinkdashf "$1"
|
||||
}
|
||||
154
vendor/k8s.io/kubernetes/hack/lib/swagger.sh
generated
vendored
Normal file
154
vendor/k8s.io/kubernetes/hack/lib/swagger.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# Contains swagger related util functions.
|
||||
#
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# The root of the build/dist directory
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE}")/../.." && pwd -P)"
|
||||
|
||||
# Generates types_swagger_doc_generated file for the given group version.
|
||||
# $1: Name of the group version
|
||||
# $2: Path to the directory where types.go for that group version exists. This
|
||||
# is the directory where the file will be generated.
|
||||
kube::swagger::gen_types_swagger_doc() {
|
||||
local group_version=$1
|
||||
local gv_dir=$2
|
||||
local TMPFILE="${TMPDIR:-/tmp}/types_swagger_doc_generated.$(date +%s).go"
|
||||
|
||||
echo "Generating swagger type docs for ${group_version} at ${gv_dir}"
|
||||
|
||||
sed 's/YEAR/2016/' hack/boilerplate/boilerplate.go.txt > "$TMPFILE"
|
||||
echo "package ${group_version##*/}" >> "$TMPFILE"
|
||||
cat >> "$TMPFILE" <<EOF
|
||||
|
||||
// This file contains a collection of methods that can be used from go-restful to
|
||||
// generate Swagger API documentation for its models. Please read this PR for more
|
||||
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||
//
|
||||
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||
// Any context after a --- is ignored.
|
||||
//
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE
|
||||
EOF
|
||||
|
||||
go run cmd/genswaggertypedocs/swagger_type_docs.go -s \
|
||||
"${gv_dir}/types.go" \
|
||||
-f - \
|
||||
>> "$TMPFILE"
|
||||
|
||||
echo "// AUTO-GENERATED FUNCTIONS END HERE" >> "$TMPFILE"
|
||||
|
||||
gofmt -w -s "$TMPFILE"
|
||||
mv "$TMPFILE" ""${gv_dir}"/types_swagger_doc_generated.go"
|
||||
}
|
||||
|
||||
# Generates API reference docs for the given API group versions.
|
||||
# Required env vars:
|
||||
# GROUP_VERSIONS: Array of group versions to be included in the reference
|
||||
# docs.
|
||||
# GV_DIRS: Array of root directories for those group versions.
|
||||
# Input vars:
|
||||
# $1: Root directory path for swagger spec
|
||||
# $2: Root directory path where the reference docs should be generated.
|
||||
kube::swagger::gen_api_ref_docs() {
|
||||
: "${GROUP_VERSIONS?Must set GROUP_VERSIONS env var}"
|
||||
: "${GV_DIRS?Must set GV_DIRS env var}"
|
||||
|
||||
echo "Generating API reference docs for group versions: ${GROUP_VERSIONS[@]}, at dirs: ${GV_DIRS[@]}"
|
||||
GROUP_VERSIONS=(${GROUP_VERSIONS[@]})
|
||||
GV_DIRS=(${GV_DIRS[@]})
|
||||
local swagger_spec_path=${1}
|
||||
local output_dir=${2}
|
||||
echo "Reading swagger spec from: ${swagger_spec_path}"
|
||||
echo "Generating the docs at: ${output_dir}"
|
||||
|
||||
# Use REPO_DIR if provided so we can set it to the host-resolvable path
|
||||
# to the repo root if we are running this script from a container with
|
||||
# docker mounted in as a volume.
|
||||
# We pass the host output dir as the source dir to `docker run -v`, but use
|
||||
# the regular one to compute diff (they will be the same if running this
|
||||
# test on the host, potentially different if running in a container).
|
||||
local repo_dir=${REPO_DIR:-"${KUBE_ROOT}"}
|
||||
local tmp_subpath="_output/generated_html"
|
||||
local output_tmp_in_host="${repo_dir}/${tmp_subpath}"
|
||||
local output_tmp="${KUBE_ROOT}/${tmp_subpath}"
|
||||
|
||||
echo "Generating api reference docs at ${output_tmp}"
|
||||
|
||||
for ver in "${GROUP_VERSIONS[@]}"; do
|
||||
mkdir -p "${output_tmp}/${ver}"
|
||||
done
|
||||
|
||||
user_flags="-u $(id -u)"
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
# mapping in a uid from OS X doesn't make any sense
|
||||
user_flags=""
|
||||
fi
|
||||
|
||||
for i in "${!GROUP_VERSIONS[@]}"; do
|
||||
local ver=${GROUP_VERSIONS[i]}
|
||||
local dir=${GV_DIRS[i]}
|
||||
local tmp_in_host="${output_tmp_in_host}/${ver}"
|
||||
local register_file="${dir}/register.go"
|
||||
local swagger_json_name="$(kube::util::gv-to-swagger-name "${ver}")"
|
||||
|
||||
docker run ${user_flags} \
|
||||
--rm -v "${tmp_in_host}":/output:z \
|
||||
-v "${swagger_spec_path}":/swagger-source:z \
|
||||
-v "${register_file}":/register.go:z \
|
||||
--net=host -e "https_proxy=${KUBERNETES_HTTPS_PROXY:-}" \
|
||||
gcr.io/google_containers/gen-swagger-docs:v8 \
|
||||
"${swagger_json_name}"
|
||||
done
|
||||
|
||||
# Check if we actually changed anything
|
||||
pushd "${output_tmp}" > /dev/null
|
||||
touch .generated_html
|
||||
find . -type f | cut -sd / -f 2- | LC_ALL=C sort > .generated_html
|
||||
popd > /dev/null
|
||||
|
||||
while read file; do
|
||||
if [[ -e "${output_dir}/${file}" && -e "${output_tmp}/${file}" ]]; then
|
||||
echo "comparing ${output_dir}/${file} with ${output_tmp}/${file}"
|
||||
# Filter all munges from original content.
|
||||
original=$(cat "${output_dir}/${file}")
|
||||
generated=$(cat "${output_tmp}/${file}")
|
||||
|
||||
# Filter out meaningless lines with timestamps
|
||||
original=$(echo "${original}" | grep -v "Last updated" || :)
|
||||
generated=$(echo "${generated}" | grep -v "Last updated" || :)
|
||||
|
||||
# By now, the contents should be normalized and stripped of any
|
||||
# auto-managed content.
|
||||
if diff -B >/dev/null <(echo "${original}") <(echo "${generated}"); then
|
||||
# actual contents same, overwrite generated with original.
|
||||
cp "${output_dir}/${file}" "${output_tmp}/${file}"
|
||||
fi
|
||||
fi
|
||||
done <"${output_tmp}/.generated_html"
|
||||
|
||||
echo "Moving api reference docs from ${output_tmp} to ${output_dir}"
|
||||
|
||||
cp -af "${output_tmp}"/* "${output_dir}"
|
||||
rm -r "${output_tmp}"
|
||||
}
|
||||
225
vendor/k8s.io/kubernetes/hack/lib/test.sh
generated
vendored
Normal file
225
vendor/k8s.io/kubernetes/hack/lib/test.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# A set of helpers for tests
|
||||
|
||||
readonly reset=$(tput sgr0)
|
||||
readonly bold=$(tput bold)
|
||||
readonly black=$(tput setaf 0)
|
||||
readonly red=$(tput setaf 1)
|
||||
readonly green=$(tput setaf 2)
|
||||
|
||||
kube::test::clear_all() {
|
||||
kubectl delete "${kube_flags[@]}" rc,pods --all --grace-period=0 --force
|
||||
}
|
||||
|
||||
# Force exact match of a returned result for a object query. Wrap this with || to support multiple
|
||||
# valid return types.
|
||||
kube::test::get_object_assert() {
|
||||
local object=$1
|
||||
local request=$2
|
||||
local expected=$3
|
||||
local args=${4:-}
|
||||
|
||||
res=$(eval kubectl get "${kube_flags[@]}" ${args} $object -o go-template=\"$request\")
|
||||
|
||||
if [[ "$res" =~ ^$expected$ ]]; then
|
||||
echo -n ${green}
|
||||
echo "Successful get $object $request: $res"
|
||||
echo -n ${reset}
|
||||
return 0
|
||||
else
|
||||
echo ${bold}${red}
|
||||
echo "FAIL!"
|
||||
echo "Get $object $request"
|
||||
echo " Expected: $expected"
|
||||
echo " Got: $res"
|
||||
echo ${reset}${red}
|
||||
caller
|
||||
echo ${reset}
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
kube::test::get_object_jsonpath_assert() {
|
||||
local object=$1
|
||||
local request=$2
|
||||
local expected=$3
|
||||
|
||||
res=$(eval kubectl get "${kube_flags[@]}" $object -o jsonpath=\"$request\")
|
||||
|
||||
if [[ "$res" =~ ^$expected$ ]]; then
|
||||
echo -n ${green}
|
||||
echo "Successful get $object $request: $res"
|
||||
echo -n ${reset}
|
||||
return 0
|
||||
else
|
||||
echo ${bold}${red}
|
||||
echo "FAIL!"
|
||||
echo "Get $object $request"
|
||||
echo " Expected: $expected"
|
||||
echo " Got: $res"
|
||||
echo ${reset}${red}
|
||||
caller
|
||||
echo ${reset}
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
kube::test::describe_object_assert() {
|
||||
local resource=$1
|
||||
local object=$2
|
||||
local matches=${@:3}
|
||||
|
||||
result=$(eval kubectl describe "${kube_flags[@]}" $resource $object)
|
||||
|
||||
for match in ${matches}; do
|
||||
if [[ ! $(echo "$result" | grep ${match}) ]]; then
|
||||
echo ${bold}${red}
|
||||
echo "FAIL!"
|
||||
echo "Describe $resource $object"
|
||||
echo " Expected Match: $match"
|
||||
echo " Not found in:"
|
||||
echo "$result"
|
||||
echo ${reset}${red}
|
||||
caller
|
||||
echo ${reset}
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo -n ${green}
|
||||
echo "Successful describe $resource $object:"
|
||||
echo "$result"
|
||||
echo -n ${reset}
|
||||
return 0
|
||||
}
|
||||
|
||||
kube::test::describe_object_events_assert() {
|
||||
local resource=$1
|
||||
local object=$2
|
||||
local showevents=${3:-"true"}
|
||||
|
||||
if [[ -z "${3:-}" ]]; then
|
||||
result=$(eval kubectl describe "${kube_flags[@]}" $resource $object)
|
||||
else
|
||||
result=$(eval kubectl describe "${kube_flags[@]}" "--show-events=$showevents" $resource $object)
|
||||
fi
|
||||
|
||||
if [[ -n $(echo "$result" | grep "No events.\|Events:") ]]; then
|
||||
local has_events="true"
|
||||
else
|
||||
local has_events="false"
|
||||
fi
|
||||
if [[ $showevents == $has_events ]]; then
|
||||
echo -n ${green}
|
||||
echo "Successful describe"
|
||||
echo "$result"
|
||||
echo ${reset}
|
||||
return 0
|
||||
else
|
||||
echo ${bold}${red}
|
||||
echo "FAIL"
|
||||
if [[ $showevents == "false" ]]; then
|
||||
echo " Events information should not be described in:"
|
||||
else
|
||||
echo " Events information not found in:"
|
||||
fi
|
||||
echo $result
|
||||
echo ${reset}${red}
|
||||
caller
|
||||
echo ${reset}
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
kube::test::describe_resource_assert() {
|
||||
local resource=$1
|
||||
local matches=${@:2}
|
||||
|
||||
result=$(eval kubectl describe "${kube_flags[@]}" $resource)
|
||||
|
||||
for match in ${matches}; do
|
||||
if [[ ! $(echo "$result" | grep ${match}) ]]; then
|
||||
echo ${bold}${red}
|
||||
echo "FAIL!"
|
||||
echo "Describe $resource"
|
||||
echo " Expected Match: $match"
|
||||
echo " Not found in:"
|
||||
echo "$result"
|
||||
echo ${reset}${red}
|
||||
caller
|
||||
echo ${reset}
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo -n ${green}
|
||||
echo "Successful describe $resource:"
|
||||
echo "$result"
|
||||
echo -n ${reset}
|
||||
return 0
|
||||
}
|
||||
|
||||
kube::test::describe_resource_events_assert() {
|
||||
local resource=$1
|
||||
local showevents=${2:-"true"}
|
||||
|
||||
result=$(eval kubectl describe "${kube_flags[@]}" "--show-events=$showevents" $resource)
|
||||
|
||||
if [[ $(echo "$result" | grep "No events.\|Events:") ]]; then
|
||||
local has_events="true"
|
||||
else
|
||||
local has_events="false"
|
||||
fi
|
||||
if [[ $showevents == $has_events ]]; then
|
||||
echo -n ${green}
|
||||
echo "Successful describe"
|
||||
echo "$result"
|
||||
echo -n ${reset}
|
||||
return 0
|
||||
else
|
||||
echo ${bold}${red}
|
||||
echo "FAIL"
|
||||
if [[ $showevents == "false" ]]; then
|
||||
echo " Events information should not be described in:"
|
||||
else
|
||||
echo " Events information not found in:"
|
||||
fi
|
||||
echo $result
|
||||
caller
|
||||
echo ${reset}
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
kube::test::if_has_string() {
|
||||
local message=$1
|
||||
local match=$2
|
||||
|
||||
if [[ $(echo "$message" | grep "$match") ]]; then
|
||||
echo "Successful"
|
||||
echo "message:$message"
|
||||
echo "has:$match"
|
||||
return 0
|
||||
else
|
||||
echo "FAIL!"
|
||||
echo "message:$message"
|
||||
echo "has not:$match"
|
||||
caller
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
446
vendor/k8s.io/kubernetes/hack/lib/util.sh
generated
vendored
Executable file
446
vendor/k8s.io/kubernetes/hack/lib/util.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,446 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
kube::util::sortable_date() {
|
||||
date "+%Y%m%d-%H%M%S"
|
||||
}
|
||||
|
||||
kube::util::wait_for_url() {
|
||||
local url=$1
|
||||
local prefix=${2:-}
|
||||
local wait=${3:-1}
|
||||
local times=${4:-30}
|
||||
|
||||
which curl >/dev/null || {
|
||||
kube::log::usage "curl must be installed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
local i
|
||||
for i in $(seq 1 $times); do
|
||||
local out
|
||||
if out=$(curl -gkfs $url 2>/dev/null); then
|
||||
kube::log::status "On try ${i}, ${prefix}: ${out}"
|
||||
return 0
|
||||
fi
|
||||
sleep ${wait}
|
||||
done
|
||||
kube::log::error "Timed out waiting for ${prefix} to answer at ${url}; tried ${times} waiting ${wait} between each"
|
||||
return 1
|
||||
}
|
||||
|
||||
# returns a random port
|
||||
kube::util::get_random_port() {
|
||||
awk -v min=1024 -v max=65535 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'
|
||||
}
|
||||
|
||||
# use netcat to check if the host($1):port($2) is free (return 0 means free, 1 means used)
|
||||
kube::util::test_host_port_free() {
|
||||
local host=$1
|
||||
local port=$2
|
||||
local success=0
|
||||
local fail=1
|
||||
|
||||
which nc >/dev/null || {
|
||||
kube::log::usage "netcat isn't installed, can't verify if ${host}:${port} is free, skipping the check..."
|
||||
return ${success}
|
||||
}
|
||||
|
||||
if [ ! $(nc -vz "${host}" "${port}") ]; then
|
||||
kube::log::status "${host}:${port} is free, proceeding..."
|
||||
return ${success}
|
||||
else
|
||||
kube::log::status "${host}:${port} is already used"
|
||||
return ${fail}
|
||||
fi
|
||||
}
|
||||
|
||||
# Example: kube::util::trap_add 'echo "in trap DEBUG"' DEBUG
|
||||
# See: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal
|
||||
kube::util::trap_add() {
|
||||
local trap_add_cmd
|
||||
trap_add_cmd=$1
|
||||
shift
|
||||
|
||||
for trap_add_name in "$@"; do
|
||||
local existing_cmd
|
||||
local new_cmd
|
||||
|
||||
# Grab the currently defined trap commands for this trap
|
||||
existing_cmd=`trap -p "${trap_add_name}" | awk -F"'" '{print $2}'`
|
||||
|
||||
if [[ -z "${existing_cmd}" ]]; then
|
||||
new_cmd="${trap_add_cmd}"
|
||||
else
|
||||
new_cmd="${existing_cmd};${trap_add_cmd}"
|
||||
fi
|
||||
|
||||
# Assign the test
|
||||
trap "${new_cmd}" "${trap_add_name}"
|
||||
done
|
||||
}
|
||||
|
||||
# Opposite of kube::util::ensure-temp-dir()
|
||||
kube::util::cleanup-temp-dir() {
|
||||
rm -rf "${KUBE_TEMP}"
|
||||
}
|
||||
|
||||
# Create a temp dir that'll be deleted at the end of this bash session.
|
||||
#
|
||||
# Vars set:
|
||||
# KUBE_TEMP
|
||||
kube::util::ensure-temp-dir() {
|
||||
if [[ -z ${KUBE_TEMP-} ]]; then
|
||||
KUBE_TEMP=$(mktemp -d 2>/dev/null || mktemp -d -t kubernetes.XXXXXX)
|
||||
kube::util::trap_add kube::util::cleanup-temp-dir EXIT
|
||||
fi
|
||||
}
|
||||
|
||||
# This figures out the host platform without relying on golang. We need this as
|
||||
# we don't want a golang install to be a prerequisite to building yet we need
|
||||
# this info to figure out where the final binaries are placed.
|
||||
kube::util::host_platform() {
|
||||
local host_os
|
||||
local host_arch
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
host_os=darwin
|
||||
;;
|
||||
Linux)
|
||||
host_os=linux
|
||||
;;
|
||||
*)
|
||||
kube::log::error "Unsupported host OS. Must be Linux or Mac OS X."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$(uname -m)" in
|
||||
x86_64*)
|
||||
host_arch=amd64
|
||||
;;
|
||||
i?86_64*)
|
||||
host_arch=amd64
|
||||
;;
|
||||
amd64*)
|
||||
host_arch=amd64
|
||||
;;
|
||||
aarch64*)
|
||||
host_arch=arm64
|
||||
;;
|
||||
arm64*)
|
||||
host_arch=arm64
|
||||
;;
|
||||
arm*)
|
||||
host_arch=arm
|
||||
;;
|
||||
i?86*)
|
||||
host_arch=x86
|
||||
;;
|
||||
s390x*)
|
||||
host_arch=s390x
|
||||
;;
|
||||
ppc64le*)
|
||||
host_arch=ppc64le
|
||||
;;
|
||||
*)
|
||||
kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x or ppc64le."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "${host_os}/${host_arch}"
|
||||
}
|
||||
|
||||
kube::util::find-binary-for-platform() {
|
||||
local -r lookfor="$1"
|
||||
local -r platform="$2"
|
||||
local -r locations=(
|
||||
"${KUBE_ROOT}/_output/bin/${lookfor}"
|
||||
"${KUBE_ROOT}/_output/dockerized/bin/${platform}/${lookfor}"
|
||||
"${KUBE_ROOT}/_output/local/bin/${platform}/${lookfor}"
|
||||
"${KUBE_ROOT}/platforms/${platform}/${lookfor}"
|
||||
)
|
||||
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||
echo -n "${bin}"
|
||||
}
|
||||
|
||||
kube::util::find-binary() {
|
||||
kube::util::find-binary-for-platform "$1" "$(kube::util::host_platform)"
|
||||
}
|
||||
|
||||
# Run all known doc generators (today gendocs and genman for kubectl)
|
||||
# $1 is the directory to put those generated documents
|
||||
kube::util::gen-docs() {
|
||||
local dest="$1"
|
||||
|
||||
# Find binary
|
||||
gendocs=$(kube::util::find-binary "gendocs")
|
||||
genkubedocs=$(kube::util::find-binary "genkubedocs")
|
||||
genman=$(kube::util::find-binary "genman")
|
||||
genyaml=$(kube::util::find-binary "genyaml")
|
||||
genfeddocs=$(kube::util::find-binary "genfeddocs")
|
||||
|
||||
mkdir -p "${dest}/docs/user-guide/kubectl/"
|
||||
"${gendocs}" "${dest}/docs/user-guide/kubectl/"
|
||||
mkdir -p "${dest}/docs/admin/"
|
||||
"${genkubedocs}" "${dest}/docs/admin/" "kube-apiserver"
|
||||
"${genkubedocs}" "${dest}/docs/admin/" "kube-controller-manager"
|
||||
"${genkubedocs}" "${dest}/docs/admin/" "kube-proxy"
|
||||
"${genkubedocs}" "${dest}/docs/admin/" "kube-scheduler"
|
||||
"${genkubedocs}" "${dest}/docs/admin/" "kubelet"
|
||||
|
||||
# We don't really need federation-apiserver and federation-controller-manager
|
||||
# binaries to generate the docs. We just pass their names to decide which docs
|
||||
# to generate. The actual binary for running federation is hyperkube.
|
||||
"${genfeddocs}" "${dest}/docs/admin/" "federation-apiserver"
|
||||
"${genfeddocs}" "${dest}/docs/admin/" "federation-controller-manager"
|
||||
|
||||
mkdir -p "${dest}/docs/man/man1/"
|
||||
"${genman}" "${dest}/docs/man/man1/" "kube-apiserver"
|
||||
"${genman}" "${dest}/docs/man/man1/" "kube-controller-manager"
|
||||
"${genman}" "${dest}/docs/man/man1/" "kube-proxy"
|
||||
"${genman}" "${dest}/docs/man/man1/" "kube-scheduler"
|
||||
"${genman}" "${dest}/docs/man/man1/" "kubelet"
|
||||
"${genman}" "${dest}/docs/man/man1/" "kubectl"
|
||||
|
||||
mkdir -p "${dest}/docs/yaml/kubectl/"
|
||||
"${genyaml}" "${dest}/docs/yaml/kubectl/"
|
||||
|
||||
# create the list of generated files
|
||||
pushd "${dest}" > /dev/null
|
||||
touch .generated_docs
|
||||
find . -type f | cut -sd / -f 2- | LC_ALL=C sort > .generated_docs
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
# Puts a placeholder for every generated doc. This makes the link checker work.
|
||||
kube::util::set-placeholder-gen-docs() {
|
||||
local list_file="${KUBE_ROOT}/.generated_docs"
|
||||
if [ -e ${list_file} ]; then
|
||||
# remove all of the old docs; we don't want to check them in.
|
||||
while read file; do
|
||||
if [[ "${list_file}" != "${KUBE_ROOT}/${file}" ]]; then
|
||||
cp "${KUBE_ROOT}/hack/autogenerated_placeholder.txt" "${KUBE_ROOT}/${file}"
|
||||
fi
|
||||
done <"${list_file}"
|
||||
# The .generated_docs file lists itself, so we don't need to explicitly
|
||||
# delete it.
|
||||
fi
|
||||
}
|
||||
|
||||
# Removes previously generated docs-- we don't want to check them in. $KUBE_ROOT
|
||||
# must be set.
|
||||
kube::util::remove-gen-docs() {
|
||||
if [ -e "${KUBE_ROOT}/.generated_docs" ]; then
|
||||
# remove all of the old docs; we don't want to check them in.
|
||||
while read file; do
|
||||
rm "${KUBE_ROOT}/${file}" 2>/dev/null || true
|
||||
done <"${KUBE_ROOT}/.generated_docs"
|
||||
# The .generated_docs file lists itself, so we don't need to explicitly
|
||||
# delete it.
|
||||
fi
|
||||
}
|
||||
|
||||
# Takes a path $1 to traverse for md files to append the ga-beacon tracking
|
||||
# link to, if needed. If $2 is set, just print files that are missing
|
||||
# the link.
|
||||
kube::util::gen-analytics() {
|
||||
local path="$1"
|
||||
local dryrun="${2:-}"
|
||||
local mdfiles dir link
|
||||
# find has some strange inconsistencies between darwin/linux. The
|
||||
# path to search must end in '/' for linux, but darwin will put an extra
|
||||
# slash in results if there is a trailing '/'.
|
||||
if [[ $( uname ) == 'Linux' ]]; then
|
||||
dir="${path}/"
|
||||
else
|
||||
dir="${path}"
|
||||
fi
|
||||
# We don't touch files in special dirs, and the kubectl docs are
|
||||
# autogenerated by gendocs.
|
||||
# Don't descend into .directories
|
||||
mdfiles=($( find "${dir}" -name "*.md" -type f \
|
||||
-not -path '*/\.*' \
|
||||
-not -path "${path}/vendor/*" \
|
||||
-not -path "${path}/staging/*" \
|
||||
-not -path "${path}/third_party/*" \
|
||||
-not -path "${path}/_gopath/*" \
|
||||
-not -path "${path}/_output/*" \
|
||||
-not -path "${path}/docs/user-guide/kubectl/kubectl*" ))
|
||||
for f in "${mdfiles[@]}"; do
|
||||
link=$(kube::util::analytics-link "${f#${path}/}")
|
||||
if grep -q -F -x "${link}" "${f}"; then
|
||||
continue
|
||||
elif [[ -z "${dryrun}" ]]; then
|
||||
echo -e "\n\n${link}" >> "${f}"
|
||||
else
|
||||
echo "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Prints analytics link to append to a file at path $1.
|
||||
kube::util::analytics-link() {
|
||||
local path="$1"
|
||||
echo "[]()"
|
||||
}
|
||||
|
||||
# Takes a group/version and returns the path to its location on disk, sans
|
||||
# "pkg". E.g.:
|
||||
# * default behavior: extensions/v1beta1 -> apis/extensions/v1beta1
|
||||
# * default behavior for only a group: experimental -> apis/experimental
|
||||
# * Special handling for empty group: v1 -> api/v1, unversioned -> api/unversioned
|
||||
# * Special handling for groups suffixed with ".k8s.io": foo.k8s.io/v1 -> apis/foo/v1
|
||||
# * Very special handling for when both group and version are "": / -> api
|
||||
kube::util::group-version-to-pkg-path() {
|
||||
local group_version="$1"
|
||||
# Special cases first.
|
||||
# TODO(lavalamp): Simplify this by moving pkg/api/v1 and splitting pkg/api,
|
||||
# moving the results to pkg/apis/api.
|
||||
case "${group_version}" in
|
||||
# both group and version are "", this occurs when we generate deep copies for internal objects of the legacy v1 API.
|
||||
__internal)
|
||||
echo "api"
|
||||
;;
|
||||
v1)
|
||||
echo "api/v1"
|
||||
;;
|
||||
unversioned)
|
||||
echo "api/unversioned"
|
||||
;;
|
||||
*.k8s.io)
|
||||
echo "apis/${group_version%.*k8s.io}"
|
||||
;;
|
||||
*.k8s.io/*)
|
||||
echo "apis/${group_version/.*k8s.io/}"
|
||||
;;
|
||||
*)
|
||||
echo "apis/${group_version%__internal}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Takes a group/version and returns the swagger-spec file name.
|
||||
# default behavior: extensions/v1beta1 -> extensions_v1beta1
|
||||
# special case for v1: v1 -> v1
|
||||
kube::util::gv-to-swagger-name() {
|
||||
local group_version="$1"
|
||||
case "${group_version}" in
|
||||
v1)
|
||||
echo "v1"
|
||||
;;
|
||||
*)
|
||||
echo "${group_version%/*}_${group_version#*/}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Fetches swagger spec from apiserver.
|
||||
# Assumed vars:
|
||||
# SWAGGER_API_PATH: Base path for swaggerapi on apiserver. Ex:
|
||||
# http://localhost:8080/swaggerapi.
|
||||
# SWAGGER_ROOT_DIR: Root dir where we want to to save the fetched spec.
|
||||
# VERSIONS: Array of group versions to include in swagger spec.
|
||||
kube::util::fetch-swagger-spec() {
|
||||
for ver in ${VERSIONS}; do
|
||||
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${ver} "* ]]; then
|
||||
continue
|
||||
fi
|
||||
# fetch the swagger spec for each group version.
|
||||
if [[ ${ver} == "v1" ]]; then
|
||||
SUBPATH="api"
|
||||
else
|
||||
SUBPATH="apis"
|
||||
fi
|
||||
SUBPATH="${SUBPATH}/${ver}"
|
||||
SWAGGER_JSON_NAME="$(kube::util::gv-to-swagger-name ${ver}).json"
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}${SUBPATH}" > "${SWAGGER_ROOT_DIR}/${SWAGGER_JSON_NAME}"
|
||||
|
||||
# fetch the swagger spec for the discovery mechanism at group level.
|
||||
if [[ ${ver} == "v1" ]]; then
|
||||
continue
|
||||
fi
|
||||
SUBPATH="apis/"${ver%/*}
|
||||
SWAGGER_JSON_NAME="${ver%/*}.json"
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}${SUBPATH}" > "${SWAGGER_ROOT_DIR}/${SWAGGER_JSON_NAME}"
|
||||
done
|
||||
|
||||
# fetch swagger specs for other discovery mechanism.
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}" > "${SWAGGER_ROOT_DIR}/resourceListing.json"
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}version" > "${SWAGGER_ROOT_DIR}/version.json"
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}api" > "${SWAGGER_ROOT_DIR}/api.json"
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}apis" > "${SWAGGER_ROOT_DIR}/apis.json"
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}logs" > "${SWAGGER_ROOT_DIR}/logs.json"
|
||||
}
|
||||
|
||||
# Returns the name of the upstream remote repository name for the local git
|
||||
# repo, e.g. "upstream" or "origin".
|
||||
kube::util::git_upstream_remote_name() {
|
||||
git remote -v | grep fetch |\
|
||||
grep -E 'github.com[/:]kubernetes/kubernetes|k8s.io/kubernetes' |\
|
||||
head -n 1 | awk '{print $1}'
|
||||
}
|
||||
|
||||
# Checks whether there are any files matching pattern $2 changed between the
|
||||
# current branch and upstream branch named by $1.
|
||||
# Returns 1 (false) if there are no changes, 0 (true) if there are changes
|
||||
# detected.
|
||||
kube::util::has_changes_against_upstream_branch() {
|
||||
local -r git_branch=$1
|
||||
local -r pattern=$2
|
||||
local full_branch
|
||||
|
||||
full_branch="$(kube::util::git_upstream_remote_name)/${git_branch}"
|
||||
echo "Checking for '${pattern}' changes against '${full_branch}'"
|
||||
# make sure the branch is valid, otherwise the check will pass erroneously.
|
||||
if ! git describe "${full_branch}" >/dev/null; then
|
||||
# abort!
|
||||
exit 1
|
||||
fi
|
||||
# notice this uses ... to find the first shared ancestor
|
||||
if git diff --name-only "${full_branch}...HEAD" | grep "${pattern}" > /dev/null; then
|
||||
return 0
|
||||
fi
|
||||
# also check for pending changes
|
||||
if git status --porcelain | grep "${pattern}" > /dev/null; then
|
||||
echo "Detected '${pattern}' uncommitted changes."
|
||||
return 0
|
||||
fi
|
||||
echo "No '${pattern}' changes detected."
|
||||
return 1
|
||||
}
|
||||
|
||||
kube::util::download_file() {
|
||||
local -r url=$1
|
||||
local -r destination_file=$2
|
||||
|
||||
rm ${destination_file} 2&> /dev/null || true
|
||||
|
||||
for i in $(seq 5)
|
||||
do
|
||||
if ! curl -fsSL --retry 3 --keepalive-time 2 ${url} -o ${destination_file}; then
|
||||
echo "Downloading ${url} failed. $((5-i)) retries left."
|
||||
sleep 1
|
||||
else
|
||||
echo "Downloading ${url} succeed"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
148
vendor/k8s.io/kubernetes/hack/lib/version.sh
generated
vendored
Normal file
148
vendor/k8s.io/kubernetes/hack/lib/version.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Version management helpers. These functions help to set, save and load the
|
||||
# following variables:
|
||||
#
|
||||
# KUBE_GIT_COMMIT - The git commit id corresponding to this
|
||||
# source code.
|
||||
# KUBE_GIT_TREE_STATE - "clean" indicates no changes since the git commit id
|
||||
# "dirty" indicates source code changes after the git commit id
|
||||
# KUBE_GIT_VERSION - "vX.Y" used to indicate the last release version.
|
||||
# KUBE_GIT_MAJOR - The major part of the version
|
||||
# KUBE_GIT_MINOR - The minor component of the version
|
||||
|
||||
# Grovels through git to set a set of env variables.
|
||||
#
|
||||
# If KUBE_GIT_VERSION_FILE, this function will load from that file instead of
|
||||
# querying git.
|
||||
kube::version::get_version_vars() {
|
||||
if [[ -n ${KUBE_GIT_VERSION_FILE-} ]]; then
|
||||
kube::version::load_version_vars "${KUBE_GIT_VERSION_FILE}"
|
||||
return
|
||||
fi
|
||||
|
||||
local git=(git --work-tree "${KUBE_ROOT}")
|
||||
|
||||
if [[ -n ${KUBE_GIT_COMMIT-} ]] || KUBE_GIT_COMMIT=$("${git[@]}" rev-parse "HEAD^{commit}" 2>/dev/null); then
|
||||
if [[ -z ${KUBE_GIT_TREE_STATE-} ]]; then
|
||||
# Check if the tree is dirty. default to dirty
|
||||
if git_status=$("${git[@]}" status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then
|
||||
KUBE_GIT_TREE_STATE="clean"
|
||||
else
|
||||
KUBE_GIT_TREE_STATE="dirty"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use git describe to find the version based on annotated tags.
|
||||
if [[ -n ${KUBE_GIT_VERSION-} ]] || KUBE_GIT_VERSION=$("${git[@]}" describe --tags --abbrev=14 "${KUBE_GIT_COMMIT}^{commit}" 2>/dev/null); then
|
||||
# This translates the "git describe" to an actual semver.org
|
||||
# compatible semantic version that looks something like this:
|
||||
# v1.1.0-alpha.0.6+84c76d1142ea4d
|
||||
#
|
||||
# TODO: We continue calling this "git version" because so many
|
||||
# downstream consumers are expecting it there.
|
||||
DASHES_IN_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/[^-]//g")
|
||||
if [[ "${DASHES_IN_VERSION}" == "---" ]] ; then
|
||||
# We have distance to subversion (v1.1.0-subversion-1-gCommitHash)
|
||||
KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{14\}\)$/.\1\+\2/")
|
||||
elif [[ "${DASHES_IN_VERSION}" == "--" ]] ; then
|
||||
# We have distance to base tag (v1.1.0-1-gCommitHash)
|
||||
KUBE_GIT_VERSION=$(echo "${KUBE_GIT_VERSION}" | sed "s/-g\([0-9a-f]\{14\}\)$/+\1/")
|
||||
fi
|
||||
if [[ "${KUBE_GIT_TREE_STATE}" == "dirty" ]]; then
|
||||
# git describe --dirty only considers changes to existing files, but
|
||||
# that is problematic since new untracked .go files affect the build,
|
||||
# so use our idea of "dirty" from git status instead.
|
||||
KUBE_GIT_VERSION+="-dirty"
|
||||
fi
|
||||
|
||||
|
||||
# Try to match the "git describe" output to a regex to try to extract
|
||||
# the "major" and "minor" versions and whether this is the exact tagged
|
||||
# version or whether the tree is between two tagged versions.
|
||||
if [[ "${KUBE_GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?([-].*)?$ ]]; then
|
||||
KUBE_GIT_MAJOR=${BASH_REMATCH[1]}
|
||||
KUBE_GIT_MINOR=${BASH_REMATCH[2]}
|
||||
if [[ -n "${BASH_REMATCH[4]}" ]]; then
|
||||
KUBE_GIT_MINOR+="+"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Saves the environment flags to $1
|
||||
kube::version::save_version_vars() {
|
||||
local version_file=${1-}
|
||||
[[ -n ${version_file} ]] || {
|
||||
echo "!!! Internal error. No file specified in kube::version::save_version_vars"
|
||||
return 1
|
||||
}
|
||||
|
||||
cat <<EOF >"${version_file}"
|
||||
KUBE_GIT_COMMIT='${KUBE_GIT_COMMIT-}'
|
||||
KUBE_GIT_TREE_STATE='${KUBE_GIT_TREE_STATE-}'
|
||||
KUBE_GIT_VERSION='${KUBE_GIT_VERSION-}'
|
||||
KUBE_GIT_MAJOR='${KUBE_GIT_MAJOR-}'
|
||||
KUBE_GIT_MINOR='${KUBE_GIT_MINOR-}'
|
||||
EOF
|
||||
}
|
||||
|
||||
# Loads up the version variables from file $1
|
||||
kube::version::load_version_vars() {
|
||||
local version_file=${1-}
|
||||
[[ -n ${version_file} ]] || {
|
||||
echo "!!! Internal error. No file specified in kube::version::load_version_vars"
|
||||
return 1
|
||||
}
|
||||
|
||||
source "${version_file}"
|
||||
}
|
||||
|
||||
kube::version::ldflag() {
|
||||
local key=${1}
|
||||
local val=${2}
|
||||
|
||||
echo "-X ${KUBE_GO_PACKAGE}/pkg/version.${key}=${val}"
|
||||
}
|
||||
|
||||
# Prints the value that needs to be passed to the -ldflags parameter of go build
|
||||
# in order to set the Kubernetes based on the git tree status.
|
||||
kube::version::ldflags() {
|
||||
kube::version::get_version_vars
|
||||
|
||||
local -a ldflags=($(kube::version::ldflag "buildDate" "$(date -u +'%Y-%m-%dT%H:%M:%SZ')"))
|
||||
if [[ -n ${KUBE_GIT_COMMIT-} ]]; then
|
||||
ldflags+=($(kube::version::ldflag "gitCommit" "${KUBE_GIT_COMMIT}"))
|
||||
ldflags+=($(kube::version::ldflag "gitTreeState" "${KUBE_GIT_TREE_STATE}"))
|
||||
fi
|
||||
|
||||
if [[ -n ${KUBE_GIT_VERSION-} ]]; then
|
||||
ldflags+=($(kube::version::ldflag "gitVersion" "${KUBE_GIT_VERSION}"))
|
||||
fi
|
||||
|
||||
if [[ -n ${KUBE_GIT_MAJOR-} && -n ${KUBE_GIT_MINOR-} ]]; then
|
||||
ldflags+=(
|
||||
$(kube::version::ldflag "gitMajor" "${KUBE_GIT_MAJOR}")
|
||||
$(kube::version::ldflag "gitMinor" "${KUBE_GIT_MINOR}")
|
||||
)
|
||||
fi
|
||||
|
||||
# The -ldflags parameter takes a single string, so join the output.
|
||||
echo "${ldflags[*]-}"
|
||||
}
|
||||
23
vendor/k8s.io/kubernetes/hack/list-feature-tests.sh
generated
vendored
Executable file
23
vendor/k8s.io/kubernetes/hack/list-feature-tests.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# A single script that lists all of the [Feature:.+] tests in our e2e suite.
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
grep "\[Feature:\w+\]" "${KUBE_ROOT}"/test/e2e/*.go -Poh | LC_ALL=C sort -u
|
||||
794
vendor/k8s.io/kubernetes/hack/local-up-cluster.sh
generated
vendored
Executable file
794
vendor/k8s.io/kubernetes/hack/local-up-cluster.sh
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
40
vendor/k8s.io/kubernetes/hack/lookup_pull.py
generated
vendored
Executable file
40
vendor/k8s.io/kubernetes/hack/lookup_pull.py
generated
vendored
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# Script to print out PR info in release note format.
|
||||
|
||||
import json
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
PULLQUERY=("https://api.github.com/repos/"
|
||||
"GoogleCloudPlatform/kubernetes/pulls/{pull}")
|
||||
LOGIN="login"
|
||||
TITLE="title"
|
||||
USER="user"
|
||||
|
||||
def print_pulls(pulls):
|
||||
for pull in pulls:
|
||||
d = json.loads(urllib2.urlopen(PULLQUERY.format(pull=pull)).read())
|
||||
print "* {title} #{pull} ({author})".format(
|
||||
title=d[TITLE], pull=pull, author=d[USER][LOGIN])
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print ("Usage: {cmd} <pulls>...: Prints out short " +
|
||||
"markdown description for PRs appropriate for release notes.")
|
||||
sys.exit(1)
|
||||
print_pulls(sys.argv[1:])
|
||||
28
vendor/k8s.io/kubernetes/hack/make-rules/build.sh
generated
vendored
Executable file
28
vendor/k8s.io/kubernetes/hack/make-rules/build.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script sets up a go workspace locally and builds all go components.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
KUBE_VERBOSE="${KUBE_VERBOSE:-1}"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::build_binaries "$@"
|
||||
kube::golang::place_bins
|
||||
36
vendor/k8s.io/kubernetes/hack/make-rules/cross.sh
generated
vendored
Executable file
36
vendor/k8s.io/kubernetes/hack/make-rules/cross.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script sets up a go workspace locally and builds all for all appropriate
|
||||
# platforms.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
# NOTE: Using "${array[*]}" here is correct. [@] becomes distinct words (in
|
||||
# bash parlance).
|
||||
|
||||
make all WHAT="${KUBE_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_TEST_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_TEST_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_SERVER_PLATFORMS[*]}"
|
||||
68
vendor/k8s.io/kubernetes/hack/make-rules/helpers/cache_go_dirs.sh
generated
vendored
Executable file
68
vendor/k8s.io/kubernetes/hack/make-rules/helpers/cache_go_dirs.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script finds, caches, and prints a list of all directories that hold
|
||||
# *.go files. If any directory is newer than the cache, re-find everything and
|
||||
# update the cache. Otherwise use the cached file.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [[ -z "${1:-}" ]]; then
|
||||
echo "usage: $0 <cache-file>"
|
||||
exit 1
|
||||
fi
|
||||
CACHE="$1"; shift
|
||||
|
||||
trap "rm -f '${CACHE}'" HUP INT TERM ERR
|
||||
|
||||
# This is a partial 'find' command. The caller is expected to pass the
|
||||
# remaining arguments.
|
||||
#
|
||||
# Example:
|
||||
# kfind -type f -name foobar.go
|
||||
function kfind() {
|
||||
find . \
|
||||
-not \( \
|
||||
\( \
|
||||
-path ./vendor -o \
|
||||
-path ./staging -o \
|
||||
-path ./_\* -o \
|
||||
-path ./.\* -o \
|
||||
-path ./docs -o \
|
||||
-path ./examples \
|
||||
\) -prune \
|
||||
\) \
|
||||
"$@"
|
||||
}
|
||||
|
||||
NEED_FIND=true
|
||||
# It's *significantly* faster to check whether any directories are newer than
|
||||
# the cache than to blindly rebuild it.
|
||||
if [[ -f "${CACHE}" ]]; then
|
||||
N=$(kfind -type d -newer "${CACHE}" -print -quit | wc -l)
|
||||
[[ "${N}" == 0 ]] && NEED_FIND=false
|
||||
fi
|
||||
mkdir -p $(dirname "${CACHE}")
|
||||
if $("${NEED_FIND}"); then
|
||||
kfind -type f -name \*.go \
|
||||
| xargs -n1 dirname \
|
||||
| LC_ALL=C sort -u \
|
||||
| sed 's|^./||' \
|
||||
> "${CACHE}"
|
||||
fi
|
||||
cat "${CACHE}"
|
||||
2976
vendor/k8s.io/kubernetes/hack/make-rules/test-cmd.sh
generated
vendored
Executable file
2976
vendor/k8s.io/kubernetes/hack/make-rules/test-cmd.sh
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
153
vendor/k8s.io/kubernetes/hack/make-rules/test-e2e-node.sh
generated
vendored
Executable file
153
vendor/k8s.io/kubernetes/hack/make-rules/test-e2e-node.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,153 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
focus=${FOCUS:-""}
|
||||
skip=${SKIP:-""}
|
||||
# The number of tests that can run in parallel depends on what tests
|
||||
# are running and on the size of the node. Too many, and tests will
|
||||
# fail due to resource contention. 8 is a reasonable default for a
|
||||
# n1-standard-1 node.
|
||||
# Currently, parallelism only affects when REMOTE=true. For local test,
|
||||
# ginkgo default parallelism (cores - 1) is used.
|
||||
parallelism=${PARALLELISM:-8}
|
||||
artifacts=${ARTIFACTS:-"/tmp/_artifacts/`date +%y%m%dT%H%M%S`"}
|
||||
remote=${REMOTE:-"false"}
|
||||
run_until_failure=${RUN_UNTIL_FAILURE:-"false"}
|
||||
test_args=${TEST_ARGS:-""}
|
||||
|
||||
# Parse the flags to pass to ginkgo
|
||||
ginkgoflags=""
|
||||
if [[ $parallelism > 1 ]]; then
|
||||
ginkgoflags="$ginkgoflags -nodes=$parallelism "
|
||||
fi
|
||||
|
||||
if [[ $focus != "" ]]; then
|
||||
ginkgoflags="$ginkgoflags -focus=\"$focus\" "
|
||||
fi
|
||||
|
||||
if [[ $skip != "" ]]; then
|
||||
ginkgoflags="$ginkgoflags -skip=\"$skip\" "
|
||||
fi
|
||||
|
||||
if [[ $run_until_failure != "" ]]; then
|
||||
ginkgoflags="$ginkgoflags -untilItFails=$run_until_failure "
|
||||
fi
|
||||
|
||||
# Setup the directory to copy test artifacts (logs, junit.xml, etc) from remote host to local host
|
||||
if [ ! -d "${artifacts}" ]; then
|
||||
echo "Creating artifacts directory at ${artifacts}"
|
||||
mkdir -p ${artifacts}
|
||||
fi
|
||||
echo "Test artifacts will be written to ${artifacts}"
|
||||
|
||||
if [ $remote = true ] ; then
|
||||
# The following options are only valid in remote run.
|
||||
images=${IMAGES:-""}
|
||||
hosts=${HOSTS:-""}
|
||||
image_project=${IMAGE_PROJECT:-"kubernetes-node-e2e-images"}
|
||||
metadata=${INSTANCE_METADATA:-""}
|
||||
list_images=${LIST_IMAGES:-false}
|
||||
if [[ $list_images == "true" ]]; then
|
||||
gcloud compute images list --project="${image_project}" | grep "e2e-node"
|
||||
exit 0
|
||||
fi
|
||||
gubernator=${GUBERNATOR:-"false"}
|
||||
if [[ $hosts == "" && $images == "" ]]; then
|
||||
image_project=${IMAGE_PROJECT:-"google-containers"}
|
||||
gci_image=$(gcloud compute images list --project $image_project \
|
||||
--no-standard-images --regexp="gci-dev.*" --format="table[no-heading](name)")
|
||||
images=$gci_image
|
||||
metadata="user-data<${KUBE_ROOT}/test/e2e_node/jenkins/gci-init.yaml"
|
||||
fi
|
||||
instance_prefix=${INSTANCE_PREFIX:-"test"}
|
||||
cleanup=${CLEANUP:-"true"}
|
||||
delete_instances=${DELETE_INSTANCES:-"false"}
|
||||
|
||||
# Get the compute zone
|
||||
zone=$(gcloud info --format='value(config.properties.compute.zone)')
|
||||
if [[ $zone == "" ]]; then
|
||||
echo "Could not find gcloud compute/zone when running: \`gcloud info --format='value(config.properties.compute.zone)'\`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the compute project
|
||||
project=$(gcloud info --format='value(config.project)')
|
||||
if [[ $project == "" ]]; then
|
||||
echo "Could not find gcloud project when running: \`gcloud info --format='value(config.project)'\`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if any of the images specified already have running instances. If so reuse those instances
|
||||
# by moving the IMAGE to a HOST
|
||||
if [[ $images != "" ]]; then
|
||||
IFS=',' read -ra IM <<< "$images"
|
||||
images=""
|
||||
for i in "${IM[@]}"; do
|
||||
if [[ $(gcloud compute instances list "${instance_prefix}-$i" | grep $i) ]]; then
|
||||
if [[ $hosts != "" ]]; then
|
||||
hosts="$hosts,"
|
||||
fi
|
||||
echo "Reusing host ${instance_prefix}-$i"
|
||||
hosts="${hosts}${instance_prefix}-${i}"
|
||||
else
|
||||
if [[ $images != "" ]]; then
|
||||
images="$images,"
|
||||
fi
|
||||
images="$images$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Output the configuration we will try to run
|
||||
echo "Running tests remotely using"
|
||||
echo "Project: $project"
|
||||
echo "Image Project: $image_project"
|
||||
echo "Compute/Zone: $zone"
|
||||
echo "Images: $images"
|
||||
echo "Hosts: $hosts"
|
||||
echo "Ginkgo Flags: $ginkgoflags"
|
||||
echo "Instance Metadata: $metadata"
|
||||
# Invoke the runner
|
||||
go run test/e2e_node/runner/remote/run_remote.go --logtostderr --vmodule=*=4 --ssh-env="gce" \
|
||||
--zone="$zone" --project="$project" --gubernator="$gubernator" \
|
||||
--hosts="$hosts" --images="$images" --cleanup="$cleanup" \
|
||||
--results-dir="$artifacts" --ginkgo-flags="$ginkgoflags" \
|
||||
--image-project="$image_project" --instance-name-prefix="$instance_prefix" --setup-node="true" \
|
||||
--delete-instances="$delete_instances" --test_args="$test_args" --instance-metadata="$metadata" \
|
||||
2>&1 | tee -i "${artifacts}/build-log.txt"
|
||||
exit $?
|
||||
|
||||
else
|
||||
# Refresh sudo credentials for local run
|
||||
if ! ping -c 1 -q metadata.google.internal &> /dev/null; then
|
||||
echo "Updating sudo credentials"
|
||||
sudo -v || exit 1
|
||||
fi
|
||||
|
||||
# Do not use any network plugin by default. User could override the flags with
|
||||
# test_args.
|
||||
test_args='--kubelet-flags="--network-plugin= --network-plugin-dir=" '$test_args
|
||||
|
||||
# Test using the host the script was run on
|
||||
# Provided for backwards compatibility
|
||||
go run test/e2e_node/runner/local/run_local.go --ginkgo-flags="$ginkgoflags" \
|
||||
--test-flags="--alsologtostderr --v 4 --report-dir=${artifacts} --node-name $(hostname) \
|
||||
$test_args" --build-dependencies=true 2>&1 | tee -i "${artifacts}/build-log.txt"
|
||||
exit $?
|
||||
fi
|
||||
108
vendor/k8s.io/kubernetes/hack/make-rules/test-integration.sh
generated
vendored
Executable file
108
vendor/k8s.io/kubernetes/hack/make-rules/test-integration.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,108 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
# Lists of API Versions of each groups that should be tested, groups are
|
||||
# separated by comma, lists are separated by semicolon. e.g.,
|
||||
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
|
||||
# TODO: It's going to be:
|
||||
# KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1"}
|
||||
# FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go)
|
||||
# ONLY the last version is tested in each group.
|
||||
ALL_VERSIONS_CSV=$(IFS=',';echo "${KUBE_AVAILABLE_GROUP_VERSIONS[*]// /,}";IFS=$)
|
||||
KUBE_TEST_API_VERSIONS="${KUBE_TEST_API_VERSIONS:-${ALL_VERSIONS_CSV}}"
|
||||
|
||||
# Give integration tests longer to run
|
||||
# TODO: allow a larger value to be passed in
|
||||
#KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 240s}
|
||||
KUBE_TIMEOUT="-timeout 600s"
|
||||
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
||||
LOG_LEVEL=${LOG_LEVEL:-2}
|
||||
KUBE_TEST_ARGS=${KUBE_TEST_ARGS:-}
|
||||
|
||||
kube::test::find_integration_test_dirs() {
|
||||
(
|
||||
cd ${KUBE_ROOT}
|
||||
find test/integration/${1-} -name '*_test.go' -print0 \
|
||||
| xargs -0n1 dirname \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
kube::log::status "Cleaning up etcd"
|
||||
kube::etcd::cleanup
|
||||
kube::log::status "Integration test cleanup complete"
|
||||
}
|
||||
|
||||
runTests() {
|
||||
kube::log::status "Starting etcd instance"
|
||||
kube::etcd::start
|
||||
kube::log::status "Running integration test cases"
|
||||
|
||||
# TODO: Re-enable race detection when we switch to a thread-safe etcd client
|
||||
# KUBE_RACE="-race"
|
||||
make -C "${KUBE_ROOT}" test \
|
||||
WHAT="$(kube::test::find_integration_test_dirs ${2-} | paste -sd' ' -) $(echo ${@:3})" \
|
||||
KUBE_GOFLAGS="${KUBE_GOFLAGS:-} ${SHORT:--short=true} -tags 'integration no-docker'" \
|
||||
KUBE_TEST_ARGS="${KUBE_TEST_ARGS:-} --vmodule=garbage*collector*=6 --alsologtostderr=true" \
|
||||
KUBE_RACE="" \
|
||||
KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
|
||||
KUBE_TEST_API_VERSIONS="$1"
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
checkEtcdOnPath() {
|
||||
kube::log::status "Checking etcd is on PATH"
|
||||
which etcd && return
|
||||
kube::log::status "Cannot find etcd, cannot run integration tests."
|
||||
kube::log::status "Please see docs/devel/testing.md for instructions."
|
||||
return 1
|
||||
}
|
||||
|
||||
checkEtcdOnPath
|
||||
|
||||
# Run cleanup to stop etcd on interrupt or other kill signal.
|
||||
trap cleanup EXIT
|
||||
|
||||
# If a test case is specified, just run once with v1 API version and exit
|
||||
if [[ -n "${KUBE_TEST_ARGS}" ]]; then
|
||||
runTests v1
|
||||
fi
|
||||
|
||||
# Pass arguments that begin with "-" and move them to goflags.
|
||||
what_flags=()
|
||||
for arg in "$@"; do
|
||||
if [[ "${arg}" == -* ]]; then
|
||||
what_flags+=("${arg}")
|
||||
fi
|
||||
done
|
||||
if [[ "${#what_flags[@]}" -eq 0 ]]; then
|
||||
what_flags=''
|
||||
fi
|
||||
|
||||
|
||||
# Convert the CSV to an array of API versions to test
|
||||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
||||
for apiVersion in "${apiVersions[@]}"; do
|
||||
runTests "${apiVersion}" "${1-}" "${what_flags[@]}"
|
||||
done
|
||||
32
vendor/k8s.io/kubernetes/hack/make-rules/test-kubeadm-cmd.sh
generated
vendored
Executable file
32
vendor/k8s.io/kubernetes/hack/make-rules/test-kubeadm-cmd.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
KUBEADM_PATH="${KUBEADM_PATH:=$(kube::realpath "${KUBE_ROOT}")/cluster/kubeadm.sh}"
|
||||
|
||||
# If testing a different version of kubeadm than the current build, you can
|
||||
# comment this out to save yourself from needlessly building here.
|
||||
make -C "${KUBE_ROOT}" WHAT=cmd/kubeadm
|
||||
|
||||
make -C "${KUBE_ROOT}" test \
|
||||
WHAT=cmd/kubeadm/test \
|
||||
KUBE_TEST_ARGS="--kubeadm-path '${KUBEADM_PATH}'"
|
||||
326
vendor/k8s.io/kubernetes/hack/make-rules/test.sh
generated
vendored
Executable file
326
vendor/k8s.io/kubernetes/hack/make-rules/test.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,326 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
# start the cache mutation detector by default so that cache mutators will be found
|
||||
KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}"
|
||||
export KUBE_CACHE_MUTATION_DETECTOR
|
||||
|
||||
kube::test::find_dirs() {
|
||||
(
|
||||
cd ${KUBE_ROOT}
|
||||
find -L . -not \( \
|
||||
\( \
|
||||
-path './_artifacts/*' \
|
||||
-o -path './_output/*' \
|
||||
-o -path './_gopath/*' \
|
||||
-o -path './cmd/kubeadm/test/*' \
|
||||
-o -path './contrib/podex/*' \
|
||||
-o -path './output/*' \
|
||||
-o -path './release/*' \
|
||||
-o -path './target/*' \
|
||||
-o -path './test/e2e/*' \
|
||||
-o -path './test/e2e_node/*' \
|
||||
-o -path './test/integration/*' \
|
||||
-o -path './test/component/scheduler/perf/*' \
|
||||
-o -path './third_party/*' \
|
||||
-o -path './staging/*' \
|
||||
-o -path './vendor/*' \
|
||||
\) -prune \
|
||||
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | LC_ALL=C sort -u
|
||||
|
||||
find -L . \
|
||||
-path './_output' -prune \
|
||||
-o -path './vendor/k8s.io/client-go/*' \
|
||||
-o -path './test/e2e_node/system/*' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | LC_ALL=C sort -u
|
||||
)
|
||||
}
|
||||
|
||||
KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 120s}
|
||||
KUBE_COVER=${KUBE_COVER:-n} # set to 'y' to enable coverage collection
|
||||
KUBE_COVERMODE=${KUBE_COVERMODE:-atomic}
|
||||
# How many 'go test' instances to run simultaneously when running tests in
|
||||
# coverage mode.
|
||||
KUBE_COVERPROCS=${KUBE_COVERPROCS:-4}
|
||||
KUBE_RACE=${KUBE_RACE:-} # use KUBE_RACE="-race" to enable race testing
|
||||
# Set to the goveralls binary path to report coverage results to Coveralls.io.
|
||||
KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
|
||||
# Lists of API Versions of each groups that should be tested, groups are
|
||||
# separated by comma, lists are separated by semicolon. e.g.,
|
||||
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
|
||||
# FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go)
|
||||
# ONLY the last version is tested in each group.
|
||||
ALL_VERSIONS_CSV=$(IFS=',';echo "${KUBE_AVAILABLE_GROUP_VERSIONS[*]// /,}";IFS=$),federation/v1beta1
|
||||
KUBE_TEST_API_VERSIONS="${KUBE_TEST_API_VERSIONS:-${ALL_VERSIONS_CSV}}"
|
||||
# once we have multiple group supports
|
||||
# Create a junit-style XML test report in this directory if set.
|
||||
KUBE_JUNIT_REPORT_DIR=${KUBE_JUNIT_REPORT_DIR:-}
|
||||
# Set to 'y' to keep the verbose stdout from tests when KUBE_JUNIT_REPORT_DIR is
|
||||
# set.
|
||||
KUBE_KEEP_VERBOSE_TEST_OUTPUT=${KUBE_KEEP_VERBOSE_TEST_OUTPUT:-n}
|
||||
|
||||
kube::test::usage() {
|
||||
kube::log::usage_from_stdin <<EOF
|
||||
usage: $0 [OPTIONS] [TARGETS]
|
||||
|
||||
OPTIONS:
|
||||
-p <number> : number of parallel workers, must be >= 1
|
||||
EOF
|
||||
}
|
||||
|
||||
isnum() {
|
||||
[[ "$1" =~ ^[0-9]+$ ]]
|
||||
}
|
||||
|
||||
PARALLEL="${PARALLEL:-1}"
|
||||
while getopts "hp:i:" opt ; do
|
||||
case $opt in
|
||||
h)
|
||||
kube::test::usage
|
||||
exit 0
|
||||
;;
|
||||
p)
|
||||
PARALLEL="$OPTARG"
|
||||
if ! isnum "${PARALLEL}" || [[ "${PARALLEL}" -le 0 ]]; then
|
||||
kube::log::usage "'$0': argument to -p must be numeric and greater than 0"
|
||||
kube::test::usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
i)
|
||||
kube::log::usage "'$0': use GOFLAGS='-count <num-iterations>'"
|
||||
kube::test::usage
|
||||
exit 1
|
||||
;;
|
||||
?)
|
||||
kube::test::usage
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
kube::log::usage "Option -$OPTARG <value>"
|
||||
kube::test::usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# Use eval to preserve embedded quoted strings.
|
||||
eval "goflags=(${KUBE_GOFLAGS:-})"
|
||||
eval "testargs=(${KUBE_TEST_ARGS:-})"
|
||||
|
||||
# Used to filter verbose test output.
|
||||
go_test_grep_pattern=".*"
|
||||
|
||||
# The go-junit-report tool needs full test case information to produce a
|
||||
# meaningful report.
|
||||
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
|
||||
goflags+=(-v)
|
||||
# Show only summary lines by matching lines like "status package/test"
|
||||
go_test_grep_pattern="^[^[:space:]]\+[[:space:]]\+[^[:space:]]\+/[^[[:space:]]\+"
|
||||
fi
|
||||
|
||||
# Filter out arguments that start with "-" and move them to goflags.
|
||||
testcases=()
|
||||
for arg; do
|
||||
if [[ "${arg}" == -* ]]; then
|
||||
goflags+=("${arg}")
|
||||
else
|
||||
testcases+=("${arg}")
|
||||
fi
|
||||
done
|
||||
if [[ ${#testcases[@]} -eq 0 ]]; then
|
||||
testcases=($(kube::test::find_dirs))
|
||||
fi
|
||||
set -- "${testcases[@]+${testcases[@]}}"
|
||||
|
||||
junitFilenamePrefix() {
|
||||
if [[ -z "${KUBE_JUNIT_REPORT_DIR}" ]]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
mkdir -p "${KUBE_JUNIT_REPORT_DIR}"
|
||||
# This filename isn't parsed by anything, and we must avoid
|
||||
# exceeding 255 character filename limit. KUBE_TEST_API
|
||||
# barely fits there and in coverage mode test names are
|
||||
# appended to generated file names, easily exceeding
|
||||
# 255 chars in length. So let's just sha1sum it.
|
||||
local KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"|sha1sum|awk '{print $1}')"
|
||||
echo "${KUBE_JUNIT_REPORT_DIR}/junit_${KUBE_TEST_API_HASH}_$(kube::util::sortable_date)"
|
||||
}
|
||||
|
||||
produceJUnitXMLReport() {
|
||||
local -r junit_filename_prefix=$1
|
||||
if [[ -z "${junit_filename_prefix}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local test_stdout_filenames
|
||||
local junit_xml_filename
|
||||
test_stdout_filenames=$(ls ${junit_filename_prefix}*.stdout)
|
||||
junit_xml_filename="${junit_filename_prefix}.xml"
|
||||
if ! command -v go-junit-report >/dev/null 2>&1; then
|
||||
kube::log::error "go-junit-report not found; please install with " \
|
||||
"go get -u github.com/jstemmer/go-junit-report"
|
||||
return
|
||||
fi
|
||||
cat ${test_stdout_filenames} | go-junit-report > "${junit_xml_filename}"
|
||||
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
|
||||
rm ${test_stdout_filenames}
|
||||
fi
|
||||
kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}"
|
||||
}
|
||||
|
||||
runTests() {
|
||||
local junit_filename_prefix
|
||||
junit_filename_prefix=$(junitFilenamePrefix)
|
||||
|
||||
# If we're not collecting coverage, run all requested tests with one 'go test'
|
||||
# command, which is much faster.
|
||||
if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
|
||||
kube::log::status "Running tests without code coverage"
|
||||
# `go test` does not install the things it builds. `go test -i` installs
|
||||
# the build artifacts but doesn't run the tests. The two together provide
|
||||
# a large speedup for tests that do not need to be rebuilt.
|
||||
go test -i "${goflags[@]:+${goflags[@]}}" \
|
||||
${KUBE_RACE} ${KUBE_TIMEOUT} "${@+${@/#/${KUBE_GO_PACKAGE}/}}" \
|
||||
"${testargs[@]:+${testargs[@]}}"
|
||||
go test "${goflags[@]:+${goflags[@]}}" \
|
||||
${KUBE_RACE} ${KUBE_TIMEOUT} "${@+${@/#/${KUBE_GO_PACKAGE}/}}" \
|
||||
"${testargs[@]:+${testargs[@]}}" \
|
||||
| tee ${junit_filename_prefix:+"${junit_filename_prefix}.stdout"} \
|
||||
| grep "${go_test_grep_pattern}" && rc=$? || rc=$?
|
||||
produceJUnitXMLReport "${junit_filename_prefix}"
|
||||
return ${rc}
|
||||
fi
|
||||
|
||||
# Create coverage report directories.
|
||||
cover_report_dir="/tmp/k8s_coverage/${KUBE_TEST_API}/$(kube::util::sortable_date)"
|
||||
cover_profile="coverage.out" # Name for each individual coverage profile
|
||||
kube::log::status "Saving coverage output in '${cover_report_dir}'"
|
||||
mkdir -p "${@+${@/#/${cover_report_dir}/}}"
|
||||
|
||||
# Run all specified tests, collecting coverage results. Go currently doesn't
|
||||
# support collecting coverage across multiple packages at once, so we must issue
|
||||
# separate 'go test' commands for each package and then combine at the end.
|
||||
# To speed things up considerably, we can at least use xargs -P to run multiple
|
||||
# 'go test' commands at once.
|
||||
# To properly parse the test results if generating a JUnit test report, we
|
||||
# must make sure the output from PARALLEL runs is not mixed. To achieve this,
|
||||
# we spawn a subshell for each PARALLEL process, redirecting the output to
|
||||
# separate files.
|
||||
|
||||
# ignore paths:
|
||||
# cmd/libs/go2idl/generator: is fragile when run under coverage, so ignore it for now.
|
||||
# https://github.com/kubernetes/kubernetes/issues/24967
|
||||
# vendor/k8s.io/client-go/1.4/rest: causes cover internal errors
|
||||
# https://github.com/golang/go/issues/16540
|
||||
cover_ignore_dirs="cmd/libs/go2idl/generator|vendor/k8s.io/client-go/1.4/rest"
|
||||
for path in $(echo $cover_ignore_dirs | sed 's/|/ /g'); do
|
||||
echo -e "skipped\tk8s.io/kubernetes/$path"
|
||||
done
|
||||
#
|
||||
# `go test` does not install the things it builds. `go test -i` installs
|
||||
# the build artifacts but doesn't run the tests. The two together provide
|
||||
# a large speedup for tests that do not need to be rebuilt.
|
||||
printf "%s\n" "${@}" | grep -Ev $cover_ignore_dirs | xargs -I{} -n1 -P${KUBE_COVERPROCS} \
|
||||
bash -c "set -o pipefail; _pkg=\"{}\"; _pkg_out=\${_pkg//\//_}; \
|
||||
go test -i ${goflags[@]:+${goflags[@]}} \
|
||||
${KUBE_RACE} \
|
||||
${KUBE_TIMEOUT} \
|
||||
-cover -covermode=\"${KUBE_COVERMODE}\" \
|
||||
-coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \
|
||||
\"${KUBE_GO_PACKAGE}/\${_pkg}\" \
|
||||
${testargs[@]:+${testargs[@]}}
|
||||
go test ${goflags[@]:+${goflags[@]}} \
|
||||
${KUBE_RACE} \
|
||||
${KUBE_TIMEOUT} \
|
||||
-cover -covermode=\"${KUBE_COVERMODE}\" \
|
||||
-coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \
|
||||
\"${KUBE_GO_PACKAGE}/\${_pkg}\" \
|
||||
${testargs[@]:+${testargs[@]}} \
|
||||
| tee ${junit_filename_prefix:+\"${junit_filename_prefix}-\$_pkg_out.stdout\"} \
|
||||
| grep \"${go_test_grep_pattern}\"" \
|
||||
&& test_result=$? || test_result=$?
|
||||
|
||||
produceJUnitXMLReport "${junit_filename_prefix}"
|
||||
|
||||
COMBINED_COVER_PROFILE="${cover_report_dir}/combined-coverage.out"
|
||||
{
|
||||
# The combined coverage profile needs to start with a line indicating which
|
||||
# coverage mode was used (set, count, or atomic). This line is included in
|
||||
# each of the coverage profiles generated when running 'go test -cover', but
|
||||
# we strip these lines out when combining so that there's only one.
|
||||
echo "mode: ${KUBE_COVERMODE}"
|
||||
|
||||
# Include all coverage reach data in the combined profile, but exclude the
|
||||
# 'mode' lines, as there should be only one.
|
||||
for x in `find "${cover_report_dir}" -name "${cover_profile}"`; do
|
||||
cat $x | grep -h -v "^mode:" || true
|
||||
done
|
||||
} >"${COMBINED_COVER_PROFILE}"
|
||||
|
||||
coverage_html_file="${cover_report_dir}/combined-coverage.html"
|
||||
go tool cover -html="${COMBINED_COVER_PROFILE}" -o="${coverage_html_file}"
|
||||
kube::log::status "Combined coverage report: ${coverage_html_file}"
|
||||
|
||||
return ${test_result}
|
||||
}
|
||||
|
||||
reportCoverageToCoveralls() {
|
||||
if [[ ${KUBE_COVER} =~ ^[yY]$ ]] && [[ -x "${KUBE_GOVERALLS_BIN}" ]]; then
|
||||
kube::log::status "Reporting coverage results to Coveralls for service ${CI_NAME:-}"
|
||||
${KUBE_GOVERALLS_BIN} -coverprofile="${COMBINED_COVER_PROFILE}" \
|
||||
${CI_NAME:+"-service=${CI_NAME}"} \
|
||||
${COVERALLS_REPO_TOKEN:+"-repotoken=${COVERALLS_REPO_TOKEN}"} \
|
||||
|| true
|
||||
fi
|
||||
}
|
||||
|
||||
checkFDs() {
|
||||
# several unittests panic when httptest cannot open more sockets
|
||||
# due to the low default files limit on OS X. Warn about low limit.
|
||||
local fileslimit="$(ulimit -n)"
|
||||
if [[ $fileslimit -lt 1000 ]]; then
|
||||
echo "WARNING: ulimit -n (files) should be at least 1000, is $fileslimit, may cause test failure";
|
||||
fi
|
||||
}
|
||||
|
||||
checkFDs
|
||||
|
||||
|
||||
# Convert the CSVs to arrays.
|
||||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
||||
apiVersionsCount=${#apiVersions[@]}
|
||||
for (( i=0; i<${apiVersionsCount}; i++ )); do
|
||||
apiVersion=${apiVersions[i]}
|
||||
echo "Running tests for APIVersion: $apiVersion"
|
||||
# KUBE_TEST_API sets the version of each group to be tested.
|
||||
KUBE_TEST_API="${apiVersion}" runTests "$@"
|
||||
done
|
||||
|
||||
# We might run the tests for multiple versions, but we want to report only
|
||||
# one of them to coveralls. Here we report coverage from the last run.
|
||||
reportCoverageToCoveralls
|
||||
95
vendor/k8s.io/kubernetes/hack/make-rules/verify.sh
generated
vendored
Executable file
95
vendor/k8s.io/kubernetes/hack/make-rules/verify.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,95 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/cluster/lib/util.sh"
|
||||
|
||||
# Excluded checks are always skipped.
|
||||
EXCLUDED_CHECKS=(
|
||||
"verify-linkcheck.sh" # runs in separate Jenkins job once per day due to high network usage
|
||||
"verify-govet.sh" # it has a separate make vet target
|
||||
"verify-staging-client-go.sh" # TODO: enable the script after 1.5 code freeze
|
||||
)
|
||||
|
||||
function is-excluded {
|
||||
if [[ $1 -ef "$KUBE_ROOT/hack/verify-all.sh" ]]; then
|
||||
return
|
||||
fi
|
||||
for e in ${EXCLUDED_CHECKS[@]}; do
|
||||
if [[ $1 -ef "$KUBE_ROOT/hack/$e" ]]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function run-cmd {
|
||||
if ${SILENT}; then
|
||||
"$@" &> /dev/null
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function run-checks {
|
||||
local -r pattern=$1
|
||||
local -r runner=$2
|
||||
|
||||
for t in $(ls ${pattern})
|
||||
do
|
||||
if is-excluded "${t}" ; then
|
||||
echo "Skipping ${t}"
|
||||
continue
|
||||
fi
|
||||
echo -e "Verifying ${t}"
|
||||
local start=$(date +%s)
|
||||
run-cmd "${runner}" "${t}" && tr=$? || tr=$?
|
||||
local elapsed=$(($(date +%s) - ${start}))
|
||||
if [[ ${tr} -eq 0 ]]; then
|
||||
echo -e "${color_green}SUCCESS${color_norm} ${t}\t${elapsed}s"
|
||||
else
|
||||
echo -e "${color_red}FAILED${color_norm} ${t}\t${elapsed}s"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
while getopts ":v" opt; do
|
||||
case ${opt} in
|
||||
v)
|
||||
SILENT=false
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid flag: -${OPTARG}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ${SILENT} ; then
|
||||
echo "Running in silent mode, run with -v if you want to see script logs."
|
||||
fi
|
||||
|
||||
ret=0
|
||||
run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
|
||||
run-checks "${KUBE_ROOT}/hack/verify-*.py" python
|
||||
exit ${ret}
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
49
vendor/k8s.io/kubernetes/hack/make-rules/vet.sh
generated
vendored
Executable file
49
vendor/k8s.io/kubernetes/hack/make-rules/vet.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
cd "${KUBE_ROOT}"
|
||||
|
||||
# This is required before we run govet for the results to be correct.
|
||||
# See https://github.com/golang/go/issues/16086 for details.
|
||||
make generated_files
|
||||
go install ./cmd/...
|
||||
|
||||
# Use eval to preserve embedded quoted strings.
|
||||
eval "goflags=(${KUBE_GOFLAGS:-})"
|
||||
|
||||
# Filter out arguments that start with "-" and move them to goflags.
|
||||
targets=()
|
||||
for arg; do
|
||||
if [[ "${arg}" == -* ]]; then
|
||||
goflags+=("${arg}")
|
||||
else
|
||||
targets+=("${arg}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#targets[@]} -eq 0 ]]; then
|
||||
# Do not run on third_party directories or generated client code.
|
||||
targets=$(go list -e ./... | egrep -v "/(third_party|vendor|staging|clientset_generated)/")
|
||||
fi
|
||||
|
||||
go vet "${goflags[@]:+${goflags[@]}}" ${targets[@]}
|
||||
33
vendor/k8s.io/kubernetes/hack/run-in-gopath.sh
generated
vendored
Executable file
33
vendor/k8s.io/kubernetes/hack/run-in-gopath.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# This script sets up a temporary Kubernetes GOPATH and runs an arbitrary
|
||||
# command under it. Go tooling requires that the current directory be under
|
||||
# GOPATH or else it fails to find some things, such as the vendor directory for
|
||||
# the project.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
# This sets up a clean GOPATH and makes sure we are currently in it.
|
||||
kube::golang::setup_env
|
||||
|
||||
# Run the user-provided command.
|
||||
"${@}"
|
||||
37
vendor/k8s.io/kubernetes/hack/test-cmd.sh
generated
vendored
Executable file
37
vendor/k8s.io/kubernetes/hack/test-cmd.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# This script is a vestigial redirection. Please do not add "real" logic.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# For help output
|
||||
ARGHELP=""
|
||||
if [[ "$#" -gt 0 ]]; then
|
||||
ARGHELP=""
|
||||
fi
|
||||
|
||||
echo "NOTE: $0 has been replaced by 'make test-cmd'"
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make test-cmd ${ARGHELP}"
|
||||
echo
|
||||
echo
|
||||
make --no-print-directory -C "${KUBE_ROOT}" test-cmd
|
||||
37
vendor/k8s.io/kubernetes/hack/test-go.sh
generated
vendored
Executable file
37
vendor/k8s.io/kubernetes/hack/test-go.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# This script is a vestigial redirection. Please do not add "real" logic.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# For help output
|
||||
ARGHELP=""
|
||||
if [[ "$#" -gt 0 ]]; then
|
||||
ARGHELP="WHAT='$@'"
|
||||
fi
|
||||
|
||||
echo "NOTE: $0 has been replaced by 'make test'"
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make test ${ARGHELP}"
|
||||
echo
|
||||
echo
|
||||
make --no-print-directory -C "${KUBE_ROOT}" test WHAT="$*"
|
||||
38
vendor/k8s.io/kubernetes/hack/test-integration.sh
generated
vendored
Executable file
38
vendor/k8s.io/kubernetes/hack/test-integration.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# This script is a vestigial redirection. Please do not add "real" logic.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
# For help output
|
||||
ARGHELP=""
|
||||
if [[ "$#" -gt 0 ]]; then
|
||||
ARGHELP="WHAT='$@'"
|
||||
fi
|
||||
|
||||
echo "NOTE: $0 has been replaced by 'make test-integration'"
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make test-integration ${ARGHELP}"
|
||||
echo
|
||||
echo
|
||||
make --no-print-directory -C "${KUBE_ROOT}" test-integration WHAT="$*"
|
||||
|
||||
225
vendor/k8s.io/kubernetes/hack/test-update-storage-objects.sh
generated
vendored
Executable file
225
vendor/k8s.io/kubernetes/hack/test-update-storage-objects.sh
generated
vendored
Executable file
|
|
@ -0,0 +1,225 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# Script to test cluster/update-storage-objects.sh works as expected.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
# The api version in which objects are currently stored in etcd.
|
||||
KUBE_OLD_API_VERSION=${KUBE_OLD_API_VERSION:-"v1"}
|
||||
# The api version in which our etcd objects should be converted to.
|
||||
# The new api version
|
||||
KUBE_NEW_API_VERSION=${KUBE_NEW_API_VERSION:-"v1"}
|
||||
|
||||
KUBE_OLD_STORAGE_VERSIONS=${KUBE_OLD_STORAGE_VERSIONs:-""}
|
||||
KUBE_NEW_STORAGE_VERSIONS=${KUBE_NEW_STORAGE_VERSIONs:-""}
|
||||
|
||||
STORAGE_BACKEND_ETCD2="etcd2"
|
||||
STORAGE_BACKEND_ETCD3="etcd3"
|
||||
|
||||
KUBE_STORAGE_MEDIA_TYPE_JSON="application/json"
|
||||
KUBE_STORAGE_MEDIA_TYPE_PROTOBUF="application/vnd.kubernetes.protobuf"
|
||||
|
||||
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${ETCD_PORT:-2379}
|
||||
ETCD_PREFIX=${ETCD_PREFIX:-randomPrefix}
|
||||
API_PORT=${API_PORT:-8080}
|
||||
API_HOST=${API_HOST:-127.0.0.1}
|
||||
KUBE_API_VERSIONS=""
|
||||
RUNTIME_CONFIG=""
|
||||
|
||||
ETCDCTL=$(which etcdctl)
|
||||
KUBECTL="${KUBE_OUTPUT_HOSTBIN}/kubectl"
|
||||
UPDATE_ETCD_OBJECTS_SCRIPT="${KUBE_ROOT}/cluster/update-storage-objects.sh"
|
||||
|
||||
function startApiServer() {
|
||||
local storage_backend=${1:-"${STORAGE_BACKEND_ETCD2}"}
|
||||
local storage_versions=${2:-""}
|
||||
local storage_media_type=${3:-""}
|
||||
kube::log::status "Starting kube-apiserver with KUBE_API_VERSIONS: ${KUBE_API_VERSIONS}"
|
||||
kube::log::status " and storage-backend: ${storage_backend}"
|
||||
kube::log::status " and storage-media-type: ${storage_media_type}"
|
||||
kube::log::status " and runtime-config: ${RUNTIME_CONFIG}"
|
||||
kube::log::status " and storage-version overrides: ${storage_versions}"
|
||||
|
||||
KUBE_API_VERSIONS="${KUBE_API_VERSIONS}" \
|
||||
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
--insecure-bind-address="${API_HOST}" \
|
||||
--bind-address="${API_HOST}" \
|
||||
--insecure-port="${API_PORT}" \
|
||||
--storage-backend="${storage_backend}" \
|
||||
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||
--etcd-prefix="/${ETCD_PREFIX}" \
|
||||
--runtime-config="${RUNTIME_CONFIG}" \
|
||||
--cert-dir="${TMPDIR:-/tmp/}" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" \
|
||||
--storage-versions="${storage_versions}" \
|
||||
--storage-media-type=${storage_media_type} 1>&2 &
|
||||
APISERVER_PID=$!
|
||||
|
||||
# url, prefix, wait, times
|
||||
kube::util::wait_for_url "http://${API_HOST}:${API_PORT}/healthz" "apiserver: " 1 120
|
||||
}
|
||||
|
||||
function killApiServer() {
|
||||
kube::log::status "Killing api server"
|
||||
if [[ -n ${APISERVER_PID-} ]]; then
|
||||
kill ${APISERVER_PID} 1>&2 2>/dev/null
|
||||
wait ${APISERVER_PID} || true
|
||||
kube::log::status "api server exited"
|
||||
fi
|
||||
unset APISERVER_PID
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
killApiServer
|
||||
|
||||
kube::etcd::cleanup
|
||||
|
||||
kube::log::status "Clean up complete"
|
||||
}
|
||||
|
||||
trap cleanup EXIT SIGINT
|
||||
|
||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
||||
make -C "${KUBE_ROOT}" WHAT=cluster/images/etcd/attachlease
|
||||
|
||||
kube::etcd::start
|
||||
echo "${ETCD_VERSION}/${STORAGE_BACKEND_ETCD2}" > "${ETCD_DIR}/version.txt"
|
||||
|
||||
### BEGIN TEST DEFINITION CUSTOMIZATION ###
|
||||
|
||||
# source_file,resource,namespace,name,old_version,new_version
|
||||
tests=(
|
||||
test/fixtures/doc-yaml/user-guide/job.yaml,jobs,default,pi,extensions/v1beta1,batch/v1
|
||||
test/fixtures/doc-yaml/user-guide/horizontal-pod-autoscaling/hpa-php-apache.yaml,horizontalpodautoscalers,default,php-apache,extensions/v1beta1,autoscaling/v1
|
||||
)
|
||||
|
||||
# need to include extensions/v1beta1 in new api version because its internal types are used by jobs
|
||||
# and hpas
|
||||
KUBE_OLD_API_VERSION="v1,extensions/v1beta1"
|
||||
KUBE_NEW_API_VERSION="v1,extensions/v1beta1,batch/v1,autoscaling/v1"
|
||||
KUBE_OLD_STORAGE_VERSIONS="batch=extensions/v1beta1,autoscaling=extensions/v1beta1"
|
||||
KUBE_NEW_STORAGE_VERSIONS="batch/v1,autoscaling/v1"
|
||||
|
||||
### END TEST DEFINITION CUSTOMIZATION ###
|
||||
|
||||
#######################################################
|
||||
# Step 1: Start a server which supports both the old and new api versions,
|
||||
# but KUBE_OLD_API_VERSION is the latest (storage) version.
|
||||
# Additionally use KUBE_STORAGE_MEDIA_TYPE_JSON for storage encoding.
|
||||
#######################################################
|
||||
KUBE_API_VERSIONS="${KUBE_OLD_API_VERSION},${KUBE_NEW_API_VERSION}"
|
||||
RUNTIME_CONFIG="api/all=false,api/${KUBE_OLD_API_VERSION}=true,api/${KUBE_NEW_API_VERSION}=true"
|
||||
startApiServer ${STORAGE_BACKEND_ETCD2} ${KUBE_OLD_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_JSON}
|
||||
|
||||
|
||||
# Create object(s)
|
||||
for test in ${tests[@]}; do
|
||||
IFS=',' read -ra test_data <<<"$test"
|
||||
source_file=${test_data[0]}
|
||||
|
||||
kube::log::status "Creating ${source_file}"
|
||||
${KUBECTL} create -f "${source_file}"
|
||||
|
||||
# Verify that the storage version is the old version
|
||||
resource=${test_data[1]}
|
||||
namespace=${test_data[2]}
|
||||
name=${test_data[3]}
|
||||
old_storage_version=${test_data[4]}
|
||||
|
||||
kube::log::status "Verifying ${resource}/${namespace}/${name} has storage version ${old_storage_version} in etcd"
|
||||
curl -s http://${ETCD_HOST}:${ETCD_PORT}/v2/keys/${ETCD_PREFIX}/${resource}/${namespace}/${name} | grep ${old_storage_version}
|
||||
done
|
||||
|
||||
killApiServer
|
||||
|
||||
|
||||
#######################################################
|
||||
# Step 2: Perform etcd2 -> etcd migration.
|
||||
# We always perform offline migration, so we need to stop etcd.
|
||||
#######################################################
|
||||
|
||||
kube::etcd::stop
|
||||
TARGET_STORAGE="etcd3" \
|
||||
TARGET_VERSION="3.0.14" \
|
||||
DATA_DIRECTORY="${ETCD_DIR}" \
|
||||
ETCD=$(which etcd) \
|
||||
ETCDCTL=$(which etcdctl) \
|
||||
ATTACHLEASE="${KUBE_OUTPUT_HOSTBIN}/attachlease" \
|
||||
DO_NOT_MOVE_BINARIES="true" \
|
||||
${KUBE_ROOT}/cluster/images/etcd/migrate-if-needed.sh
|
||||
kube::etcd::start
|
||||
|
||||
|
||||
#######################################################
|
||||
# Step 3: Start a server which supports both the old and new api versions,
|
||||
# but KUBE_NEW_API_VERSION is the latest (storage) version.
|
||||
# Still use KUBE_STORAGE_MEDIA_TYPE_JSON for storage encoding.
|
||||
#######################################################
|
||||
|
||||
KUBE_API_VERSIONS="${KUBE_NEW_API_VERSION},${KUBE_OLD_API_VERSION}"
|
||||
RUNTIME_CONFIG="api/all=false,api/${KUBE_OLD_API_VERSION}=true,api/${KUBE_NEW_API_VERSION}=true"
|
||||
startApiServer ${STORAGE_BACKEND_ETCD3} ${KUBE_NEW_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_JSON}
|
||||
|
||||
# Update etcd objects, so that will now be stored in the new api version.
|
||||
kube::log::status "Updating storage versions in etcd"
|
||||
${UPDATE_ETCD_OBJECTS_SCRIPT}
|
||||
|
||||
# Verify that the storage version was changed in etcd
|
||||
for test in ${tests[@]}; do
|
||||
IFS=',' read -ra test_data <<<"$test"
|
||||
resource=${test_data[1]}
|
||||
namespace=${test_data[2]}
|
||||
name=${test_data[3]}
|
||||
new_storage_version=${test_data[5]}
|
||||
|
||||
kube::log::status "Verifying ${resource}/${namespace}/${name} has updated storage version ${new_storage_version} in etcd"
|
||||
ETCDCTL_API=3 ${ETCDCTL} --endpoints="${ETCD_HOST}:${ETCD_PORT}" get "/${ETCD_PREFIX}/${resource}/${namespace}/${name}" | grep ${new_storage_version}
|
||||
done
|
||||
|
||||
killApiServer
|
||||
|
||||
|
||||
#######################################################
|
||||
# Step 4 : Start a server which supports only the new api version.
|
||||
# However, change storage encoding to KUBE_STORAGE_MEDIA_TYPE_PROTOBUF.
|
||||
#######################################################
|
||||
|
||||
KUBE_API_VERSIONS="${KUBE_NEW_API_VERSION}"
|
||||
RUNTIME_CONFIG="api/all=false,api/${KUBE_NEW_API_VERSION}=true"
|
||||
|
||||
# This seems to reduce flakiness.
|
||||
sleep 1
|
||||
startApiServer ${STORAGE_BACKEND_ETCD3} ${KUBE_NEW_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_PROTOBUF}
|
||||
|
||||
for test in ${tests[@]}; do
|
||||
IFS=',' read -ra test_data <<<"$test"
|
||||
resource=${test_data[1]}
|
||||
namespace=${test_data[2]}
|
||||
name=${test_data[3]}
|
||||
|
||||
# Verify that the server is able to read the object.
|
||||
kube::log::status "Verifying we can retrieve ${resource}/${namespace}/${name} via kubectl"
|
||||
${KUBECTL} get --namespace=${namespace} ${resource}/${name}
|
||||
done
|
||||
|
||||
killApiServer
|
||||
6
vendor/k8s.io/kubernetes/hack/testdata/csr.yml
generated
vendored
Normal file
6
vendor/k8s.io/kubernetes/hack/testdata/csr.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: certificates.k8s.io/v1alpha1
|
||||
kind: CertificateSigningRequest
|
||||
metadata:
|
||||
name: foo
|
||||
spec:
|
||||
request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ2d6Q0NBV3NDQVFBd0ZURVRNQkVHQTFVRUF4TUthM1ZpWlMxaFpHMXBiakNDQVNJd0RRWUpLb1pJaHZjTgpBUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTlJ5dFhkcWV6ZTFBdXFjZkpWYlFBY1BJejZWY2pXSTZ5WmlQa3lrCjAzUW9GaHJGRXhUQXNPTGVFUHlrQXc1YndUOWZiajRXMzZmR2k4RGxsd1FzVGoyYzVUTnBnQkkwbElDbzI4aGcKbHYvTDJsMnRsWUVKdDdTbVhjblNvaGJ5S0h4TERRUHVmTVBBTkZsaEFmTUdCWEhRcmZMajhrTk1MUDA4UlBsbAp0N3V4RDVRdFA0cHlGL1Nhbm1XVEtRNU56WlJ4TC82UmhJMEpxSHJmNFFjQmg2dlR5bnFaRGVmMWVxNjBnQXllClNPRkpKYWRuK3h2VEFqLzgxZk1TbjdOSlNnaktDYkNEeXQ1eS9UZHd0SzZnVUQzM01paE5uNXhKTVF0MUZXUVAKRzY3eTA1QVh6b0pqTm5sWVA1MnJsTlhvNzh6aVMrN1E4RklxQzY0c05vWWhxeGNDQXdFQUFhQXBNQ2NHQ1NxRwpTSWIzRFFFSkRqRWFNQmd3Q1FZRFZSMFRCQUl3QURBTEJnTlZIUThFQkFNQ0JlQXdEUVlKS29aSWh2Y05BUUVMCkJRQURnZ0VCQU5CazlwaHpWYUJBci9xZHN4bXdPR1NQa094UkZlR1lyemRvaW5LTzVGUGZER2JkU0VWQ0o1K0wKeWJTNUtmaUZYU1EvNmk0RE9WRWtxcnFrVElIc1JNSlJwbTZ5Zjk1TU4zSWVLak9jQlV2b2VWVlpxMUNOUU8zagp2dklmK1A1NStLdXpvK0NIT1F5RWlvTlRPaUtGWTJseStEZEEwMXMxbU9FMTZSWGlWeFhGcFhGeGRJVmRPK0oxClZ1MW5yWG5ZVFJQRmtyaG80MTlpaDQzNjRPcGZqYXFXVCtmd20ySVZQSlBoaUJpYi9RRzRhUGJJcFh3amlCUUMKemV6WlM2L01nQkt1bUdMZ3Z5MitXNU9UWTJ5ZFFMZFVxbERFNEU2MFhmdVZ6bk5zWjZDS0tYY1pVaW1ZTkkwNgpKa0t4bGRjd0V2cmI0SmN3M2RFQjdOOUwvSW9ZNXFBPQotLS0tLUVORCBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0K
|
||||
24
vendor/k8s.io/kubernetes/hack/testdata/deployment-multicontainer-resources.yaml
generated
vendored
Normal file
24
vendor/k8s.io/kubernetes/hack/testdata/deployment-multicontainer-resources.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment-resources
|
||||
labels:
|
||||
name: nginx-deployment-resources
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: gcr.io/google-containers/nginx:test-cmd
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- name: perl
|
||||
image: gcr.io/google-containers/perl
|
||||
terminationGracePeriodSeconds: 0
|
||||
23
vendor/k8s.io/kubernetes/hack/testdata/deployment-multicontainer.yaml
generated
vendored
Normal file
23
vendor/k8s.io/kubernetes/hack/testdata/deployment-multicontainer.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
labels:
|
||||
name: nginx-deployment
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: gcr.io/google-containers/nginx:test-cmd
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- name: perl
|
||||
image: gcr.io/google-containers/perl
|
||||
21
vendor/k8s.io/kubernetes/hack/testdata/deployment-revision1.yaml
generated
vendored
Normal file
21
vendor/k8s.io/kubernetes/hack/testdata/deployment-revision1.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx
|
||||
labels:
|
||||
name: nginx-undo
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx-undo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx-undo
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: gcr.io/google-containers/nginx:test-cmd
|
||||
ports:
|
||||
- containerPort: 80
|
||||
21
vendor/k8s.io/kubernetes/hack/testdata/deployment-revision2.yaml
generated
vendored
Normal file
21
vendor/k8s.io/kubernetes/hack/testdata/deployment-revision2.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx
|
||||
labels:
|
||||
name: nginx-undo
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx-undo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx-undo
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: gcr.io/google-containers/nginx:1.7.9
|
||||
ports:
|
||||
- containerPort: 80
|
||||
11
vendor/k8s.io/kubernetes/hack/testdata/filter/pod-apply-selector.yaml
generated
vendored
Normal file
11
vendor/k8s.io/kubernetes/hack/testdata/filter/pod-apply-selector.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: selector-test-pod
|
||||
labels:
|
||||
name: selector-test-pod
|
||||
unique-label: bingbang
|
||||
spec:
|
||||
containers:
|
||||
- name: kubernetes-pause
|
||||
image: gcr.io/google-containers/pause:2.0
|
||||
11
vendor/k8s.io/kubernetes/hack/testdata/filter/pod-dont-apply.yaml
generated
vendored
Normal file
11
vendor/k8s.io/kubernetes/hack/testdata/filter/pod-dont-apply.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: selector-test-pod-dont-apply
|
||||
labels:
|
||||
name: selector-test-pod-dont-apply
|
||||
unique-label: biz
|
||||
spec:
|
||||
containers:
|
||||
- name: kubernetes-pause
|
||||
image: gcr.io/google-containers/pause:2.0
|
||||
44
vendor/k8s.io/kubernetes/hack/testdata/frontend-controller.yaml
generated
vendored
Normal file
44
vendor/k8s.io/kubernetes/hack/testdata/frontend-controller.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: frontend
|
||||
# these labels can be applied automatically
|
||||
# from the labels in the pod template if not set
|
||||
# labels:
|
||||
# app: guestbook
|
||||
# tier: frontend
|
||||
spec:
|
||||
# this replicas value is default
|
||||
# modify it according to your case
|
||||
replicas: 3
|
||||
# selector can be applied automatically
|
||||
# from the labels in the pod template if not set
|
||||
# selector:
|
||||
# app: guestbook
|
||||
# tier: frontend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: guestbook
|
||||
tier: frontend
|
||||
spec:
|
||||
# Setting terminationGracePeriodSeconds to zero to delete pods immediately on delete request,
|
||||
# since in tests we usually check and expect the pods being deleted right after deletion.
|
||||
terminationGracePeriodSeconds: 0
|
||||
containers:
|
||||
- name: php-redis
|
||||
image: gcr.io/google_samples/gb-frontend:v4
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: GET_HOSTS_FROM
|
||||
value: dns
|
||||
# If your cluster config does not include a dns service, then to
|
||||
# instead access environment variables to find service host
|
||||
# info, comment out the 'value: dns' line above, and uncomment the
|
||||
# line below.
|
||||
# value: env
|
||||
ports:
|
||||
- containerPort: 80
|
||||
42
vendor/k8s.io/kubernetes/hack/testdata/frontend-replicaset.yaml
generated
vendored
Normal file
42
vendor/k8s.io/kubernetes/hack/testdata/frontend-replicaset.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: ReplicaSet
|
||||
metadata:
|
||||
name: frontend
|
||||
# these labels can be applied automatically
|
||||
# from the labels in the pod template if not set
|
||||
# labels:
|
||||
# app: guestbook
|
||||
# tier: frontend
|
||||
spec:
|
||||
# this replicas value is default
|
||||
# modify it according to your case
|
||||
replicas: 3
|
||||
# selector can be applied automatically
|
||||
# from the labels in the pod template if not set
|
||||
# selector:
|
||||
# matchLabels:
|
||||
# app: guestbook
|
||||
# tier: frontend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: guestbook
|
||||
tier: frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: php-redis
|
||||
image: gcr.io/google_samples/gb-frontend:v3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: GET_HOSTS_FROM
|
||||
value: dns
|
||||
# If your cluster config does not include a dns service, then to
|
||||
# instead access environment variables to find service host
|
||||
# info, comment out the 'value: dns' line above, and uncomment the
|
||||
# line below.
|
||||
# value: env
|
||||
ports:
|
||||
- containerPort: 80
|
||||
20
vendor/k8s.io/kubernetes/hack/testdata/invalid-rc-with-empty-args.yaml
generated
vendored
Normal file
20
vendor/k8s.io/kubernetes/hack/testdata/invalid-rc-with-empty-args.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-dns-v10
|
||||
namespace: kube-system
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-dns
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-dns
|
||||
spec:
|
||||
containers:
|
||||
- name: carbon-relay
|
||||
image: banno/carbon-relay
|
||||
args:
|
||||
-
|
||||
# above is the empty arg string.
|
||||
29
vendor/k8s.io/kubernetes/hack/testdata/list.yaml
generated
vendored
Normal file
29
vendor/k8s.io/kubernetes/hack/testdata/list.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
apiVersion: v1
|
||||
kind: List
|
||||
items:
|
||||
- apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: list-service-test
|
||||
spec:
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
selector:
|
||||
app: list-deployment-test
|
||||
- apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: list-deployment-test
|
||||
labels:
|
||||
app: list-deployment-test
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: list-deployment-test
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
||||
55
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-json-modify.json
generated
vendored
Normal file
55
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-json-modify.json
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-json.json
generated
vendored
Normal file
53
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-json.json
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
61
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-list-modify.json
generated
vendored
Normal file
61
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-list-modify.json
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"kind":"List",
|
||||
"apiVersion":"v1",
|
||||
"items":[
|
||||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
59
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-list.json
generated
vendored
Normal file
59
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-list.json
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"kind":"List",
|
||||
"apiVersion":"v1",
|
||||
"items":[
|
||||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
74
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-rclist-modify.json
generated
vendored
Normal file
74
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-rclist-modify.json
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"kind":"ReplicationControllerList",
|
||||
"apiVersion":"v1",
|
||||
"items":[
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock2",
|
||||
"labels":{
|
||||
"app":"mock2",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock2"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock2"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
74
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-rclist.json
generated
vendored
Normal file
74
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-rclist.json
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"kind":"ReplicationControllerList",
|
||||
"apiVersion":"v1",
|
||||
"items":[
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind":"ReplicationController",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock2",
|
||||
"labels":{
|
||||
"app":"mock2",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"replicas":1,
|
||||
"selector":{
|
||||
"app":"mock2"
|
||||
},
|
||||
"template":{
|
||||
"metadata":{
|
||||
"labels":{
|
||||
"app":"mock2"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"containers":[{
|
||||
"name": "mock-container",
|
||||
"image": "gcr.io/google-containers/pause:2.0",
|
||||
"ports":[{
|
||||
"containerPort":9949,
|
||||
"protocol":"TCP"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
48
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-svclist-modify.json
generated
vendored
Normal file
48
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-svclist-modify.json
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"kind":"ServiceList",
|
||||
"apiVersion":"v1",
|
||||
"items":[
|
||||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock2",
|
||||
"labels":{
|
||||
"app":"mock2",
|
||||
"status":"replaced"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock2"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
46
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-svclist.json
generated
vendored
Normal file
46
vendor/k8s.io/kubernetes/hack/testdata/multi-resource-svclist.json
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"kind":"ServiceList",
|
||||
"apiVersion":"v1",
|
||||
"items":[
|
||||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock",
|
||||
"labels":{
|
||||
"app":"mock"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind":"Service",
|
||||
"apiVersion":"v1",
|
||||
"metadata":{
|
||||
"name":"mock2",
|
||||
"labels":{
|
||||
"app":"mock2"
|
||||
}
|
||||
},
|
||||
"spec":{
|
||||
"ports": [{
|
||||
"protocol": "TCP",
|
||||
"port": 99,
|
||||
"targetPort": 9949
|
||||
}],
|
||||
"selector":{
|
||||
"app":"mock2"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue