vendor updates

This commit is contained in:
Serguei Bezverkhi
2018-03-06 17:33:18 -05:00
parent 4b3ebc171b
commit e9033989a0
5854 changed files with 248382 additions and 119809 deletions

View File

@ -1,12 +1,10 @@
cluster/images/etcd-version-monitor
cmd/gke-certificates-controller/app
cmd/hyperkube
cmd/kube-controller-manager/app
cmd/kube-proxy/app
cmd/kube-scheduler/app
cmd/kubeadm/app
cmd/kubeadm/app/apis/kubeadm
cmd/kubeadm/app/apis/kubeadm/v1alpha1
cmd/kubeadm/app/phases/etcd/spec
cmd/kubelet/app
cmd/kubelet/app/options
cmd/kubemark
@ -78,15 +76,13 @@ pkg/apis/storage/v1beta1/util
pkg/auth/authorizer/abac
pkg/capabilities
pkg/client/chaosclient
pkg/client/informers/informers_generated/internalversion/internalinterfaces
pkg/client/leaderelectionconfig
pkg/client/tests
pkg/client/unversioned/testclient/simple
pkg/cloudprovider
pkg/cloudprovider/providers/aws
pkg/cloudprovider/providers/fake
pkg/cloudprovider/providers/gce
pkg/cloudprovider/providers/openstack
pkg/cloudprovider/providers/gce/cloud
pkg/cloudprovider/providers/ovirt
pkg/cloudprovider/providers/photon
pkg/cloudprovider/providers/vsphere
@ -99,7 +95,6 @@ pkg/controller/cloud
pkg/controller/clusterroleaggregation
pkg/controller/cronjob
pkg/controller/daemon
pkg/controller/daemon/util
pkg/controller/deployment
pkg/controller/deployment/util
pkg/controller/disruption
@ -154,17 +149,17 @@ pkg/kubectl/cmd/util/jsonmerge
pkg/kubectl/cmd/util/sanity
pkg/kubectl/metricsutil
pkg/kubectl/resource
pkg/kubectl/testing
pkg/kubectl/util
pkg/kubectl/util/crlf
pkg/kubectl/util/slice
pkg/kubelet
pkg/kubelet/apis
pkg/kubelet/apis/cri/runtime/v1alpha2
pkg/kubelet/apis/cri/testing
pkg/kubelet/apis/cri/v1alpha1/runtime
pkg/kubelet/apis/deviceplugin/v1alpha
pkg/kubelet/apis/deviceplugin/v1beta1
pkg/kubelet/apis/kubeletconfig
pkg/kubelet/apis/kubeletconfig/v1alpha1
pkg/kubelet/apis/kubeletconfig/v1beta1
pkg/kubelet/cadvisor
pkg/kubelet/cadvisor/testing
pkg/kubelet/client
@ -177,7 +172,6 @@ pkg/kubelet/custommetrics
pkg/kubelet/dockershim
pkg/kubelet/dockershim/cm
pkg/kubelet/dockershim/libdocker
pkg/kubelet/dockershim/remote
pkg/kubelet/dockershim/testing
pkg/kubelet/events
pkg/kubelet/gpu
@ -204,7 +198,6 @@ pkg/kubelet/prober/testing
pkg/kubelet/qos
pkg/kubelet/remote
pkg/kubelet/rkt
pkg/kubelet/rktshim
pkg/kubelet/secret
pkg/kubelet/server
pkg/kubelet/server/portforward
@ -243,6 +236,12 @@ pkg/registry/admissionregistration/initializerconfiguration/storage
pkg/registry/admissionregistration/mutatingwebhookconfiguration/storage
pkg/registry/admissionregistration/rest
pkg/registry/admissionregistration/validatingwebhookconfiguration/storage
pkg/registry/apps/daemonset
pkg/registry/apps/daemonset/storage
pkg/registry/apps/deployment
pkg/registry/apps/deployment/storage
pkg/registry/apps/replicaset
pkg/registry/apps/replicaset/storage
pkg/registry/apps/rest
pkg/registry/apps/statefulset
pkg/registry/apps/statefulset/storage
@ -296,14 +295,8 @@ pkg/registry/core/service/storage
pkg/registry/core/serviceaccount/storage
pkg/registry/events/rest
pkg/registry/extensions/controller/storage
pkg/registry/extensions/daemonset
pkg/registry/extensions/daemonset/storage
pkg/registry/extensions/deployment
pkg/registry/extensions/deployment/storage
pkg/registry/extensions/ingress
pkg/registry/extensions/ingress/storage
pkg/registry/extensions/replicaset
pkg/registry/extensions/replicaset/storage
pkg/registry/extensions/rest
pkg/registry/networking/networkpolicy/storage
pkg/registry/networking/rest
@ -331,6 +324,7 @@ pkg/registry/storage/rest
pkg/registry/storage/storageclass
pkg/registry/storage/storageclass/storage
pkg/routes
pkg/scheduler/api
pkg/security/apparmor
pkg/security/podsecuritypolicy
pkg/security/podsecuritypolicy/group
@ -379,8 +373,8 @@ pkg/volume/aws_ebs
pkg/volume/azure_dd
pkg/volume/azure_file
pkg/volume/cephfs
pkg/volume/cinder
pkg/volume/configmap
pkg/volume/csi/fake
pkg/volume/empty_dir
pkg/volume/fc
pkg/volume/flexvolume
@ -399,8 +393,10 @@ pkg/volume/secret
pkg/volume/storageos
pkg/volume/testing
pkg/volume/util
pkg/volume/util/fs
pkg/volume/util/recyclerclient
pkg/volume/util/volumepathhandler
pkg/volume/vsphere_volume
plugin/cmd/kube-scheduler/app
plugin/pkg/admission/antiaffinity
plugin/pkg/admission/eventratelimit/apis/eventratelimit
plugin/pkg/admission/eventratelimit/apis/eventratelimit/v1alpha1
@ -419,22 +415,8 @@ plugin/pkg/admission/resourcequota/apis/resourcequota/v1alpha1
plugin/pkg/admission/security
plugin/pkg/admission/security/podsecuritypolicy
plugin/pkg/admission/serviceaccount
plugin/pkg/admission/storageclass/setdefault
plugin/pkg/auth/authorizer/node
plugin/pkg/auth/authorizer/rbac
plugin/pkg/scheduler/algorithm
plugin/pkg/scheduler/algorithm/predicates
plugin/pkg/scheduler/algorithm/priorities
plugin/pkg/scheduler/algorithm/priorities/util
plugin/pkg/scheduler/api
plugin/pkg/scheduler/api/latest
plugin/pkg/scheduler/api/v1
plugin/pkg/scheduler/core
plugin/pkg/scheduler/factory
plugin/pkg/scheduler/metrics
plugin/pkg/scheduler/schedulercache
plugin/pkg/scheduler/testing
plugin/pkg/scheduler/util
staging/src/k8s.io/api/admission/v1beta1
staging/src/k8s.io/api/admissionregistration/v1alpha1
staging/src/k8s.io/api/admissionregistration/v1beta1
@ -476,23 +458,10 @@ staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informe
staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1
staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/fake
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset/fake
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset/scheme
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset/typed/apiextensions/internalversion
staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset/typed/apiextensions/internalversion/fake
staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/internalinterfaces
staging/src/k8s.io/apiextensions-apiserver/pkg/client/informers/internalversion/internalinterfaces
staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server
staging/src/k8s.io/apiextensions-apiserver/pkg/controller/finalizer
staging/src/k8s.io/apiextensions-apiserver/pkg/controller/status
staging/src/k8s.io/apiextensions-apiserver/pkg/features
staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource
staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresourcedefinition
staging/src/k8s.io/apiextensions-apiserver/test/integration/testserver
staging/src/k8s.io/apimachinery/pkg/api/meta
@ -506,7 +475,7 @@ staging/src/k8s.io/apimachinery/pkg/apis/meta/fuzzer
staging/src/k8s.io/apimachinery/pkg/apis/meta/internalversion
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1
staging/src/k8s.io/apimachinery/pkg/conversion
@ -609,6 +578,7 @@ staging/src/k8s.io/apiserver/pkg/storage/storagebackend
staging/src/k8s.io/apiserver/pkg/storage/testing
staging/src/k8s.io/apiserver/pkg/storage/tests
staging/src/k8s.io/apiserver/pkg/storage/value
staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1
staging/src/k8s.io/apiserver/pkg/util/feature
staging/src/k8s.io/apiserver/pkg/util/flag
staging/src/k8s.io/apiserver/pkg/util/proxy
@ -616,10 +586,8 @@ staging/src/k8s.io/apiserver/pkg/util/trace
staging/src/k8s.io/apiserver/pkg/util/webhook
staging/src/k8s.io/apiserver/pkg/util/wsstream
staging/src/k8s.io/apiserver/plugin/pkg/audit/log
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/password/keystone
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/password/passwordfile
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/testing
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/tokentest
staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook
staging/src/k8s.io/apiserver/plugin/pkg/authorizer/webhook
@ -627,20 +595,6 @@ staging/src/k8s.io/client-go/discovery/cached
staging/src/k8s.io/client-go/dynamic
staging/src/k8s.io/client-go/dynamic/fake
staging/src/k8s.io/client-go/examples/workqueue
staging/src/k8s.io/client-go/informers/internalinterfaces
staging/src/k8s.io/client-go/kubernetes
staging/src/k8s.io/client-go/kubernetes/fake
staging/src/k8s.io/client-go/kubernetes/scheme
staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1
staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/apps/v1
staging/src/k8s.io/client-go/kubernetes/typed/apps/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta2
staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta2/fake
staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1
staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1
@ -649,45 +603,12 @@ staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1
staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1
staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/core/v1
staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/networking/v1
staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1
staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1
staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1
staging/src/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/settings/v1alpha1
staging/src/k8s.io/client-go/kubernetes/typed/settings/v1alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1alpha1
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake
staging/src/k8s.io/client-go/plugin/pkg/auth/authenticator/token/oidc/testing
staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc
staging/src/k8s.io/client-go/rest
staging/src/k8s.io/client-go/rest/fake
@ -727,14 +648,12 @@ staging/src/k8s.io/code-generator/cmd/client-gen/generators/scheme
staging/src/k8s.io/code-generator/cmd/client-gen/types
staging/src/k8s.io/code-generator/cmd/conversion-gen/generators
staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf
staging/src/k8s.io/code-generator/cmd/informer-gen/generators
staging/src/k8s.io/code-generator/cmd/lister-gen/generators
staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration
staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1
staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1
staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/validation
staging/src/k8s.io/kube-aggregator/pkg/apiserver
staging/src/k8s.io/kube-aggregator/pkg/client/informers/externalversions/internalinterfaces
staging/src/k8s.io/kube-aggregator/pkg/client/informers/internalversion/internalinterfaces
staging/src/k8s.io/kube-aggregator/pkg/cmd/server
staging/src/k8s.io/kube-aggregator/pkg/controllers/autoregister
staging/src/k8s.io/kube-aggregator/pkg/controllers/status
@ -742,37 +661,23 @@ staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice
staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd
staging/src/k8s.io/metrics/pkg/apis/custom_metrics
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1
staging/src/k8s.io/metrics/pkg/apis/external_metrics
staging/src/k8s.io/metrics/pkg/apis/external_metrics/v1beta1
staging/src/k8s.io/metrics/pkg/apis/metrics
staging/src/k8s.io/metrics/pkg/apis/metrics/v1alpha1
staging/src/k8s.io/metrics/pkg/apis/metrics/v1beta1
staging/src/k8s.io/metrics/pkg/client/custom_metrics
staging/src/k8s.io/metrics/pkg/client/custom_metrics/fake
staging/src/k8s.io/metrics/pkg/client/external_metrics
staging/src/k8s.io/metrics/pkg/client/external_metrics/fake
staging/src/k8s.io/sample-apiserver/pkg/apis/wardle
staging/src/k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1
staging/src/k8s.io/sample-apiserver/pkg/apiserver
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/internalversion
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/internalversion/fake
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/internalversion/scheme
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/internalversion/typed/wardle/internalversion
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/internalversion/typed/wardle/internalversion/fake
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/versioned
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/versioned/fake
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/versioned/scheme
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/versioned/typed/wardle/v1alpha1
staging/src/k8s.io/sample-apiserver/pkg/client/clientset/versioned/typed/wardle/v1alpha1/fake
staging/src/k8s.io/sample-apiserver/pkg/client/informers/externalversions/internalinterfaces
staging/src/k8s.io/sample-apiserver/pkg/client/informers/internalversion/internalinterfaces
staging/src/k8s.io/sample-apiserver/pkg/cmd/server
staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/fischer
staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder
staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller
staging/src/k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1
staging/src/k8s.io/sample-controller/pkg/client/clientset/versioned
staging/src/k8s.io/sample-controller/pkg/client/clientset/versioned/fake
staging/src/k8s.io/sample-controller/pkg/client/clientset/versioned/scheme
staging/src/k8s.io/sample-controller/pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1
staging/src/k8s.io/sample-controller/pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/fake
staging/src/k8s.io/sample-controller/pkg/client/informers/externalversions/internalinterfaces
test/e2e
test/e2e/apimachinery
test/e2e/apps
@ -789,13 +694,14 @@ test/e2e/instrumentation/monitoring
test/e2e/kubectl
test/e2e/lifecycle
test/e2e/lifecycle/bootstrap
test/e2e/multicluster
test/e2e/network
test/e2e/node
test/e2e/scalability
test/e2e/scheduling
test/e2e/servicecatalog
test/e2e/storage
test/e2e/storage/utils
test/e2e/storage/vsphere
test/e2e/ui
test/e2e/upgrades
test/e2e/upgrades/apps

19
vendor/k8s.io/kubernetes/hack/.spelling_failures generated vendored Normal file
View File

@ -0,0 +1,19 @@
BUILD
CHANGELOG
OWNERS
api.pb.go
api.proto
docs/api-reference
docs/man
docs/user-guide
generated.pb.go
generated.proto
pkg/client/clientset_generated
pkg/client/informers/informers_generated/
pkg/generated
swagger
test/e2e/generated
third_party/
translations/
vendor/
zz_generated

View File

@ -57,16 +57,14 @@ test_suite(
go_binary(
name = "hack",
importpath = "k8s.io/kubernetes/hack",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_test(
name = "go_default_test",
srcs = ["e2e_test.go"],
data = glob(["testdata/**"]),
importpath = "k8s.io/kubernetes/hack",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View File

@ -14,7 +14,6 @@ approvers:
- cblecker
- deads2k
- eparis
- fabianofranz
- fejta
- ixdy
- jbeda
@ -27,3 +26,4 @@ approvers:
- sttts
- gmarek
- vishh
- liggitt

View 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.

View File

@ -131,12 +131,13 @@ function make-a-pr() {
# when we shove the heredoc at hub directly, tickling the ioctl
# crash.
prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas
local numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
cat >"${prtext}" <<EOF
Automated cherry pick of ${PULLSUBJ}
Automated cherry pick of ${numandtitle}
Cherry pick of ${PULLSUBJ} on ${rel}.
$(printf '%s\n' "${SUBJECTS[@]}")
${numandtitle}
EOF
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "kubernetes:${rel}"

View File

@ -9,15 +9,13 @@ load(
go_binary(
name = "teststale",
importpath = "k8s.io/kubernetes/hack/cmd/teststale",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_test(
name = "go_default_test",
srcs = ["teststale_test.go"],
importpath = "k8s.io/kubernetes/hack/cmd/teststale",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View File

@ -3,7 +3,7 @@ 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 .
$ sudo docker build -t k8s.gcr.io/gen-swagger-docs:v1 .
```
To generate the html docs,

View File

@ -22,7 +22,7 @@ if [[ -z "${KUBE_ROOT:-}" ]]; then
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
fi
source "${KUBE_ROOT}/cluster/lib/logging.sh"
source "${KUBE_ROOT}/hack/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."
@ -39,7 +39,7 @@ if ! which go-bindata &>/dev/null ; then
fi
# run the generation from the root directory for stable output
pushd "${KUBE_ROOT}"
pushd "${KUBE_ROOT}" >/dev/null
# These are files for e2e tests.
BINDATA_OUTPUT="test/e2e/generated/bindata.go"
@ -84,4 +84,4 @@ fi
rm -f "${BINDATA_OUTPUT}.tmp"
popd
popd >/dev/null

View File

@ -45,6 +45,17 @@ export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-util.sh"
function detect-master-from-kubeconfig() {
export KUBECONFIG=${KUBECONFIG:-$DEFAULT_KUBECONFIG}
local cc=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.current-context}")
if [[ ! -z "${KUBE_CONTEXT:-}" ]]; then
cc="${KUBE_CONTEXT}"
fi
local cluster=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.contexts[?(@.name == \"${cc}\")].context.cluster}")
KUBE_MASTER_URL=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.clusters[?(@.name == \"${cluster}\")].cluster.server}")
}
# ---- Do cloud-provider-specific setup
if [[ -n "${KUBERNETES_CONFORMANCE_TEST:-}" ]]; then
echo "Conformance test: not doing test setup."

View File

@ -20,7 +20,6 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
source "${KUBE_ROOT}/hack/lib/util.sh"
kube::log::status "Restoring kubernetes godeps"

View File

@ -20,7 +20,6 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
source "${KUBE_ROOT}/hack/lib/util.sh"
kube::log::status "Ensuring prereqs"
kube::util::ensure_single_dir_gopath
@ -59,6 +58,7 @@ REQUIRED_BINS=(
"github.com/onsi/ginkgo/ginkgo"
"github.com/jteeuwen/go-bindata/go-bindata"
"github.com/tools/godep"
"github.com/client9/misspell/cmd/misspell"
"./..."
)
@ -86,5 +86,13 @@ hack/update-bazel.sh >/dev/null
kube::log::status "Updating LICENSES file"
hack/update-godep-licenses.sh >/dev/null
kube::log::status "Creating OWNERS file"
rm -f "Godeps/OWNERS" "vendor/OWNERS"
cat <<__EOF__ > "Godeps/OWNERS"
approvers:
- dep-approvers
__EOF__
cp "Godeps/OWNERS" "vendor/OWNERS"
# Clean up
rm -rf "${BACKUP}"

View File

@ -51,7 +51,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
server_addr=""
kubelet_addreses=""
kubelet_addresses=""
kubelet_binary=""
master_binary=""
scheduler_binary=""
@ -72,10 +72,10 @@ fi
HEAPSTER_VERSION="v0.18.2"
MASTER_PPROF_PATH=""
HEAPSTER_PPROF_PATH="/api/v1/proxy/namespaces/kube-system/services/monitoring-heapster"
HEAPSTER_PPROF_PATH="/api/v1/namespaces/kube-system/services/monitoring-heapster/proxy"
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"
SCHEDULER_PPROF_PATH_PREFIX="/api/v1/namespaces/kube-system/pods/kube-scheduler/proxy"
CONTROLLER_MANAGER_PPROF_PATH_PREFIX="/api/v1/namespaces/kube-system/pods/kube-controller-manager/proxy"
eval set -- "${args}"
@ -97,7 +97,7 @@ while true; do
--master-binary)
shift
if [ -z "$1" ]; then
>&2 echo "empty argumet to --master-binary flag"
>&2 echo "empty argument to --master-binary flag"
exit 1
fi
master_binary=$1
@ -111,16 +111,16 @@ while true; do
shift
profile_components="kubelet ${profile_components}"
if [ -z "$1" ]; then
>&2 echo "empty argumet to --kubelet flag"
>&2 echo "empty argument to --kubelet flag"
exit 1
fi
kubelet_addreses="$1 $kubelet_addreses"
kubelet_addresses="$1 $kubelet_addresses"
shift
;;
--kubelet-binary)
shift
if [ -z "$1" ]; then
>&2 echo "empty argumet to --kubelet-binary flag"
>&2 echo "empty argument to --kubelet-binary flag"
exit 1
fi
kubelet_binary=$1
@ -133,7 +133,7 @@ while true; do
--scheduler-binary)
shift
if [ -z "$1" ]; then
>&2 echo "empty argumet to --scheduler-binary flag"
>&2 echo "empty argument to --scheduler-binary flag"
exit 1
fi
scheduler_binary=$1
@ -142,7 +142,7 @@ while true; do
--scheduler-port)
shift
if [ -z "$1" ]; then
>&2 echo "empty argumet to --scheduler-port flag"
>&2 echo "empty argument to --scheduler-port flag"
exit 1
fi
scheduler_port=$1
@ -155,7 +155,7 @@ while true; do
--controller-manager-binary)
shift
if [ -z "$1" ]; then
>&2 echo "empty argumet to --controller-manager-binary flag"
>&2 echo "empty argument to --controller-manager-binary flag"
exit 1
fi
controller_manager_binary=$1
@ -164,10 +164,10 @@ while true; do
--controller-manager-port)
shift
if [ -z "$1" ]; then
>&2 echo "empty argumet to --controller-manager-port flag"
>&2 echo "empty argument to --controller-manager-port flag"
exit 1
fi
controller-managerr_port=$1
controller_manager_port=$1
shift
;;
-o|--output)
@ -240,18 +240,18 @@ if [[ -z "${requested_profiles}" ]]; then
exit 1
fi
gcloud compute ssh "${server_addr}" --ssh-flag=-nN --ssh-flag=-L${tunnel_port}:localhost:8080 &
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
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
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)
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_addresses=$(echo "${kubelet_addresses}" | xargs -n1 | LC_ALL=C sort -u | xargs)
echo "requested profiles: ${requested_profiles}"
echo "flags for heap profile: ${mem_pprof_flags}"
@ -291,10 +291,10 @@ for component in ${profile_components}; do
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
for node in ${kubelet_addresses//[,;]/' '}; do
grab_profiles_from_component "${requested_profiles}" "${mem_pprof_flags}" "${binary}" "${tunnel_port}" "${path}/${node}/proxy" "${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

View File

@ -0,0 +1,53 @@
#!/bin/bash
# Copyright 2018 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 benchmark integration tests, producing pretty-printed results
# in ${WORKSPACE}/artifacts. This script can also be run within a
# kubekins-test container with a kubernetes repo mounted (at the path
# /go/src/k8s.io/kubernetes).
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
retry go get github.com/cespare/prettybench
# Disable the Go race detector.
export KUBE_RACE=" "
# Disable coverage report
export KUBE_COVER="n"
export ARTIFACTS_DIR=${WORKSPACE}/_artifacts
mkdir -p "${ARTIFACTS_DIR}"
cd /go/src/k8s.io/kubernetes
./hack/install-etcd.sh
# Run the benchmark tests and pretty-print the results into a separate file.
make test-integration WHAT="$*" KUBE_TEST_ARGS="-run='XXX' -bench=. -benchmem" \
| tee \
>(prettybench -no-passthrough > ${ARTIFACTS_DIR}/BenchmarkResults.txt) \
>(go run test/integration/benchmark/jsonify/main.go ${ARTIFACTS_DIR}/BenchmarkResults_benchmark_$(date -u +%Y-%m-%dT%H:%M:%SZ).json || cat > /dev/null)

View File

@ -33,7 +33,6 @@ retry() {
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.
@ -45,7 +44,6 @@ 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

View File

@ -31,18 +31,14 @@ retry() {
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
# Produce a JUnit-style XML test report
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/artifacts
# Set artifacts directory
export ARTIFACTS_DIR=${WORKSPACE}/artifacts
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.
./hack/godep-restore.sh || ./hack/godep-restore.sh
./hack/install-etcd.sh
make verify

View File

@ -32,6 +32,5 @@ 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

View File

@ -6,14 +6,12 @@ sh_library(
"etcd.sh",
"golang.sh",
"init.sh",
"logging.sh",
"swagger.sh",
"test.sh",
"util.sh",
"version.sh",
],
deps = [
"//cluster/lib",
],
)
filegroup(

View File

@ -16,21 +16,30 @@
# A set of helpers for starting/running etcd for tests
ETCD_VERSION=${ETCD_VERSION:-3.1.10}
ETCD_VERSION=${ETCD_VERSION:-3.2.14}
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
kube::etcd::validate() {
# validate if in path
which etcd >/dev/null || {
command -v etcd >/dev/null || {
kube::log::usage "etcd must be in your PATH"
exit 1
}
# validate it is not running
if pgrep -x etcd >/dev/null 2>&1; then
kube::log::usage "etcd appears to already be running on this machine (`pgrep -xl etcd`) (or its a zombie and you need to kill its parent)."
kube::log::usage "retry after you resolve this etcd error."
# validate etcd port is free
local port_check_command
if command -v ss &> /dev/null && ss -Version | grep 'iproute2' &> /dev/null; then
port_check_command="ss"
elif command -v netstat &>/dev/null; then
port_check_command="netstat"
else
kube::log::usage "unable to identify if etcd is bound to port ${ETCD_PORT}. unable to find ss or netstat utilities."
exit 1
fi
if ${port_check_command} -nat | grep "LISTEN" | grep "[\.:]${ETCD_PORT:?}" >/dev/null 2>&1; then
kube::log::usage "unable to start etcd as port ${ETCD_PORT} is in use. please stop the process listening on this port and retry."
kube::log::usage "`netstat -nat | grep "[\.:]${ETCD_PORT:?} .*LISTEN"`"
exit 1
fi
@ -74,12 +83,16 @@ kube::etcd::start() {
}
kube::etcd::stop() {
kill "${ETCD_PID-}" >/dev/null 2>&1 || :
wait "${ETCD_PID-}" >/dev/null 2>&1 || :
if [[ -n "${ETCD_PID-}" ]]; then
kill "${ETCD_PID}" &>/dev/null || :
wait "${ETCD_PID}" &>/dev/null || :
fi
}
kube::etcd::clean_etcd_dir() {
rm -rf "${ETCD_DIR-}"
if [[ -n "${ETCD_DIR-}" ]]; then
rm -rf "${ETCD_DIR}"
fi
}
kube::etcd::cleanup() {

View File

@ -29,15 +29,16 @@ kube::golang::server_targets() {
cmd/kubelet
cmd/kubeadm
cmd/hyperkube
cmd/kube-scheduler
vendor/k8s.io/kube-aggregator
vendor/k8s.io/apiextensions-apiserver
plugin/cmd/kube-scheduler
cluster/gce/gci/mounter
)
echo "${targets[@]}"
}
readonly KUBE_SERVER_TARGETS=($(kube::golang::server_targets))
IFS=" " read -ra KUBE_SERVER_TARGETS <<< "$(kube::golang::server_targets)"
readonly KUBE_SERVER_TARGETS
readonly KUBE_SERVER_BINARIES=("${KUBE_SERVER_TARGETS[@]##*/}")
# The set of server targets that we are only building for Kubernetes nodes
@ -51,15 +52,20 @@ kube::golang::node_targets() {
echo "${targets[@]}"
}
readonly KUBE_NODE_TARGETS=($(kube::golang::node_targets))
IFS=" " read -ra KUBE_NODE_TARGETS <<< "$(kube::golang::node_targets)"
readonly KUBE_NODE_TARGETS
readonly KUBE_NODE_BINARIES=("${KUBE_NODE_TARGETS[@]##*/}")
readonly KUBE_NODE_BINARIES_WIN=("${KUBE_NODE_BINARIES[@]/%/.exe}")
if [[ -n "${KUBE_BUILD_PLATFORMS:-}" ]]; then
readonly KUBE_SERVER_PLATFORMS=(${KUBE_BUILD_PLATFORMS})
readonly KUBE_NODE_PLATFORMS=(${KUBE_BUILD_PLATFORMS})
readonly KUBE_TEST_PLATFORMS=(${KUBE_BUILD_PLATFORMS})
readonly KUBE_CLIENT_PLATFORMS=(${KUBE_BUILD_PLATFORMS})
IFS=" " read -ra KUBE_SERVER_PLATFORMS <<< "$KUBE_BUILD_PLATFORMS"
IFS=" " read -ra KUBE_NODE_PLATFORMS <<< "$KUBE_BUILD_PLATFORMS"
IFS=" " read -ra KUBE_TEST_PLATFORMS <<< "$KUBE_BUILD_PLATFORMS"
IFS=" " read -ra KUBE_CLIENT_PLATFORMS <<< "$KUBE_BUILD_PLATFORMS"
readonly KUBE_SERVER_PLATFORMS
readonly KUBE_NODE_PLATFORMS
readonly KUBE_TEST_PLATFORMS
readonly KUBE_CLIENT_PLATFORMS
elif [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then
readonly KUBE_SERVER_PLATFORMS=(linux/amd64)
readonly KUBE_NODE_PLATFORMS=(linux/amd64)
@ -146,7 +152,8 @@ kube::golang::test_targets() {
)
echo "${targets[@]}"
}
readonly KUBE_TEST_TARGETS=($(kube::golang::test_targets))
IFS=" " read -ra KUBE_TEST_TARGETS <<< "$(kube::golang::test_targets)"
readonly KUBE_TEST_TARGETS
readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
# If you update this list, please also update build/BUILD.
@ -177,24 +184,21 @@ kube::golang::server_test_targets() {
echo "${targets[@]}"
}
readonly KUBE_TEST_SERVER_TARGETS=($(kube::golang::server_test_targets))
IFS=" " read -ra KUBE_TEST_SERVER_TARGETS <<< "$(kube::golang::server_test_targets)"
readonly KUBE_TEST_SERVER_TARGETS
readonly KUBE_TEST_SERVER_BINARIES=("${KUBE_TEST_SERVER_TARGETS[@]##*/}")
readonly KUBE_TEST_SERVER_PLATFORMS=("${KUBE_SERVER_PLATFORMS[@]}")
# Gigabytes desired for parallel platform builds. 11 is fairly
# arbitrary, but is a reasonable splitting point for 2015
# laptops-versus-not.
readonly KUBE_PARALLEL_BUILD_MEMORY=11
# Gigabytes necessary for parallel platform builds.
# As of January 2018, RAM usage is exceeding 30G
# Setting to 40 to provide some headroom
readonly KUBE_PARALLEL_BUILD_MEMORY=40
# TODO(pipejakob) gke-certificates-controller is included here to exercise its
# compilation, but it doesn't need to be distributed in any of our tars. Its
# code is only living in this repo temporarily until it finds a new home.
readonly KUBE_ALL_TARGETS=(
"${KUBE_SERVER_TARGETS[@]}"
"${KUBE_CLIENT_TARGETS[@]}"
"${KUBE_TEST_TARGETS[@]}"
"${KUBE_TEST_SERVER_TARGETS[@]}"
cmd/gke-certificates-controller
)
readonly KUBE_ALL_BINARIES=("${KUBE_ALL_TARGETS[@]##*/}")
@ -320,10 +324,10 @@ EOF
fi
local go_version
go_version=($(go version))
IFS=" " read -ra go_version <<< "$(go version)"
local minimum_go_version
minimum_go_version=go1.9.1
if [[ "${go_version[2]}" < "${minimum_go_version}" && "${go_version[2]}" != "devel" ]]; then
if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
kube::log::usage_from_stdin <<EOF
Detected go version: ${go_version[*]}.
Kubernetes requires ${minimum_go_version} or greater.
@ -397,7 +401,7 @@ kube::golang::place_bins() {
# The substitution on platform_src below will replace all slashes with
# underscores. It'll transform darwin/amd64 -> darwin_amd64.
local platform_src="/${platform//\//_}"
if [[ $platform == $host_platform ]]; then
if [[ "$platform" == "$host_platform" ]]; then
platform_src=""
rm -f "${THIS_PLATFORM_BIN}"
ln -s "${KUBE_OUTPUT_BINPATH}/${platform}" "${THIS_PLATFORM_BIN}"
@ -461,7 +465,7 @@ kube::golang::output_filename_for_binary() {
local binary=$1
local platform=$2
local output_path="${KUBE_GOPATH}/bin"
if [[ $platform != $host_platform ]]; then
if [[ "$platform" != "$host_platform" ]]; then
output_path="${output_path}/${platform//\//_}"
fi
local bin=$(basename "${binary}")
@ -644,7 +648,8 @@ kube::golang::build_binaries() {
targets=("${KUBE_ALL_TARGETS[@]}")
fi
local -a platforms=(${KUBE_BUILD_PLATFORMS:-})
local -a platforms
IFS=" " read -ra platforms <<< "${KUBE_BUILD_PLATFORMS:-}"
if [[ ${#platforms[@]} -eq 0 ]]; then
platforms=("${host_platform}")
fi
@ -670,7 +675,7 @@ kube::golang::build_binaries() {
kube::golang::build_kube_toolchain
kube::log::status "Generating bindata:" "${KUBE_BINDATAS[@]}"
for bindata in ${KUBE_BINDATAS[@]}; do
for bindata in "${KUBE_BINDATAS[@]}"; do
# Only try to generate bindata if the file exists, since in some cases
# one-off builds of individual directories may exclude some files.
if [[ -f "${KUBE_ROOT}/${bindata}" ]]; then

View File

@ -18,6 +18,10 @@ set -o errexit
set -o nounset
set -o pipefail
# Unset CDPATH so that path interpolation can work correctly
# https://github.com/kubernetes/kubernetes/issues/52255
unset CDPATH
# The root of the build/dist directory
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE}")/../.." && pwd -P)"
@ -37,7 +41,7 @@ export no_proxy=127.0.0.1,localhost
THIS_PLATFORM_BIN="${KUBE_ROOT}/_output/bin"
source "${KUBE_ROOT}/hack/lib/util.sh"
source "${KUBE_ROOT}/cluster/lib/logging.sh"
source "${KUBE_ROOT}/hack/lib/logging.sh"
kube::log::install_errexit
@ -127,7 +131,7 @@ function kube::readlinkdashf {
cd "$1"
pwd -P
else
cd $(dirname "$1")
cd "$(dirname "$1")"
local f
f=$(basename "$1")
if [[ -L "$f" ]]; then

171
vendor/k8s.io/kubernetes/hack/lib/logging.sh generated vendored Normal file
View File

@ -0,0 +1,171 @@
#!/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.
# Controls verbosity of the script output and logging.
KUBE_VERBOSE="${KUBE_VERBOSE:-5}"
# Handler for when we exit automatically on an error.
# Borrowed from https://gist.github.com/ahendrix/7030300
kube::log::errexit() {
local err="${PIPESTATUS[@]}"
# If the shell we are in doesn't have errexit set (common in subshells) then
# don't dump stacks.
set +o | grep -qe "-o errexit" || return
set +o xtrace
local code="${1:-1}"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
then
kube::log::error "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
do
kube::log::error " $i: ${BASH_SOURCE[$i+1]}:${BASH_LINENO[$i]} ${FUNCNAME[$i]}(...)"
done
fi
kube::log::error_exit "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err" "${1:-1}" 1
}
kube::log::install_errexit() {
# trap ERR to provide an error handler whenever a command exits nonzero this
# is a more verbose version of set -o errexit
trap 'kube::log::errexit' ERR
# setting errtrace allows our ERR trap handler to be propagated to functions,
# expansions and subshells
set -o errtrace
}
# Print out the stack trace
#
# Args:
# $1 The number of stack frames to skip when printing.
kube::log::stack() {
local stack_skip=${1:-0}
stack_skip=$((stack_skip + 1))
if [[ ${#FUNCNAME[@]} -gt $stack_skip ]]; then
echo "Call stack:" >&2
local i
for ((i=1 ; i <= ${#FUNCNAME[@]} - $stack_skip ; i++))
do
local frame_no=$((i - 1 + stack_skip))
local source_file=${BASH_SOURCE[$frame_no]}
local source_lineno=${BASH_LINENO[$((frame_no - 1))]}
local funcname=${FUNCNAME[$frame_no]}
echo " $i: ${source_file}:${source_lineno} ${funcname}(...)" >&2
done
fi
}
# Log an error and exit.
# Args:
# $1 Message to log with the error
# $2 The error code to return
# $3 The number of stack frames to skip when printing.
kube::log::error_exit() {
local message="${1:-}"
local code="${2:-1}"
local stack_skip="${3:-0}"
stack_skip=$((stack_skip + 1))
if [[ ${KUBE_VERBOSE} -ge 4 ]]; then
local source_file=${BASH_SOURCE[$stack_skip]}
local source_line=${BASH_LINENO[$((stack_skip - 1))]}
echo "!!! Error in ${source_file}:${source_line}" >&2
[[ -z ${1-} ]] || {
echo " ${1}" >&2
}
kube::log::stack $stack_skip
echo "Exiting with status ${code}" >&2
fi
exit "${code}"
}
# Log an error but keep going. Don't dump the stack or exit.
kube::log::error() {
timestamp=$(date +"[%m%d %H:%M:%S]")
echo "!!! $timestamp ${1-}" >&2
shift
for message; do
echo " $message" >&2
done
}
# Print an usage message to stderr. The arguments are printed directly.
kube::log::usage() {
echo >&2
local message
for message; do
echo "$message" >&2
done
echo >&2
}
kube::log::usage_from_stdin() {
local messages=()
while read -r line; do
messages+=("$line")
done
kube::log::usage "${messages[@]}"
}
# Print out some info that isn't a top level status line
kube::log::info() {
local V="${V:-0}"
if [[ $KUBE_VERBOSE < $V ]]; then
return
fi
for message; do
echo "$message"
done
}
# Just like kube::log::info, but no \n, so you can make a progress bar
kube::log::progress() {
for message; do
echo -e -n "$message"
done
}
kube::log::info_from_stdin() {
local messages=()
while read -r line; do
messages+=("$line")
done
kube::log::info "${messages[@]}"
}
# Print a status line. Formatted to show up in a stream of output.
kube::log::status() {
local V="${V:-0}"
if [[ $KUBE_VERBOSE < $V ]]; then
return
fi
timestamp=$(date +"[%m%d %H:%M:%S]")
echo "+++ $timestamp $1"
shift
for message; do
echo " $message"
done
}

View File

@ -57,7 +57,7 @@ function kube::protoc::check_protoc() {
# $1: Full path to the directory where the api.proto file is
function kube::protoc::protoc() {
local package=${1}
gogopath=$(dirname $(kube::util::find-binary "protoc-gen-gogo"))
gogopath=$(dirname "$(kube::util::find-binary "protoc-gen-gogo")")
PATH="${gogopath}:${PATH}" protoc \
--proto_path="${package}" \

View File

@ -117,7 +117,7 @@ kube::swagger::gen_api_ref_docs() {
-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 \
k8s.gcr.io/gen-swagger-docs:v8 \
"${swagger_json_name}"
done

View File

@ -265,7 +265,7 @@ kube::test::if_has_string() {
local message=$1
local match=$2
if echo "$message" | grep -q "$match"; then
if grep -q "${match}" <<< "${message}"; then
echo "Successful"
echo "message:$message"
echo "has:$match"
@ -283,7 +283,7 @@ kube::test::if_has_not_string() {
local message=$1
local match=$2
if echo "$message" | grep -q "$match"; then
if grep -q "${match}" <<< "${message}"; then
echo "FAIL!"
echo "message:$message"
echo "has:$match"

View File

@ -30,13 +30,13 @@ kube::util::wait_for_url() {
}
local i
for i in $(seq 1 $times); do
for i in $(seq 1 "$times"); do
local out
if out=$(curl --max-time 1 -gkfs $url 2>/dev/null); then
if out=$(curl --max-time 1 -gkfs "$url" 2>/dev/null); then
kube::log::status "On try ${i}, ${prefix}: ${out}"
return 0
fi
sleep ${wait}
sleep "${wait}"
done
kube::log::error "Timed out waiting for ${prefix} to answer at ${url}; tried ${times} waiting ${wait} between each"
return 1
@ -148,10 +148,11 @@ kube::util::find-binary-for-platform() {
"${KUBE_ROOT}/platforms/${platform}/${lookfor}"
)
# Also search for binary in bazel build tree.
# In some cases we have to name the binary $BINARY_bin, since there was a
# directory named $BINARY next to it.
# The bazel go rules place binaries in subtrees like
# "bazel-bin/source/path/linux_amd64_pure_stripped/binaryname", so make sure
# the platform name is matched in the path.
locations+=($(find "${KUBE_ROOT}/bazel-bin/" -type f -executable \
\( -name "${lookfor}" -o -name "${lookfor}_bin" \) 2>/dev/null || true) )
-path "*/${platform/\//_}*/${lookfor}" 2>/dev/null || true) )
# List most recently-updated location.
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
@ -208,7 +209,7 @@ kube::util::gen-docs() {
# Puts a placeholder for every generated doc. This makes the link checker work.
kube::util::set-placeholder-gen-docs() {
local list_file="${KUBE_ROOT}/docs/.generated_docs"
if [ -e ${list_file} ]; then
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
@ -243,11 +244,9 @@ kube::util::remove-gen-docs() {
kube::util::group-version-to-pkg-path() {
staging_apis=(
$(
pushd ${KUBE_ROOT}/staging/src/k8s.io/api > /dev/null
find . -name types.go | xargs -n1 dirname | sed "s|\./||g" | sort
popd > /dev/null
)
)
cd "${KUBE_ROOT}/staging/src/k8s.io/api" &&
find . -name types.go -exec dirname {} \; | sed "s|\./||g" | sort
))
local group_version="$1"
@ -273,14 +272,8 @@ kube::util::group-version-to-pkg-path() {
meta/v1)
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
;;
meta/v1)
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
;;
meta/v1alpha1)
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
;;
meta/v1alpha1)
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
meta/v1beta1)
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1"
;;
unversioned)
echo "pkg/api/unversioned"
@ -445,6 +438,9 @@ kube::util::ensure_godep_version() {
kube::log::status "Installing godep version ${GODEP_VERSION}"
go install ./vendor/github.com/tools/godep/
GP="$(echo $GOPATH | cut -f1 -d:)"
hash -r # force bash to clear PATH cache
PATH="${GP}/bin:${PATH}"
if [[ "$(godep version 2>/dev/null)" != *"godep ${GODEP_VERSION}"* ]]; then
kube::log::error "Expected godep ${GODEP_VERSION}, got $(godep version)"
@ -457,7 +453,12 @@ kube::util::ensure_godep_version() {
kube::util::ensure_no_staging_repos_in_gopath() {
kube::util::ensure_single_dir_gopath
local error=0
for repo in $(ls ${KUBE_ROOT}/staging/src/k8s.io); do
for repo_file in "${KUBE_ROOT}"/staging/src/k8s.io/*; do
if [[ ! -d "$repo_file" ]]; then
# not a directory or there were no files
continue;
fi
repo="$(basename "$repo_file")"
if [ -e "${GOPATH}/src/k8s.io/${repo}" ]; then
echo "k8s.io/${repo} exists in GOPATH. Remove before running godep-save.sh." 1>&2
error=1

View File

@ -62,7 +62,7 @@ kube::version::get_version_vars() {
fi
fi
# Use git describe to find the version based on annotated tags.
# Use git describe to find the version based on 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:
@ -89,13 +89,20 @@ kube::version::get_version_vars() {
# 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
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
# If KUBE_GIT_VERSION is not a valid Semantic Version, then refuse to build.
if ! [[ "${KUBE_GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "KUBE_GIT_VERSION should be a valid Semantic Version"
echo "Please see more details here: https://semver.org"
exit 1
fi
fi
fi
}
@ -133,8 +140,8 @@ kube::version::ldflag() {
local val=${2}
# If you update these, also update the list pkg/version/def.bzl.
echo "-X ${KUBE_GO_PACKAGE}/pkg/version.${key}=${val}"
echo "-X ${KUBE_GO_PACKAGE}/vendor/k8s.io/client-go/pkg/version.${key}=${val}"
echo "-X '${KUBE_GO_PACKAGE}/pkg/version.${key}=${val}'"
echo "-X '${KUBE_GO_PACKAGE}/vendor/k8s.io/client-go/pkg/version.${key}=${val}'"
}
# Prints the value that needs to be passed to the -ldflags parameter of go build

View File

@ -23,7 +23,7 @@ DOCKER_OPTS=${DOCKER_OPTS:-""}
DOCKER=(docker ${DOCKER_OPTS})
DOCKERIZE_KUBELET=${DOCKERIZE_KUBELET:-""}
ALLOW_PRIVILEGED=${ALLOW_PRIVILEGED:-""}
ALLOW_SECURITY_CONTEXT=${ALLOW_SECURITY_CONTEXT:-""}
DENY_SECURITY_CONTEXT_ADMISSION=${DENY_SECURITY_CONTEXT_ADMISSION:-""}
PSP_ADMISSION=${PSP_ADMISSION:-""}
NODE_ADMISSION=${NODE_ADMISSION:-""}
RUNTIME_CONFIG=${RUNTIME_CONFIG:-""}
@ -57,20 +57,24 @@ EVICTION_PRESSURE_TRANSITION_PERIOD=${EVICTION_PRESSURE_TRANSITION_PERIOD:-"1m"}
# and we don't know the IP of the DNS pod to pass in as --cluster-dns.
# To set this up by hand, set this flag and change DNS_SERVER_IP.
# Note also that you need API_HOST (defined above) for correct DNS.
KUBEPROXY_MODE=${KUBEPROXY_MODE:-""}
KUBE_PROXY_MODE=${KUBE_PROXY_MODE:-""}
ENABLE_CLUSTER_DNS=${KUBE_ENABLE_CLUSTER_DNS:-true}
DNS_SERVER_IP=${KUBE_DNS_SERVER_IP:-10.0.0.10}
DNS_DOMAIN=${KUBE_DNS_NAME:-"cluster.local"}
KUBECTL=${KUBECTL:-cluster/kubectl.sh}
WAIT_FOR_URL_API_SERVER=${WAIT_FOR_URL_API_SERVER:-20}
WAIT_FOR_URL_API_SERVER=${WAIT_FOR_URL_API_SERVER:-60}
ENABLE_DAEMON=${ENABLE_DAEMON:-false}
HOSTNAME_OVERRIDE=${HOSTNAME_OVERRIDE:-"127.0.0.1"}
EXTERNAL_CLOUD_PROVIDER=${EXTERNAL_CLOUD_PROVIDER:-false}
EXTERNAL_CLOUD_PROVIDER_BINARY=${EXTERNAL_CLOUD_PROVIDER_BINARY:-""}
CLOUD_PROVIDER=${CLOUD_PROVIDER:-""}
CLOUD_CONFIG=${CLOUD_CONFIG:-""}
FEATURE_GATES=${FEATURE_GATES:-"AllAlpha=false"}
STORAGE_BACKEND=${STORAGE_BACKEND:-"etcd3"}
# enable swagger ui
ENABLE_SWAGGER_UI=${ENABLE_SWAGGER_UI:-false}
# enable Pod priority and preemption
ENABLE_POD_PRIORITY_PREEMPTION=${ENABLE_POD_PRIORITY_PREEMPTION:-""}
# enable kubernetes dashboard
ENABLE_CLUSTER_DASHBOARD=${KUBE_ENABLE_CLUSTER_DASHBOARD:-false}
@ -94,7 +98,8 @@ export KUBE_CACHE_MUTATION_DETECTOR
KUBE_PANIC_WATCH_DECODE_ERROR="${KUBE_PANIC_WATCH_DECODE_ERROR:-true}"
export KUBE_PANIC_WATCH_DECODE_ERROR
ADMISSION_CONTROL=${ADMISSION_CONTROL:-""}
ENABLE_ADMISSION_PLUGINS=${ENABLE_ADMISSION_PLUGINS:-""}
DISABLE_ADMISSION_PLUGINS=${DISABLE_ADMISSION_PLUGINS:-""}
ADMISSION_CONTROL_CONFIG_FILE=${ADMISSION_CONTROL_CONFIG_FILE:-""}
# START_MODE can be 'all', 'kubeletonly', or 'nokubelet'
@ -115,9 +120,21 @@ if [ "${CLOUD_PROVIDER}" == "openstack" ]; then
fi
fi
#set feature gates if using ipvs mode
if [ "${KUBEPROXY_MODE}" == "ipvs" ]; then
FEATURE_GATES="$FEATURE_GATES,SupportIPVSProxyMode=true"
# set feature gates if using ipvs mode
if [ "${KUBE_PROXY_MODE}" == "ipvs" ]; then
# If required kernel modules are not available, fall back to iptables.
sudo modprobe -a ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack_ipv4
if [[ $? -eq 0 ]]; then
FEATURE_GATES="${FEATURE_GATES},SupportIPVSProxyMode=true"
else
echo "Required kernel modules for ipvs not found. Falling back to iptables mode."
KUBE_PROXY_MODE=iptables
fi
fi
# set feature gates if enable Pod priority and preemption
if [ "${ENABLE_POD_PRIORITY_PREEMPTION}" == true ]; then
FEATURE_GATES="$FEATURE_GATES,PodPriority=true"
fi
# warn if users are running with swap allowed
@ -408,7 +425,7 @@ function set_service_accounts {
function start_apiserver {
security_admission=""
if [[ -z "${ALLOW_SECURITY_CONTEXT}" ]]; then
if [[ -n "${DENY_SECURITY_CONTEXT_ADMISSION}" ]]; then
security_admission=",SecurityContextDeny"
fi
if [[ -n "${PSP_ADMISSION}" ]]; then
@ -417,13 +434,19 @@ function start_apiserver {
if [[ -n "${NODE_ADMISSION}" ]]; then
security_admission=",NodeRestriction"
fi
if [ "${ENABLE_POD_PRIORITY_PREEMPTION}" == true ]; then
security_admission=",Priority"
if [[ -n "${RUNTIME_CONFIG}" ]]; then
RUNTIME_CONFIG+=","
fi
RUNTIME_CONFIG+="scheduling.k8s.io/v1alpha1=true"
fi
# Admission Controllers to invoke prior to persisting objects in cluster
#
# ResourceQuota must come last, or a creation is recorded, but the pod may be forbidden.
ADMISSION_CONTROL=Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount${security_admission},DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota
# This is the default dir and filename where the apiserver will generate a self-signed cert
# which should be able to be used as the CA to verify itself
# The order defined here dose not matter.
ENABLE_ADMISSION_PLUGINS=Initializers,LimitRanger,ServiceAccount${security_admission},DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,PodPreset,StorageObjectInUseProtection
audit_arg=""
APISERVER_BASIC_AUDIT_LOG=""
@ -457,13 +480,20 @@ function start_apiserver {
priv_arg="--allow-privileged "
fi
if [[ ${ADMISSION_CONTROL} == *"Initializers"* ]]; then
if [[ ${ENABLE_ADMISSION_PLUGINS} == *"Initializers"* ]]; then
if [[ -n "${RUNTIME_CONFIG}" ]]; then
RUNTIME_CONFIG+=","
fi
RUNTIME_CONFIG+="admissionregistration.k8s.io/v1alpha1"
fi
if [[ ${ENABLE_ADMISSION_PLUGINS} == *"PodPreset"* ]]; then
if [[ -n "${RUNTIME_CONFIG}" ]]; then
RUNTIME_CONFIG+=","
fi
RUNTIME_CONFIG+="settings.k8s.io/v1alpha1"
fi
runtime_config=""
if [[ -n "${RUNTIME_CONFIG}" ]]; then
runtime_config="--runtime-config=${RUNTIME_CONFIG}"
@ -473,10 +503,10 @@ function start_apiserver {
# is set to 127.0.0.1
advertise_address=""
if [[ "${API_HOST_IP}" != "127.0.0.1" ]]; then
advertise_address="--advertise_address=${API_HOST_IP}"
advertise_address="--advertise-address=${API_HOST_IP}"
fi
if [[ "${ADVERTISE_ADDRESS}" != "" ]] ; then
advertise_address="--advertise_address=${ADVERTISE_ADDRESS}"
advertise_address="--advertise-address=${ADVERTISE_ADDRESS}"
fi
# Create CA signers
@ -510,9 +540,14 @@ function start_apiserver {
kube::util::create_client_certkey "${CONTROLPLANE_SUDO}" "${CERT_DIR}" 'client-ca' kube-aggregator system:kube-aggregator system:masters
kube::util::write_client_kubeconfig "${CONTROLPLANE_SUDO}" "${CERT_DIR}" "${ROOT_CA_FILE}" "${API_HOST}" "${API_SECURE_PORT}" kube-aggregator
cloud_config_arg="--cloud-provider=${CLOUD_PROVIDER} --cloud-config=${CLOUD_CONFIG}"
if [[ "${EXTERNAL_CLOUD_PROVIDER:-}" == "true" ]]; then
cloud_config_arg="--cloud-provider=external"
fi
APISERVER_LOG=${LOG_DIR}/kube-apiserver.log
${CONTROLPLANE_SUDO} "${GO_OUT}/hyperkube" apiserver ${swagger_arg} ${audit_arg} ${authorizer_arg} ${priv_arg} ${runtime_config}\
${CONTROLPLANE_SUDO} "${GO_OUT}/hyperkube" apiserver ${swagger_arg} ${audit_arg} ${authorizer_arg} ${priv_arg} ${runtime_config} \
${cloud_config_arg} \
${advertise_address} \
--v=${LOG_LEVEL} \
--vmodule="${LOG_SPEC}" \
@ -520,13 +555,13 @@ function start_apiserver {
--client-ca-file="${CERT_DIR}/client-ca.crt" \
--service-account-key-file="${SERVICE_ACCOUNT_KEY}" \
--service-account-lookup="${SERVICE_ACCOUNT_LOOKUP}" \
--admission-control="${ADMISSION_CONTROL}" \
--enable-admission-plugins="${ENABLE_ADMISSION_PLUGINS}" \
--disable-admission-plugins="${DISABLE_ADMISSION_PLUGINS}" \
--admission-control-config-file="${ADMISSION_CONTROL_CONFIG_FILE}" \
--bind-address="${API_BIND_ADDR}" \
--secure-port="${API_SECURE_PORT}" \
--tls-cert-file="${CERT_DIR}/serving-kube-apiserver.crt" \
--tls-private-key-file="${CERT_DIR}/serving-kube-apiserver.key" \
--tls-ca-file="${CERT_DIR}/server-ca.crt" \
--insecure-bind-address="${API_HOST_IP}" \
--insecure-port="${API_PORT}" \
--storage-backend=${STORAGE_BACKEND} \
@ -534,8 +569,6 @@ function start_apiserver {
--service-cluster-ip-range="${SERVICE_CLUSTER_IP_RANGE}" \
--feature-gates="${FEATURE_GATES}" \
--external-hostname="${EXTERNAL_HOSTNAME}" \
--cloud-provider="${CLOUD_PROVIDER}" \
--cloud-config="${CLOUD_CONFIG}" \
--requestheader-username-headers=X-Remote-User \
--requestheader-group-headers=X-Remote-Group \
--requestheader-extra-headers-prefix=X-Remote-Extra- \
@ -579,6 +612,13 @@ function start_controller_manager {
node_cidr_args="--allocate-node-cidrs=true --cluster-cidr=10.1.0.0/16 "
fi
cloud_config_arg="--cloud-provider=${CLOUD_PROVIDER} --cloud-config=${CLOUD_CONFIG}"
if [[ "${EXTERNAL_CLOUD_PROVIDER:-}" == "true" ]]; then
cloud_config_arg="--cloud-provider=external"
cloud_config_arg+=" --external-cloud-volume-plugin=${CLOUD_PROVIDER}"
cloud_config_arg+=" --cloud-config=${CLOUD_CONFIG}"
fi
CTLRMGR_LOG=${LOG_DIR}/kube-controller-manager.log
${CONTROLPLANE_SUDO} "${GO_OUT}/hyperkube" controller-manager \
--v=${LOG_LEVEL} \
@ -591,8 +631,7 @@ function start_controller_manager {
${node_cidr_args} \
--pvclaimbinder-sync-period="${CLAIM_BINDER_SYNC_PERIOD}" \
--feature-gates="${FEATURE_GATES}" \
--cloud-provider="${CLOUD_PROVIDER}" \
--cloud-config="${CLOUD_CONFIG}" \
${cloud_config_arg} \
--kubeconfig "$CERT_DIR"/controller.kubeconfig \
--use-service-account-credentials \
--controllers="${KUBE_CONTROLLERS}" \
@ -600,6 +639,35 @@ function start_controller_manager {
CTLRMGR_PID=$!
}
function start_cloud_controller_manager {
if [ -z "${CLOUD_CONFIG}" ]; then
echo "CLOUD_CONFIG cannot be empty!"
exit 1
fi
if [ ! -f "${CLOUD_CONFIG}" ]; then
echo "Cloud config ${CLOUD_CONFIG} doesn't exist"
exit 1
fi
node_cidr_args=""
if [[ "${NET_PLUGIN}" == "kubenet" ]]; then
node_cidr_args="--allocate-node-cidrs=true --cluster-cidr=10.1.0.0/16 "
fi
CLOUD_CTLRMGR_LOG=${LOG_DIR}/cloud-controller-manager.log
${CONTROLPLANE_SUDO} ${EXTERNAL_CLOUD_PROVIDER_BINARY:-"${GO_OUT}/hyperkube" cloud-controller-manager} \
--v=${LOG_LEVEL} \
--vmodule="${LOG_SPEC}" \
${node_cidr_args} \
--feature-gates="${FEATURE_GATES}" \
--cloud-provider=${CLOUD_PROVIDER} \
--cloud-config=${CLOUD_CONFIG} \
--kubeconfig "$CERT_DIR"/controller.kubeconfig \
--use-service-account-credentials \
--master="https://${API_HOST}:${API_SECURE_PORT}" >"${CLOUD_CTLRMGR_LOG}" 2>&1 &
CLOUD_CTLRMGR_PID=$!
}
function start_kubelet {
KUBELET_LOG=${LOG_DIR}/kubelet.log
mkdir -p "${POD_MANIFEST_PATH}" &>/dev/null || sudo mkdir -p "${POD_MANIFEST_PATH}"
@ -609,6 +677,12 @@ function start_kubelet {
priv_arg="--allow-privileged "
fi
cloud_config_arg="--cloud-provider=${CLOUD_PROVIDER} --cloud-config=${CLOUD_CONFIG}"
if [[ "${EXTERNAL_CLOUD_PROVIDER:-}" == "true" ]]; then
cloud_config_arg="--cloud-provider=external"
cloud_config_arg+=" --provider-id=$(hostname)"
fi
mkdir -p "/var/lib/kubelet" &>/dev/null || sudo mkdir -p "/var/lib/kubelet"
if [[ -z "${DOCKERIZE_KUBELET}" ]]; then
# Enable dns
@ -665,8 +739,7 @@ function start_kubelet {
--rkt-path="${RKT_PATH}" \
--rkt-stage1-image="${RKT_STAGE1_IMAGE}" \
--hostname-override="${HOSTNAME_OVERRIDE}" \
--cloud-provider="${CLOUD_PROVIDER}" \
--cloud-config="${CLOUD_CONFIG}" \
${cloud_config_arg} \
--address="${KUBELET_HOST}" \
--kubeconfig "$CERT_DIR"/kubelet.kubeconfig \
--feature-gates="${FEATURE_GATES}" \
@ -730,8 +803,8 @@ function start_kubelet {
--privileged=true \
-i \
--cidfile=$KUBELET_CIDFILE \
gcr.io/google_containers/kubelet \
/kubelet --v=${LOG_LEVEL} --containerized ${priv_arg}--chaos-chance="${CHAOS_CHANCE}" --pod-manifest-path="${POD_MANIFEST_PATH}" --hostname-override="${HOSTNAME_OVERRIDE}" --cloud-provider="${CLOUD_PROVIDER}" --cloud-config="${CLOUD_CONFIG}" \ --address="127.0.0.1" --kubeconfig "$CERT_DIR"/kubelet.kubeconfig --port="$KUBELET_PORT" --enable-controller-attach-detach="${ENABLE_CONTROLLER_ATTACH_DETACH}" &> $KUBELET_LOG &
k8s.gcr.io/kubelet \
/kubelet --v=${LOG_LEVEL} --containerized ${priv_arg}--chaos-chance="${CHAOS_CHANCE}" --pod-manifest-path="${POD_MANIFEST_PATH}" --hostname-override="${HOSTNAME_OVERRIDE}" ${cloud_config_arg} \ --address="127.0.0.1" --kubeconfig "$CERT_DIR"/kubelet.kubeconfig --port="$KUBELET_PORT" --enable-controller-attach-detach="${ENABLE_CONTROLLER_ATTACH_DETACH}" &> $KUBELET_LOG &
fi
}
@ -744,18 +817,14 @@ kind: KubeProxyConfiguration
clientConnection:
kubeconfig: ${CERT_DIR}/kube-proxy.kubeconfig
hostnameOverride: ${HOSTNAME_OVERRIDE}
featureGates: ${FEATURE_GATES}
mode: ${KUBEPROXY_MODE}
mode: ${KUBE_PROXY_MODE}
EOF
if [ "${KUBEPROXY_MODE}" == "ipvs" ]; then
# Load kernel modules required by IPVS proxier
sudo modprobe -a ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack_ipv4
fi
sudo "${GO_OUT}/hyperkube" proxy \
--v=${LOG_LEVEL} \
--feature-gates="${FEATURE_GATES}" \
--config=/tmp/kube-proxy.yaml \
--master="https://${API_HOST}:${API_SECURE_PORT}" >"${PROXY_LOG}" \
--v=${LOG_LEVEL} 2>&1 &
--master="https://${API_HOST}:${API_SECURE_PORT}" >"${PROXY_LOG}" 2>&1 &
PROXY_PID=$!
SCHEDULER_LOG=${LOG_DIR}/kube-scheduler.log
@ -818,12 +887,17 @@ function create_storage_class {
function print_success {
if [[ "${START_MODE}" != "kubeletonly" ]]; then
if [[ "${ENABLE_DAEMON}" = false ]]; then
echo "Local Kubernetes cluster is running. Press Ctrl-C to shut it down."
else
echo "Local Kubernetes cluster is running."
fi
cat <<EOF
Local Kubernetes cluster is running. Press Ctrl-C to shut it down.
Logs:
${APISERVER_LOG:-}
${CTLRMGR_LOG:-}
${CLOUD_CTLRMGR_LOG:-}
${PROXY_LOG:-}
${SCHEDULER_LOG:-}
EOF
@ -843,8 +917,12 @@ fi
if [[ "${START_MODE}" != "kubeletonly" ]]; then
echo
if [[ "${ENABLE_DAEMON}" = false ]]; then
echo "To start using your cluster, you can open up another terminal/tab and run:"
else
echo "To start using your cluster, run:"
fi
cat <<EOF
To start using your cluster, you can open up another terminal/tab and run:
export KUBECONFIG=${CERT_DIR}/admin.kubeconfig
cluster/kubectl.sh
@ -869,6 +947,15 @@ EOF
fi
}
# If we are running in the CI, we need a few more things before we can start
if [[ "${KUBETEST_IN_DOCKER:-}" == "true" ]]; then
echo "Preparing to test ..."
${KUBE_ROOT}/hack/install-etcd.sh
export PATH="${KUBE_ROOT}/third_party/etcd:${PATH}"
KUBE_FASTBUILD=true make ginkgo cross
apt install -y sudo
fi
# validate that etcd is: not running, in path, and has minimum required version.
if [[ "${START_MODE}" != "kubeletonly" ]]; then
kube::etcd::validate
@ -906,6 +993,9 @@ if [[ "${START_MODE}" != "kubeletonly" ]]; then
set_service_accounts
start_apiserver
start_controller_manager
if [[ "${EXTERNAL_CLOUD_PROVIDER:-}" == "true" ]]; then
start_cloud_controller_manager
fi
start_kubeproxy
start_kubedns
start_kubedashboard
@ -941,3 +1031,10 @@ print_success
if [[ "${ENABLE_DAEMON}" = false ]]; then
while true; do sleep 1; done
fi
if [[ "${KUBETEST_IN_DOCKER:-}" == "true" ]]; then
cluster/kubectl.sh config set-cluster local --server=https://localhost:6443 --certificate-authority=/var/run/kubernetes/server-ca.crt
cluster/kubectl.sh config set-credentials myself --client-key=/var/run/kubernetes/client-admin.key --client-certificate=/var/run/kubernetes/client-admin.crt
cluster/kubectl.sh config set-context local --cluster=local --user=myself
cluster/kubectl.sh config use-context local
fi

View File

@ -0,0 +1,30 @@
# Copyright 2018 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.
.PHONY: manifest-tool
MANIFEST_TOOL_DIR := $(shell mktemp -d)
export PATH := $(MANIFEST_TOOL_DIR):$(PATH)
MANIFEST_TOOL_VERSION := v0.7.0
space :=
space +=
comma := ,
prefix_linux = $(addprefix linux/,$(strip $1))
join_platforms = $(subst $(space),$(comma),$(call prefix_linux,$(strip $1)))
manifest-tool:
curl -sSL https://github.com/estesp/manifest-tool/releases/download/$(MANIFEST_TOOL_VERSION)/manifest-tool-linux-amd64 > $(MANIFEST_TOOL_DIR)/manifest-tool
chmod +x $(MANIFEST_TOOL_DIR)/manifest-tool

View File

@ -24,7 +24,6 @@ readonly reset=$(tput sgr0)
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
ALL_TARGETS=$(make -C "${KUBE_ROOT}" PRINT_HELP=y -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/ { s/:.*$// ; p ; } ; }' | sort)
CMD_TARGETS=$(ls -l "${KUBE_ROOT}/cmd" |awk '/^d/ {print $NF}')
PLUGIN_CMD_TARGETS=$(ls -l "${KUBE_ROOT}/plugin/cmd" |awk '/^d/ {print $NF}')
CMD_FLAG=false
PLUGIN_CMD_FLAG=false
@ -45,21 +44,6 @@ for tar in $ALL_TARGETS; do
fi
done
for plugincmdtar in $PLUGIN_CMD_TARGETS; do
if [ $tar = $plugincmdtar ]; then
if [ $PLUGIN_CMD_FLAG = true ]; then
continue 2;
fi
echo -e "${red}${PLUGIN_CMD_TARGETS}${reset}"
make -C "${KUBE_ROOT}" $tar PRINT_HELP=y
echo "---------------------------------------------------------------------------------"
PLUGIN_CMD_FLAG=true
continue 2
fi
done
echo -e "${red}${tar}${reset}"
make -C "${KUBE_ROOT}" $tar PRINT_HELP=y
echo "---------------------------------------------------------------------------------"

View File

@ -37,15 +37,15 @@ KUBELET_HEALTHZ_PORT=${KUBELET_HEALTHZ_PORT:-10248}
CTLRMGR_PORT=${CTLRMGR_PORT:-10252}
PROXY_HOST=127.0.0.1 # kubectl only serves on localhost.
IMAGE_NGINX="gcr.io/google-containers/nginx:1.7.9"
IMAGE_DEPLOYMENT_R1="gcr.io/google-containers/nginx:test-cmd" # deployment-revision1.yaml
IMAGE_NGINX="k8s.gcr.io/nginx:1.7.9"
IMAGE_DEPLOYMENT_R1="k8s.gcr.io/nginx:test-cmd" # deployment-revision1.yaml
IMAGE_DEPLOYMENT_R2="$IMAGE_NGINX" # deployment-revision2.yaml
IMAGE_PERL="gcr.io/google-containers/perl"
IMAGE_PAUSE_V2="gcr.io/google-containers/pause:2.0"
IMAGE_DAEMONSET_R2="gcr.io/google-containers/pause:latest"
IMAGE_DAEMONSET_R2_2="gcr.io/google-containers/nginx:test-cmd" # rollingupdate-daemonset-rv2.yaml
IMAGE_STATEFULSET_R1="gcr.io/google_containers/nginx-slim:0.7"
IMAGE_STATEFULSET_R2="gcr.io/google_containers/nginx-slim:0.8"
IMAGE_PERL="k8s.gcr.io/perl"
IMAGE_PAUSE_V2="k8s.gcr.io/pause:2.0"
IMAGE_DAEMONSET_R2="k8s.gcr.io/pause:latest"
IMAGE_DAEMONSET_R2_2="k8s.gcr.io/nginx:test-cmd" # rollingupdate-daemonset-rv2.yaml
IMAGE_STATEFULSET_R1="k8s.gcr.io/nginx-slim:0.7"
IMAGE_STATEFULSET_R2="k8s.gcr.io/nginx-slim:0.8"
# Expose kubectl directly for readability
PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH
@ -106,7 +106,7 @@ function record_command() {
juLog -output="${output}" -class="test-cmd" -name="${name}" "$@"
if [[ $? -ne 0 ]]; then
echo "Error when running ${name}"
foundError="True"
foundError="${foundError}""${name}"", "
fi
set -o nounset
@ -719,9 +719,9 @@ run_pod_tests() {
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'changed-with-yaml:'
## Patch pod from JSON can change image
# Command
kubectl patch "${kube_flags[@]}" -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "gcr.io/google_containers/pause-amd64:3.0"}]}}'
# Post-condition: valid-pod POD has image gcr.io/google_containers/pause-amd64:3.0
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'gcr.io/google_containers/pause-amd64:3.0:'
kubectl patch "${kube_flags[@]}" -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "k8s.gcr.io/pause-amd64:3.1"}]}}'
# Post-condition: valid-pod POD has expected image
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'k8s.gcr.io/pause-amd64:3.1:'
## If resourceVersion is specified in the patch, it will be treated as a precondition, i.e., if the resourceVersion is different from that is stored in the server, the Patch should be rejected
ERROR_FILE="${KUBE_TEMP}/conflict-error"
@ -802,13 +802,13 @@ __EOF__
kubectl delete node node-v1-test "${kube_flags[@]}"
## kubectl edit can update the image field of a POD. tmp-editor.sh is a fake editor
echo -e "#!/bin/bash\n${SED} -i \"s/nginx/gcr.io\/google_containers\/serve_hostname/g\" \$1" > /tmp/tmp-editor.sh
echo -e "#!/bin/bash\n${SED} -i \"s/nginx/k8s.gcr.io\/serve_hostname/g\" \$1" > /tmp/tmp-editor.sh
chmod +x /tmp/tmp-editor.sh
# Pre-condition: valid-pod POD has image nginx
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'nginx:'
[[ "$(EDITOR=/tmp/tmp-editor.sh kubectl edit "${kube_flags[@]}" pods/valid-pod --output-patch=true | grep Patch:)" ]]
# Post-condition: valid-pod POD has image gcr.io/google_containers/serve_hostname
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'gcr.io/google_containers/serve_hostname:'
# Post-condition: valid-pod POD has image k8s.gcr.io/serve_hostname
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'k8s.gcr.io/serve_hostname:'
# cleaning
rm /tmp/tmp-editor.sh
@ -1156,14 +1156,26 @@ run_kubectl_apply_deployments_tests() {
kubectl apply -f hack/testdata/deployment-label-change1.yaml "${kube_flags[@]}"
# check right deployment exists
kube::test::get_object_assert 'deployment nginx' "{{${id_field}}}" 'nginx'
# apply deployment with wrong labels mismatch selector throws errors
# apply deployment with new labels and a conflicting resourceVersion
output_message=$(! kubectl apply -f hack/testdata/deployment-label-change2.yaml 2>&1 "${kube_flags[@]}")
kube::test::if_has_string "${output_message}" 'Invalid value'
# apply deployment with --force and --overwrite will success
kube::test::if_has_string "${output_message}" 'Error from server (Conflict)'
# apply deployment with --force and --overwrite will succeed
kubectl apply -f hack/testdata/deployment-label-change2.yaml --overwrite=true --force=true --grace-period=10
# check the changed deployment
output_message=$(kubectl apply view-last-applied deploy/nginx -o json 2>&1 "${kube_flags[@]}" |grep nginx2)
kube::test::if_has_string "${output_message}" '"name": "nginx2"'
# applying a resource (with --force) that is both conflicting and invalid will
# cause the server to only return a "Conflict" error when we attempt to patch.
# This means that we will delete the existing resource after receiving 5 conflict
# errors in a row from the server, and will attempt to create the modified
# resource that we are passing to "apply". Since the modified resource is also
# invalid, we will receive an invalid error when we attempt to create it, after
# having deleted the old resource. Ensure that when this case is reached, the
# old resource is restored once again, and the validation error is printed.
output_message=$(! kubectl apply -f hack/testdata/deployment-label-change3.yaml --force 2>&1 "${kube_flags[@]}")
kube::test::if_has_string "${output_message}" 'Invalid value'
# Ensure that the old object has been restored
kube::test::get_object_assert 'deployment nginx' "{{${template_labels}}}" 'nginx2'
# cleanup
kubectl delete deployments --all --grace-period=10
@ -1311,6 +1323,117 @@ run_kubectl_run_tests() {
set +o errexit
}
run_kubectl_server_print_tests() {
set -o nounset
set -o errexit
create_and_use_new_namespace
kube::log::status "Testing kubectl get --experimental-server-print"
### Test retrieval of all types in discovery
# Pre-condition: no resources exist
output_message=$(kubectl get pods --experimental-server-print 2>&1 "${kube_flags[@]}")
# Post-condition: Expect text indicating no resources were found
kube::test::if_has_string "${output_message}" 'No resources found.'
### Test retrieval of pods against server-side printing
kubectl create -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml "${kube_flags[@]}"
# Post-condition: valid-pod POD is created
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
# Compare "old" output with experimental output and ensure both are the same
# remove the last column, as it contains the object's AGE, which could cause a mismatch.
expected_output=$(kubectl get pod "${kube_flags[@]}" | awk 'NF{NF--};1')
actual_output=$(kubectl get pod --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
### Test retrieval of daemonsets against server-side printing
kubectl apply -f hack/testdata/rollingupdate-daemonset.yaml "${kube_flags[@]}"
# Post-condition: daemonset is created
kube::test::get_object_assert ds "{{range.items}}{{$id_field}}:{{end}}" 'bind:'
# Compare "old" output with experimental output and ensure both are the same
# remove the last column, as it contains the object's AGE, which could cause a mismatch.
expected_output=$(kubectl get ds "${kube_flags[@]}" | awk 'NF{NF--};1')
actual_output=$(kubectl get ds --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
### Test retrieval of replicationcontrollers against server-side printing
kubectl create -f hack/testdata/frontend-controller.yaml "${kube_flags[@]}"
# Post-condition: frontend replication controller is created
kube::test::get_object_assert rc "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
# Compare "old" output with experimental output and ensure both are the same
# remove the last column, as it contains the object's AGE, which could cause a mismatch.
expected_output=$(kubectl get rc "${kube_flags[@]}" | awk 'NF{NF--};1')
actual_output=$(kubectl get rc --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
### Test retrieval of replicasets against server-side printing
kubectl create -f hack/testdata/frontend-replicaset.yaml "${kube_flags[@]}"
# Post-condition: frontend replica set is created
kube::test::get_object_assert rs "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
# Compare "old" output with experimental output and ensure both are the same
# remove the last column, as it contains the object's AGE, which could cause a mismatch.
expected_output=$(kubectl get rs "${kube_flags[@]}" | awk 'NF{NF--};1')
actual_output=$(kubectl get rs --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
### Test retrieval of jobs against server-side printing
kubectl run pi --generator=job/v1 "--image=$IMAGE_PERL" --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(20)' "${kube_flags[@]}"
# Post-Condition: assertion object exists
kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" 'pi:'
# Compare "old" output with experimental output and ensure both are the same
# remove the last column, as it contains the object's AGE, which could cause a mismatch.
expected_output=$(kubectl get jobs/pi "${kube_flags[@]}" | awk 'NF{NF--};1')
actual_output=$(kubectl get jobs/pi --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
### Test retrieval of clusterroles against server-side printing
kubectl create "${kube_flags[@]}" clusterrole sample-role --verb=* --resource=pods
# Post-Condition: assertion object exists
kube::test::get_object_assert clusterrole/sample-role "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'pods:'
# Compare "old" output with experimental output and ensure both are the same
# remove the last column, as it contains the object's AGE, which could cause a mismatch.
expected_output=$(kubectl get clusterroles/sample-role "${kube_flags[@]}" | awk 'NF{NF--};1')
actual_output=$(kubectl get clusterroles/sample-role --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
### Test retrieval of crds against server-side printing
kubectl "${kube_flags_with_token[@]}" create -f - << __EOF__
{
"kind": "CustomResourceDefinition",
"apiVersion": "apiextensions.k8s.io/v1beta1",
"metadata": {
"name": "foos.company.com"
},
"spec": {
"group": "company.com",
"version": "v1",
"names": {
"plural": "foos",
"kind": "Foo"
}
}
}
__EOF__
# Post-Condition: assertion object exists
kube::test::get_object_assert customresourcedefinitions "{{range.items}}{{$id_field}}:{{end}}" 'foos.company.com:'
# Test that we can list this new CustomResource
kube::test::get_object_assert foos "{{range.items}}{{$id_field}}:{{end}}" ''
# Compare "old" output with experimental output and ensure both are the same
expected_output=$(kubectl get foos "${kube_flags[@]}")
actual_output=$(kubectl get foos --experimental-server-print "${kube_flags[@]}" | awk 'NF{NF--};1')
kube::test::if_has_string "${actual_output}" "${expected_output}"
# teardown
kubectl delete customresourcedefinitions/foos.company.com "${kube_flags_with_token[@]}"
kubectl delete clusterroles/sample-role "${kube_flags_with_token[@]}"
kubectl delete jobs pi "${kube_flags[@]}"
kubectl delete rs frontend "${kube_flags[@]}"
kubectl delete rc frontend "${kube_flags[@]}"
kubectl delete ds bind "${kube_flags[@]}"
kubectl delete pod valid-pod "${kube_flags[@]}"
}
run_kubectl_get_tests() {
set -o nounset
set -o errexit
@ -1397,11 +1520,15 @@ run_kubectl_get_tests() {
kube::test::if_has_string "${output_message}" "/api/v1/namespaces/default/pods 200 OK"
kube::test::if_has_string "${output_message}" "/api/v1/namespaces/default/replicationcontrollers 200 OK"
kube::test::if_has_string "${output_message}" "/api/v1/namespaces/default/services 200 OK"
kube::test::if_has_string "${output_message}" "/apis/apps/v1/namespaces/default/daemonsets 200 OK"
kube::test::if_has_string "${output_message}" "/apis/apps/v1/namespaces/default/deployments 200 OK"
kube::test::if_has_string "${output_message}" "/apis/apps/v1/namespaces/default/replicasets 200 OK"
kube::test::if_has_string "${output_message}" "/apis/apps/v1/namespaces/default/statefulsets 200 OK"
kube::test::if_has_string "${output_message}" "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers 200"
kube::test::if_has_string "${output_message}" "/apis/batch/v1/namespaces/default/jobs 200 OK"
kube::test::if_has_string "${output_message}" "/apis/extensions/v1beta1/namespaces/default/deployments 200 OK"
kube::test::if_has_string "${output_message}" "/apis/extensions/v1beta1/namespaces/default/replicasets 200 OK"
kube::test::if_has_not_string "${output_message}" "/apis/extensions/v1beta1/namespaces/default/daemonsets 200 OK"
kube::test::if_has_not_string "${output_message}" "/apis/extensions/v1beta1/namespaces/default/deployments 200 OK"
kube::test::if_has_not_string "${output_message}" "/apis/extensions/v1beta1/namespaces/default/replicasets 200 OK"
### Test kubectl get chunk size
output_message=$(kubectl --v=6 get clusterrole --chunk-size=10 2>&1 "${kube_flags[@]}")
@ -1414,6 +1541,18 @@ run_kubectl_get_tests() {
# Post-condition: Check if we get a limit and continue
kube::test::if_has_string "${output_message}" "/clusterroles?limit=500 200 OK"
### Test kubectl get chunk size does not result in a --watch error when resource list is served in multiple chunks
# Pre-condition: no ConfigMaps exist
kube::test::get_object_assert configmap "{{range.items}}{{$id_field}}:{{end}}" ''
# Post-condition: Create three configmaps and ensure that we can --watch them with a --chunk-size of 1
kubectl create cm one "${kube_flags[@]}"
kubectl create cm two "${kube_flags[@]}"
kubectl create cm three "${kube_flags[@]}"
output_message=$(kubectl get configmap --chunk-size=1 --watch --request-timeout=1s 2>&1 "${kube_flags[@]}")
kube::test::if_has_not_string "${output_message}" "watch is only supported on individual resources"
output_message=$(kubectl get configmap --chunk-size=1 --watch-only --request-timeout=1s 2>&1 "${kube_flags[@]}")
kube::test::if_has_not_string "${output_message}" "watch is only supported on individual resources"
### Test --allow-missing-template-keys
# Pre-condition: no POD exists
create_and_use_new_namespace
@ -1444,7 +1583,7 @@ run_kubectl_get_tests() {
kube::test::if_has_string "${output_message}" 'valid-pod' # pod details
output_message=$(kubectl get pods/valid-pod -o name -w --request-timeout=1 "${kube_flags[@]}")
kube::test::if_has_not_string "${output_message}" 'STATUS' # no headers
kube::test::if_has_string "${output_message}" 'pods/valid-pod' # resource name
kube::test::if_has_string "${output_message}" 'pod/valid-pod' # resource name
output_message=$(kubectl get pods/valid-pod -o yaml -w --request-timeout=1 "${kube_flags[@]}")
kube::test::if_has_not_string "${output_message}" 'STATUS' # no headers
kube::test::if_has_string "${output_message}" 'name: valid-pod' # yaml
@ -1558,6 +1697,33 @@ __EOF__
# Post-Condition: assertion object exist
kube::test::get_object_assert customresourcedefinitions "{{range.items}}{{$id_field}}:{{end}}" 'bars.company.com:foos.company.com:'
# This test ensures that the name printer is able to output a resource
# in the proper "kind.group/resource_name" format, and that the
# resource builder is able to resolve a GVK when a kind.group pair is given.
kubectl "${kube_flags_with_token[@]}" create -f - << __EOF__
{
"kind": "CustomResourceDefinition",
"apiVersion": "apiextensions.k8s.io/v1beta1",
"metadata": {
"name": "resources.mygroup.example.com"
},
"spec": {
"group": "mygroup.example.com",
"version": "v1alpha1",
"scope": "Namespaced",
"names": {
"plural": "resources",
"singular": "resource",
"kind": "Kind",
"listKind": "KindList"
}
}
}
__EOF__
# Post-Condition: assertion crd with non-matching kind and resource exists
kube::test::get_object_assert customresourcedefinitions "{{range.items}}{{$id_field}}:{{end}}" 'bars.company.com:foos.company.com:resources.mygroup.example.com:'
run_non_native_resource_tests
# teardown
@ -1605,6 +1771,28 @@ run_non_native_resource_tests() {
# Test that we can list this new CustomResource (bars)
kube::test::get_object_assert bars "{{range.items}}{{$id_field}}:{{end}}" ''
# Test that we can list this new CustomResource (resources)
kube::test::get_object_assert resources "{{range.items}}{{$id_field}}:{{end}}" ''
# Test that we can create a new resource of type Kind
kubectl "${kube_flags[@]}" create -f hack/testdata/CRD/resource.yaml "${kube_flags[@]}"
# Test that -o name returns kind.group/resourcename
output_message=$(kubectl "${kube_flags[@]}" get resource/myobj -o name)
kube::test::if_has_string "${output_message}" 'kind.mygroup.example.com/myobj'
output_message=$(kubectl "${kube_flags[@]}" get resources/myobj -o name)
kube::test::if_has_string "${output_message}" 'kind.mygroup.example.com/myobj'
output_message=$(kubectl "${kube_flags[@]}" get kind.mygroup.example.com/myobj -o name)
kube::test::if_has_string "${output_message}" 'kind.mygroup.example.com/myobj'
# Delete the resource with cascade.
kubectl "${kube_flags[@]}" delete resources myobj --cascade=true
# Make sure it's gone
kube::test::get_object_assert resources "{{range.items}}{{$id_field}}:{{end}}" ''
# Test that we can create a new resource of type Foo
kubectl "${kube_flags[@]}" create -f hack/testdata/CRD/foo.yaml "${kube_flags[@]}"
@ -1633,7 +1821,7 @@ run_non_native_resource_tests() {
kubectl "${kube_flags[@]}" get foos -o "go-template={{range .items}}{{.someField}}{{end}}" --allow-missing-template-keys=false
kubectl "${kube_flags[@]}" get foos/test -o "go-template={{.someField}}" --allow-missing-template-keys=false
output_message=$(kubectl "${kube_flags[@]}" get foos/test -o name)
kube::test::if_has_string "${output_message}" 'foos/test'
kube::test::if_has_string "${output_message}" 'foo.company.com/test'
# Test patching
kube::log::status "Testing CustomResource patching"
@ -1716,7 +1904,7 @@ run_non_native_resource_tests() {
# Stop the watcher and the patch loop.
kill -9 ${watch_pid}
kill -9 ${patch_pid}
kube::test::if_has_string "${watch_output}" 'bars/test'
kube::test::if_has_string "${watch_output}" 'bar.company.com/test'
# Delete the resource without cascade.
kubectl "${kube_flags[@]}" delete bars test --cascade=false
@ -2309,11 +2497,15 @@ run_configmap_tests() {
kube::test::get_object_assert 'configmaps --namespace=test-configmaps' "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
kubectl create configmap test-configmap --from-literal=key1=value1 --namespace=test-configmaps
kubectl create configmap test-binary-configmap --from-file <( head -c 256 /dev/urandom ) --namespace=test-configmaps
# Post-condition: configmap exists and has expected values
kube::test::get_object_assert 'configmap/test-configmap --namespace=test-configmaps' "{{$id_field}}" 'test-configmap'
kube::test::get_object_assert 'configmap/test-binary-configmap --namespace=test-configmaps' "{{$id_field}}" 'test-binary-configmap'
[[ "$(kubectl get configmap/test-configmap --namespace=test-configmaps -o yaml "${kube_flags[@]}" | grep 'key1: value1')" ]]
[[ "$(kubectl get configmap/test-binary-configmap --namespace=test-configmaps -o yaml "${kube_flags[@]}" | grep 'binaryData')" ]]
# Clean-up
kubectl delete configmap test-configmap --namespace=test-configmaps
kubectl delete configmap test-binary-configmap --namespace=test-configmaps
kubectl delete namespace test-configmaps
set +o nounset
@ -2746,7 +2938,7 @@ run_deployment_tests() {
create_and_use_new_namespace
kube::log::status "Testing deployments"
# Test kubectl create deployment (using default - old generator)
kubectl create deployment test-nginx-extensions --image=gcr.io/google-containers/nginx:test-cmd
kubectl create deployment test-nginx-extensions --image=k8s.gcr.io/nginx:test-cmd
# Post-Condition: Deployment "nginx" is created.
kube::test::get_object_assert 'deploy test-nginx-extensions' "{{$container_name_field}}" 'nginx'
# and old generator was used, iow. old defaults are applied
@ -2761,7 +2953,7 @@ run_deployment_tests() {
kubectl delete deployment test-nginx-extensions "${kube_flags[@]}"
# Test kubectl create deployment
kubectl create deployment test-nginx-apps --image=gcr.io/google-containers/nginx:test-cmd --generator=deployment-basic/apps.v1beta1
kubectl create deployment test-nginx-apps --image=k8s.gcr.io/nginx:test-cmd --generator=deployment-basic/apps.v1beta1
# Post-Condition: Deployment "nginx" is created.
kube::test::get_object_assert 'deploy test-nginx-apps' "{{$container_name_field}}" 'nginx'
# and new generator was used, iow. new defaults are applied
@ -2806,7 +2998,7 @@ run_deployment_tests() {
kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" ''
kube::test::get_object_assert rs "{{range.items}}{{$id_field}}:{{end}}" ''
# Create deployment
kubectl create deployment nginx-deployment --image=gcr.io/google-containers/nginx:test-cmd
kubectl create deployment nginx-deployment --image=k8s.gcr.io/nginx:test-cmd
# Wait for rs to come up.
kube::test::wait_object_assert rs "{{range.items}}{{$rs_replicas_field}}{{end}}" '1'
# Delete the deployment with cascade set to false.
@ -3064,7 +3256,7 @@ run_rs_tests() {
# Test set commands
# Pre-condition: frontend replica set exists at generation 1
kube::test::get_object_assert 'rs frontend' "{{${generation_field}}}" '1'
kubectl set image rs/frontend "${kube_flags[@]}" *=gcr.io/google-containers/pause:test-cmd
kubectl set image rs/frontend "${kube_flags[@]}" *=k8s.gcr.io/pause:test-cmd
kube::test::get_object_assert 'rs frontend' "{{${generation_field}}}" '2'
kubectl set env rs/frontend "${kube_flags[@]}" foo=bar
kube::test::get_object_assert 'rs frontend' "{{${generation_field}}}" '3'
@ -3151,7 +3343,7 @@ run_daemonset_tests() {
# Template Generation should stay 1
kube::test::get_object_assert 'daemonsets bind' "{{${template_generation_field}}}" '1'
# Test set commands
kubectl set image daemonsets/bind "${kube_flags[@]}" *=gcr.io/google-containers/pause:test-cmd
kubectl set image daemonsets/bind "${kube_flags[@]}" *=k8s.gcr.io/pause:test-cmd
kube::test::get_object_assert 'daemonsets bind' "{{${template_generation_field}}}" '2'
kubectl set env daemonsets/bind "${kube_flags[@]}" foo=bar
kube::test::get_object_assert 'daemonsets bind' "{{${template_generation_field}}}" '3'
@ -3453,13 +3645,13 @@ run_kubectl_config_set_tests() {
cert_data=$(echo "#Comment" && cat "${TMPDIR:-/tmp}/apiserver.crt")
kubectl config set clusters.test-cluster.certificate-authority-data "$cert_data" --set-raw-bytes
r_writen=$(kubectl config view --raw -o jsonpath='{.clusters[?(@.name == "test-cluster")].cluster.certificate-authority-data}')
r_written=$(kubectl config view --raw -o jsonpath='{.clusters[?(@.name == "test-cluster")].cluster.certificate-authority-data}')
encoded=$(echo -n "$cert_data" | base64)
kubectl config set clusters.test-cluster.certificate-authority-data "$encoded"
e_writen=$(kubectl config view --raw -o jsonpath='{.clusters[?(@.name == "test-cluster")].cluster.certificate-authority-data}')
e_written=$(kubectl config view --raw -o jsonpath='{.clusters[?(@.name == "test-cluster")].cluster.certificate-authority-data}')
test "$e_writen" == "$r_writen"
test "$e_written" == "$r_written"
set +o nounset
set +o errexit
@ -3471,10 +3663,8 @@ run_kubectl_local_proxy_tests() {
kube::log::status "Testing kubectl local proxy"
# Make sure the UI can be proxied
start-proxy
check-curl-proxy-code /ui 307
check-curl-proxy-code /api/ui 404
check-curl-proxy-code /api/kubernetes 404
check-curl-proxy-code /api/v1/namespaces 200
if kube::test::if_supports_resource "${metrics}" ; then
check-curl-proxy-code /metrics 200
@ -3492,7 +3682,8 @@ run_kubectl_local_proxy_tests() {
# Custom paths let you see everything.
start-proxy /custom
check-curl-proxy-code /custom/ui 307
check-curl-proxy-code /custom/api/kubernetes 404
check-curl-proxy-code /custom/api/v1/namespaces 200
if kube::test::if_supports_resource "${metrics}" ; then
check-curl-proxy-code /custom/metrics 200
fi
@ -3724,7 +3915,7 @@ run_cmd_with_img_tests() {
# Test that a valid image reference value is provided as the value of --image in `kubectl run <name> --image`
output_message=$(kubectl run test1 --image=validname)
kube::test::if_has_string "${output_message}" 'deployment "test1" created'
kube::test::if_has_string "${output_message}" 'deployment.apps "test1" created'
kubectl delete deployments test1
# test invalid image name
output_message=$(! kubectl run test2 --image=InvalidImageName 2>&1)
@ -4090,8 +4281,8 @@ run_resource_aliasing_tests() {
create_and_use_new_namespace
kube::log::status "Testing resource aliasing"
kubectl create -f examples/storage/cassandra/cassandra-controller.yaml "${kube_flags[@]}"
kubectl create -f examples/storage/cassandra/cassandra-service.yaml "${kube_flags[@]}"
kubectl create -f test/e2e/testing-manifests/statefulset/cassandra/controller.yaml "${kube_flags[@]}"
kubectl create -f test/e2e/testing-manifests/statefulset/cassandra/service.yaml "${kube_flags[@]}"
object="all -l'app=cassandra'"
request="{{range.items}}{{range .metadata.labels}}{{.}}:{{end}}{{end}}"
@ -4116,6 +4307,8 @@ run_kubectl_explain_tests() {
# shortcuts work
kubectl explain po
kubectl explain po.status.message
# cronjob work
kubectl explain cronjob
set +o nounset
set +o errexit
@ -4300,6 +4493,51 @@ run_cluster_management_tests() {
kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
# create test pods we can work with
kubectl create -f - "${kube_flags[@]}" << __EOF__
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "test-pod-1",
"labels": {
"e": "f"
}
},
"spec": {
"containers": [
{
"name": "container-1",
"resources": {},
"image": "test-image"
}
]
}
}
__EOF__
kubectl create -f - "${kube_flags[@]}" << __EOF__
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "test-pod-2",
"labels": {
"c": "d"
}
},
"spec": {
"containers": [
{
"name": "container-1",
"resources": {},
"image": "test-image"
}
]
}
}
__EOF__
### kubectl cordon update with --dry-run does not mark node unschedulable
# Pre-condition: node is schedulable
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
@ -4314,6 +4552,20 @@ run_cluster_management_tests() {
kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
### kubectl drain with --pod-selector only evicts pods that match the given selector
# Pre-condition: node is schedulable
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
# Pre-condition: test-pod-1 and test-pod-2 exist
kube::test::get_object_assert "pods" "{{range .items}}{{.metadata.name}},{{end}}" 'test-pod-1,test-pod-2,'
kubectl drain "127.0.0.1" --pod-selector 'e in (f)'
# only "test-pod-1" should have been matched and deleted - test-pod-2 should still exist
kube::test::get_object_assert "pods/test-pod-2" "{{.metadata.name}}" 'test-pod-2'
# delete pod no longer in use
kubectl delete pod/test-pod-2
# Post-condition: node is schedulable
kubectl uncordon "127.0.0.1"
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
### kubectl uncordon update with --dry-run is a no-op
# Pre-condition: node is already schedulable
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
@ -4468,7 +4720,7 @@ run_impersonation_tests() {
# Requires an env var SUPPORTED_RESOURCES which is a comma separated list of
# resources for which tests should be run.
runTests() {
foundError="False"
foundError=""
if [ -z "${SUPPORTED_RESOURCES:-}" ]; then
echo "Need to set SUPPORTED_RESOURCES env var. It is a list of resources that are supported and hence should be tested. Set it to (*) to test all resources"
@ -4521,6 +4773,7 @@ runTests() {
hpa_min_field=".spec.minReplicas"
hpa_max_field=".spec.maxReplicas"
hpa_cpu_field=".spec.targetCPUUtilizationPercentage"
template_labels=".spec.template.metadata.labels.name"
statefulset_replicas_field=".spec.replicas"
statefulset_observed_generation=".status.observedGeneration"
job_parallelism_field=".spec.parallelism"
@ -4639,6 +4892,7 @@ runTests() {
if kube::test::if_supports_resource "${pods}" ; then
record_command run_kubectl_get_tests
record_command run_kubectl_server_print_tests
fi
@ -4966,8 +5220,8 @@ runTests() {
kube::test::clear_all
if [ "$foundError" == "True" ]; then
echo "TEST FAILED"
if [[ -n "${foundError}" ]]; then
echo "FAILED TESTS: ""${foundError}"
exit 1
fi
}

View File

@ -34,7 +34,8 @@ function run_kube_apiserver() {
kube::log::status "Starting kube-apiserver"
# Admission Controllers to invoke prior to persisting objects in cluster
ADMISSION_CONTROL="Initializers,NamespaceLifecycle,LimitRanger,ResourceQuota"
ENABLE_ADMISSION_PLUGINS="Initializers,LimitRanger,ResourceQuota"
DISABLE_ADMISSION_PLUGINS="ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook"
# Include RBAC (to exercise bootstrapping), and AlwaysAllow to allow all actions
AUTHORIZATION_MODE="RBAC,AlwaysAllow"
@ -45,7 +46,8 @@ function run_kube_apiserver() {
--insecure-port="${API_PORT}" \
--authorization-mode="${AUTHORIZATION_MODE}" \
--secure-port="${SECURE_API_PORT}" \
--admission-control="${ADMISSION_CONTROL}" \
--enable-admission-plugins="${ENABLE_ADMISSION_PLUGINS}" \
--disable-admission-plugins="${DISABLE_ADMISSION_PLUGINS}" \
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
--runtime-config=api/v1 \
--storage-media-type="${KUBE_TEST_API_STORAGE_TYPE-}" \

View File

@ -60,6 +60,16 @@ if [ ! -d "${artifacts}" ]; then
fi
echo "Test artifacts will be written to ${artifacts}"
if [[ $runtime == "remote" ]] ; then
if [[ ! -z $container_runtime_endpoint ]] ; then
test_args="--container-runtime-endpoint=${container_runtime_endpoint} $test_args"
fi
if [[ ! -z $image_service_endpoint ]] ; then
test_args="--image-service-endpoint=$image_service_endpoint $test_args"
fi
fi
if [ $remote = true ] ; then
# The following options are only valid in remote run.
images=${IMAGES:-""}
@ -83,6 +93,7 @@ if [ $remote = true ] ; then
instance_prefix=${INSTANCE_PREFIX:-"test"}
cleanup=${CLEANUP:-"true"}
delete_instances=${DELETE_INSTANCES:-"false"}
test_suite=${TEST_SUITE:-"default"}
# Get the compute zone
zone=$(gcloud info --format='value(config.properties.compute.zone)')
@ -137,6 +148,7 @@ if [ $remote = true ] ; then
--image-project="$image_project" --instance-name-prefix="$instance_prefix" \
--delete-instances="$delete_instances" --test_args="$test_args" --instance-metadata="$metadata" \
--image-config-file="$image_config_file" --system-spec-name="$system_spec_name" \
--test-suite="$test_suite" \
2>&1 | tee -i "${artifacts}/build-log.txt"
exit $?
@ -153,22 +165,12 @@ else
# Runtime flags
test_args='--kubelet-flags="--container-runtime='$runtime'" '$test_args
if [[ $runtime == "remote" ]] ; then
if [[ ! -z $container_runtime_endpoint ]] ; then
test_args='--kubelet-flags="--container-runtime-endpoint='$container_runtime_endpoint'" '$test_args
fi
if [[ ! -z $image_service_endpoint ]] ; then
test_args='--kubelet-flags="--image-service-endpoint='$image_service_endpoint'" '$test_args
fi
fi
# Test using the host the script was run on
# Provided for backwards compatibility
go run test/e2e_node/runner/local/run_local.go \
--system-spec-name="$system_spec_name" --ginkgo-flags="$ginkgoflags" \
--test-flags="--container-runtime=${runtime} \
--container-runtime-endpoint=${container_runtime_endpoint} \
--image-service-endpoint=${image_service_endpoint} \
--alsologtostderr --v 4 --report-dir=${artifacts} --node-name $(hostname) \
$test_args" --build-dependencies=true 2>&1 | tee -i "${artifacts}/build-log.txt"
exit $?

View File

@ -30,10 +30,8 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
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"
# Give integration tests longer to run by default.
KUBE_TIMEOUT=${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:-}

84
vendor/k8s.io/kubernetes/hack/make-rules/update.sh generated vendored Executable file
View File

@ -0,0 +1,84 @@
#!/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 single script that runs a predefined set of update-* scripts, as they often go together.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
# If called directly, exit.
if [[ "${CALLED_FROM_MAIN_MAKEFILE:-""}" == "" ]]; then
echo "ERROR: $0 should not be run directly." >&2
echo >&2
echo "Please run this command using \"make update\""
exit 1
fi
SILENT=${SILENT:-true}
ALL=${FORCE_ALL:-false}
V=""
if [[ "${SILENT}" != "true" ]]; then
V="-v"
fi
trap 'exit 1' SIGINT
if ${SILENT} ; then
echo "Running in silent mode, run with SILENT=false if you want to see script logs."
fi
if ! ${ALL} ; then
echo "Running in short-circuit mode; run with FORCE_ALL=true to force all scripts to run."
fi
"${KUBE_ROOT}/hack/godep-restore.sh" ${V}
BASH_TARGETS="
update-generated-protobuf
update-codegen
update-generated-runtime
update-generated-device-plugin
update-generated-docs
update-generated-swagger-docs
update-swagger-spec
update-openapi-spec
update-api-reference-docs
update-staging-godeps
update-bazel"
for t in ${BASH_TARGETS}; do
echo -e "${color_yellow}Running $t${color_norm}"
if ${SILENT} ; then
if ! bash "${KUBE_ROOT}/hack/$t.sh" 1> /dev/null; then
echo -e "${color_red}Running $t FAILED${color_norm}"
if ! ${ALL}; then
exit 1
fi
fi
else
if ! bash "${KUBE_ROOT}/hack/$t.sh"; then
echo -e "${color_red}Running $t FAILED${color_norm}"
if ! ${ALL}; then
exit 1
fi
fi
fi
done
echo -e "${color_green}Update scripts completed successfully${color_norm}"

View File

@ -21,12 +21,16 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/util.sh"
# include shell2junit library
source "${KUBE_ROOT}/third_party/forked/shell2junit/sh2ju.sh"
# Excluded check patterns are always skipped.
EXCLUDED_PATTERNS=(
"verify-all.sh" # this script calls the make rule and would cause a loop
"verify-linkcheck.sh" # runs in separate Jenkins job once per day due to high network usage
"verify-test-owners.sh" # TODO(rmmh): figure out how to avoid endless conflicts
"verify-*-dockerized.sh" # Don't run any scripts that intended to be run dockerized
"verify-typecheck.sh" # runs in separate typecheck job
)
# Only run whitelisted fast checks in quick mode.
@ -42,6 +46,7 @@ QUICK_PATTERNS+=(
"verify-imports.sh"
"verify-pkg-names.sh"
"verify-readonly-packages.sh"
"verify-spelling.sh"
"verify-staging-client-go.sh"
"verify-test-images.sh"
"verify-test-owners.sh"
@ -69,14 +74,22 @@ function is-quick {
}
function run-cmd {
local filename="${2##*/verify-}"
local testname="${filename%%.*}"
local output="${KUBE_JUNIT_REPORT_DIR:-/tmp/junit-results}"
local tr
if ${SILENT}; then
"$@" &> /dev/null
juLog -output="${output}" -class="verify" -name="${testname}" "$@" &> /dev/null
tr=$?
else
"$@"
juLog -output="${output}" -class="verify" -name="${testname}" "$@"
tr=$?
fi
return ${tr}
}
# Collect Failed tests in this Array , initalize it to nil
# Collect Failed tests in this Array , initialize it to nil
FAILED_TESTS=()
function print-failed-tests {
@ -92,54 +105,41 @@ function run-checks {
local -r pattern=$1
local -r runner=$2
local t
for t in $(ls ${pattern})
do
local check_name="$(basename "${t}")"
if is-excluded "${t}" ; then
echo "Skipping ${t}"
echo "Skipping ${check_name}"
continue
fi
if ${QUICK} && ! is-quick "${t}" ; then
echo "Skipping ${t} in quick mode"
echo "Skipping ${check_name} in quick mode"
continue
fi
echo -e "Verifying ${t}"
echo -e "Verifying ${check_name}"
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"
echo -e "${color_green}SUCCESS${color_norm} ${check_name}\t${elapsed}s"
else
echo -e "${color_red}FAILED${color_norm} ${t}\t${elapsed}s"
echo -e "${color_red}FAILED${color_norm} ${check_name}\t${elapsed}s"
ret=1
FAILED_TESTS+=(${t})
fi
done
}
SILENT=true
QUICK=false
while getopts ":vQ" opt; do
case ${opt} in
v)
SILENT=false
;;
Q)
QUICK=true
;;
\?)
echo "Invalid flag: -${OPTARG}" >&2
exit 1
;;
esac
done
SILENT=${SILENT:-false}
QUICK=${QUICK:-false}
if ${SILENT} ; then
echo "Running in silent mode, run with -v if you want to see script logs."
echo "Running in silent mode, run with SILENT=false if you want to see script logs."
fi
if ${QUICK} ; then
echo "Running in quick mode (-Q flag). Only fast checks will run."
echo "Running in quick mode (QUICK=true). Only fast checks will run."
fi
ret=0
@ -147,7 +147,7 @@ run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
run-checks "${KUBE_ROOT}/hack/verify-*.py" python
if [[ ${ret} -eq 1 ]]; then
print-failed-tests
print-failed-tests
fi
exit ${ret}

View File

@ -43,5 +43,7 @@ gitTreeState ${KUBE_GIT_TREE_STATE-}
gitVersion ${KUBE_GIT_VERSION-}
gitMajor ${KUBE_GIT_MAJOR-}
gitMinor ${KUBE_GIT_MINOR-}
buildDate $(date -u +'%Y-%m-%dT%H:%M:%SZ')
buildDate $(date \
${SOURCE_DATE_EPOCH:+"--date=@${SOURCE_DATE_EPOCH}"} \
-u +'%Y-%m-%dT%H:%M:%SZ')
EOF

View File

@ -46,6 +46,7 @@ RUNTIME_CONFIG=""
ETCDCTL=$(which etcdctl)
KUBECTL="${KUBE_OUTPUT_HOSTBIN}/kubectl"
UPDATE_ETCD_OBJECTS_SCRIPT="${KUBE_ROOT}/cluster/update-storage-objects.sh"
DISABLE_ADMISSION_PLUGINS="ServiceAccount,NamespaceLifecycle,LimitRanger,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,PersistentVolumeLabel,DefaultStorageClass"
function startApiServer() {
local storage_versions=${1:-""}
@ -64,6 +65,7 @@ function startApiServer() {
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
--etcd-prefix="/${ETCD_PREFIX}" \
--runtime-config="${RUNTIME_CONFIG}" \
--disable-admission-plugins="${DISABLE_ADMISSION_PLUGINS}" \
--cert-dir="${TMPDIR:-/tmp/}" \
--service-cluster-ip-range="10.0.0.0/24" \
--storage-versions="${storage_versions}" \
@ -130,7 +132,7 @@ for test in ${tests[@]}; do
source_file=${test_data[0]}
kube::log::status "Creating ${source_file}"
${KUBECTL} create -f "${source_file}"
${KUBECTL} create -f "${KUBE_ROOT}/${source_file}"
# Verify that the storage version is the old version
resource=${test_data[1]}

View File

@ -0,0 +1,6 @@
apiVersion: mygroup.example.com/v1alpha1
kind: Kind
metadata:
name: myobj
spec:
key: value

View File

@ -13,6 +13,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:test-cmd
image: k8s.gcr.io/nginx:test-cmd
ports:
- containerPort: 80

View File

@ -2,9 +2,13 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
resourceVersion: "99"
labels:
name: nginx
spec:
selector:
matchLabels:
name: nginx2
replicas: 3
template:
metadata:
@ -13,6 +17,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:test-cmd
image: k8s.gcr.io/nginx:test-cmd
ports:
- containerPort: 80

View File

@ -0,0 +1,22 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
resourceVersion: "99"
labels:
name: nginx
spec:
selector:
matchLabels:
name: invalid
replicas: 3
template:
metadata:
labels:
name: nginx3
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:test-cmd
ports:
- containerPort: 80

View File

@ -16,9 +16,9 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:test-cmd
image: k8s.gcr.io/nginx:test-cmd
ports:
- containerPort: 80
- name: perl
image: gcr.io/google-containers/perl
image: k8s.gcr.io/perl
terminationGracePeriodSeconds: 0

View File

@ -16,8 +16,8 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:test-cmd
image: k8s.gcr.io/nginx:test-cmd
ports:
- containerPort: 80
- name: perl
image: gcr.io/google-containers/perl
image: k8s.gcr.io/perl

View File

@ -16,6 +16,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:test-cmd
image: k8s.gcr.io/nginx:test-cmd
ports:
- containerPort: 80

View File

@ -16,6 +16,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:1.7.9
image: k8s.gcr.io/nginx:1.7.9
ports:
- containerPort: 80

View File

@ -8,4 +8,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -8,4 +8,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -43,7 +43,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"

View File

@ -41,7 +41,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"

View File

@ -47,7 +47,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"

View File

@ -45,7 +45,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"

View File

@ -26,7 +26,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"
@ -60,7 +60,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"

View File

@ -26,7 +26,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"
@ -60,7 +60,7 @@
"spec":{
"containers":[{
"name": "mock-container",
"image": "gcr.io/google-containers/pause:2.0",
"image": "k8s.gcr.io/pause:2.0",
"ports":[{
"containerPort":9949,
"protocol":"TCP"

View File

@ -29,7 +29,7 @@ spec:
spec:
containers:
- name: mock-container
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0
ports:
- containerPort: 9949
protocol: TCP

View File

@ -27,7 +27,7 @@ spec:
spec:
containers:
- name: mock-container
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0
ports:
- containerPort: 9949
protocol: TCP

View File

@ -10,4 +10,4 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:1.7.9
image: k8s.gcr.io/nginx:1.7.9

View File

@ -14,5 +14,5 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:1.7.9
image: k8s.gcr.io/nginx:1.7.9
terminationMessagePolicy: null

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: test-container
image: gcr.io/google_containers/busybox
image: k8s.gcr.io/busybox
command: [ "/bin/sh", "-c", "env" ]
env:
- name: TEST_CMD_1

View File

@ -9,7 +9,7 @@
"containers": [
{
"name": "kubernetes-pause",
"image": "gcr.io/google_containers/pause-amd64:3.0"
"image": "k8s.gcr.io/pause-amd64:3.1"
}
],
"restartPolicy": "Never",

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -13,6 +13,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:1.7.9
image: k8s.gcr.io/nginx:1.7.9
ports:
- containerPort: 80

View File

@ -13,6 +13,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:1.7.9
image: k8s.gcr.io/nginx:1.7.9
ports:
- containerPort: 80

View File

@ -13,6 +13,6 @@ spec:
spec:
containers:
- name: nginx
image: gcr.io/google-containers/nginx:1.7.9
image: k8s.gcr.io/nginx:1.7.9
ports:
- containerPort: 80

View File

@ -24,6 +24,6 @@ spec:
namespaces: []
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:latest
image: k8s.gcr.io/pause:latest
- name: app
image: gcr.io/google-containers/nginx:test-cmd
image: k8s.gcr.io/nginx:test-cmd

View File

@ -24,4 +24,4 @@ spec:
namespaces: []
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -18,7 +18,7 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: nginx
image: gcr.io/google_containers/nginx-slim:0.8
image: k8s.gcr.io/nginx-slim:0.8
ports:
- containerPort: 80
name: web
@ -27,7 +27,7 @@ spec:
- -c
- 'while true; do sleep 1; done'
- name: pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0
ports:
- containerPort: 81
name: web-2

View File

@ -18,7 +18,7 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: nginx
image: gcr.io/google_containers/nginx-slim:0.7
image: k8s.gcr.io/nginx-slim:0.7
ports:
- containerPort: 80
name: web

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -7,4 +7,4 @@ metadata:
spec:
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0
image: k8s.gcr.io/pause:2.0

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
# Copyright 2018 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.
@ -14,77 +14,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# A single script that runs a predefined set of update-* scripts, as they often go together.
# This script is a vestigial redirection. Please do not add "real" logic.
# The "true" target of this makerule is `hack/make-rules/update.sh`.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
source "${KUBE_ROOT}/hack/lib/util.sh"
SILENT=true
ALL=false
V=""
while getopts ":va" opt; do
case $opt in
a)
ALL=true
;;
v)
SILENT=false
V="-v"
;;
\?)
echo "Invalid flag: -$OPTARG" >&2
exit 1
;;
esac
done
trap 'exit 1' SIGINT
if $SILENT ; then
echo "Running in silent mode, run with -v if you want to see script logs."
fi
if ! $ALL ; then
echo "Running in short-circuit mode; run with -a to force all scripts to run."
fi
"${KUBE_ROOT}/hack/godep-restore.sh" ${V}
BASH_TARGETS="
update-generated-protobuf
update-codegen
update-generated-runtime
update-generated-device-plugin
update-generated-docs
update-generated-swagger-docs
update-swagger-spec
update-openapi-spec
update-api-reference-docs
update-staging-godeps
update-bazel"
for t in $BASH_TARGETS; do
echo -e "${color_yellow}Running $t${color_norm}"
if $SILENT ; then
if ! bash "$KUBE_ROOT/hack/$t.sh" 1> /dev/null; then
echo -e "${color_red}Running $t FAILED${color_norm}"
if ! $ALL; then
exit 1
fi
fi
else
if ! bash "$KUBE_ROOT/hack/$t.sh"; then
echo -e "${color_red}Running $t FAILED${color_norm}"
if ! $ALL; then
exit 1
fi
fi
fi
done
echo -e "${color_green}Update scripts completed successfully${color_norm}"
echo "NOTE: $0 has been replaced by 'make update'"
echo
echo "The equivalent of this invocation is: "
echo " make update"
echo
echo
make --no-print-directory -C "${KUBE_ROOT}" update

View File

@ -29,10 +29,10 @@ rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
# The git commit sha1s here should match the values in $KUBE_ROOT/WORKSPACE.
kube::util::go_install_from_commit \
github.com/kubernetes/repo-infra/kazel \
ae4e9a3906ace4ba657b7a09242610c6266e832c
97099dccc8807e9159dc28f374a8f0602cab07e1
kube::util::go_install_from_commit \
github.com/bazelbuild/rules_go/go/tools/gazelle/gazelle \
c72631a220406c4fae276861ee286aaec82c5af2
github.com/bazelbuild/bazel-gazelle/cmd/gazelle \
a85b63b06c2e0c75931e57c4a1a18d4e566bb6f4
touch "${KUBE_ROOT}/vendor/BUILD"

38
vendor/k8s.io/kubernetes/hack/update-cloudprovider-gce.sh generated vendored Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# Copyright 2018 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"
GENERATOR="${KUBE_ROOT}/pkg/cloudprovider/providers/gce/cloud/gen/main.go"
GEN_GO="${KUBE_ROOT}/pkg/cloudprovider/providers/gce/cloud/gen.go"
GEN_TEST_GO="${KUBE_ROOT}/pkg/cloudprovider/providers/gce/cloud/gen_test.go"
kube::golang::setup_env
TMPFILE=$(mktemp verify-cloudprovider-gce-XXXX)
trap "{ rm -f ${TMPFILE}; }" EXIT
go run "${GENERATOR}" > ${TMPFILE}
mv "${TMPFILE}" "${GEN_GO}"
go run "${GENERATOR}" -mode test > ${TMPFILE}
mv "${TMPFILE}" "${GEN_TEST_GO}"
exit 0

View File

@ -42,25 +42,25 @@ GROUP_VERSIONS=(${KUBE_AVAILABLE_GROUP_VERSIONS})
GV_DIRS=()
INTERNAL_DIRS=()
for gv in "${GROUP_VERSIONS[@]}"; do
# add items, but strip off any leading apis/ you find to match command expectations
api_dir=$(kube::util::group-version-to-pkg-path "${gv}")
nopkg_dir=${api_dir#pkg/}
nopkg_dir=${nopkg_dir#vendor/k8s.io/api/}
pkg_dir=${nopkg_dir#apis/}
# add items, but strip off any leading apis/ you find to match command expectations
api_dir=$(kube::util::group-version-to-pkg-path "${gv}")
nopkg_dir=${api_dir#pkg/}
nopkg_dir=${nopkg_dir#vendor/k8s.io/api/}
pkg_dir=${nopkg_dir#apis/}
# skip groups that aren't being served, clients for these don't matter
# skip groups that aren't being served, clients for these don't matter
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then
continue
fi
GV_DIRS+=("${pkg_dir}")
GV_DIRS+=("${pkg_dir}")
# collect internal groups
int_group="${pkg_dir%/*}/"
if [[ "${pkg_dir}" = core/* ]]; then
int_group="api/"
fi
# collect internal groups
int_group="${pkg_dir%/*}/"
if [[ "${pkg_dir}" = core/* ]]; then
int_group="api/"
fi
if ! [[ " ${INTERNAL_DIRS[@]:-} " =~ " ${int_group} " ]]; then
INTERNAL_DIRS+=("${int_group}")
fi
@ -72,7 +72,7 @@ INTERNAL_DIRS_CSV=$(IFS=',';echo "${INTERNAL_DIRS[*]// /,}";IFS=$)
# This can be called with one flag, --verify-only, so it works for both the
# update- and verify- scripts.
${clientgen} --input-base="k8s.io/kubernetes/pkg/apis" --input="${INTERNAL_DIRS_CSV}" "$@"
${clientgen} --output-base "${KUBE_ROOT}/vendor" --clientset-path="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" "$@"
${clientgen} --output-base "${KUBE_ROOT}/vendor" --output-package="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" --go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt "$@"
listergen_internal_apis=(
$(
@ -91,7 +91,7 @@ $(
)
)
listergen_external_apis_csv=$(IFS=,; echo "${listergen_external_apis[*]}")
${listergen} --output-base "${KUBE_ROOT}/vendor" --output-package "k8s.io/client-go/listers" --input-dirs "${listergen_external_apis_csv}" "$@"
${listergen} --output-base "${KUBE_ROOT}/vendor" --output-package "k8s.io/client-go/listers" --input-dirs "${listergen_external_apis_csv}" --go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt "$@"
informergen_internal_apis=(
$(
@ -105,6 +105,7 @@ ${informergen} \
--input-dirs "${informergen_internal_apis_csv}" \
--internal-clientset-package k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset \
--listers-package k8s.io/kubernetes/pkg/client/listers \
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt \
"$@"
informergen_external_apis=(
@ -124,6 +125,7 @@ ${informergen} \
--input-dirs "${informergen_external_apis_csv}" \
--versioned-clientset-package k8s.io/client-go/kubernetes \
--listers-package k8s.io/client-go/listers \
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt \
"$@"
# You may add additional calls of code generators like set-gen above.

View File

@ -19,7 +19,9 @@ set -o nounset
set -o pipefail
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE}")/../" && pwd -P)"
DEVICE_PLUGIN_ROOT="${KUBE_ROOT}/pkg/kubelet/apis/deviceplugin/v1alpha/"
DEVICE_PLUGIN_ALPHA="${KUBE_ROOT}/pkg/kubelet/apis/deviceplugin/v1alpha/"
DEVICE_PLUGIN_V1BETA1="${KUBE_ROOT}/pkg/kubelet/apis/deviceplugin/v1beta1/"
source "${KUBE_ROOT}/hack/lib/protoc.sh"
kube::protoc::generate_proto ${DEVICE_PLUGIN_ROOT}
kube::protoc::generate_proto ${DEVICE_PLUGIN_ALPHA}
kube::protoc::generate_proto ${DEVICE_PLUGIN_V1BETA1}

View File

@ -0,0 +1,62 @@
#!/bin/bash
# Copyright 2018 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}")/..
KUBE_KMS_GRPC_ROOT="${KUBE_ROOT}/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/"
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
BINS=(
vendor/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
)
make -C "${KUBE_ROOT}" WHAT="${BINS[*]}"
if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]]; then
echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and"
echo "install the platform appropriate Protobuf package for your OS: "
echo
echo " https://github.com/google/protobuf/releases"
echo
echo "WARNING: Protobuf changes are not being validated"
exit 1
fi
function cleanup {
rm -f ${KUBE_KMS_GRPC_ROOT}/service.pb.go.bak
}
trap cleanup EXIT
gogopath=$(dirname $(kube::util::find-binary "protoc-gen-gogo"))
PATH="${gogopath}:${PATH}" \
protoc \
--proto_path="${KUBE_KMS_GRPC_ROOT}" \
--proto_path="${KUBE_ROOT}/vendor" \
--gogo_out=plugins=grpc:${KUBE_KMS_GRPC_ROOT} ${KUBE_KMS_GRPC_ROOT}/service.proto
# Update boilerplate for the generated file.
echo "$(cat hack/boilerplate/boilerplate.go.txt ${KUBE_KMS_GRPC_ROOT}/service.pb.go)" > ${KUBE_KMS_GRPC_ROOT}/service.pb.go
sed -i".bak" "s/Copyright YEAR/Copyright $(date '+%Y')/g" ${KUBE_KMS_GRPC_ROOT}/service.pb.go
# Run gofmt to clean up the generated code.
kube::golang::verify_go_version
gofmt -l -s -w ${KUBE_KMS_GRPC_ROOT}/service.pb.go

29
vendor/k8s.io/kubernetes/hack/update-generated-kms.sh generated vendored Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# Copyright 2018 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}")/..
# NOTE: All output from this script needs to be copied back to the calling
# source tree. This is managed in kube::build::copy_output in build/common.sh.
# If the output set is changed update that function.
${KUBE_ROOT}/build/run.sh hack/update-generated-kms-dockerized.sh "$@"
# ex: ts=2 sw=2 et filetype=sh

View File

@ -45,6 +45,7 @@ PACKAGES=(
k8s.io/apiserver/pkg/apis/example/v1
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1
k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1
k8s.io/kube-aggregator/pkg/apis/apiregistration/v1
k8s.io/api/core/v1
k8s.io/api/policy/v1beta1
k8s.io/api/extensions/v1beta1
@ -78,6 +79,7 @@ PACKAGES=(
k8s.io/metrics/pkg/apis/metrics/v1alpha1
k8s.io/metrics/pkg/apis/metrics/v1beta1
k8s.io/metrics/pkg/apis/custom_metrics/v1beta1
k8s.io/metrics/pkg/apis/external_metrics/v1beta1
k8s.io/apiserver/pkg/apis/audit/v1alpha1
k8s.io/apiserver/pkg/apis/audit/v1beta1
k8s.io/apiserver/pkg/apis/example2/v1
@ -91,5 +93,6 @@ PATH="${KUBE_ROOT}/_output/bin:${PATH}" \
"${gotoprotobuf}" \
--proto-import="${KUBE_ROOT}/vendor" \
--proto-import="${KUBE_ROOT}/third_party/protobuf" \
--packages=$(IFS=, ; echo "${PACKAGES[*]}")
--packages=$(IFS=, ; echo "${PACKAGES[*]}") \
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt \
"$@"

View File

@ -19,7 +19,7 @@ set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
KUBE_REMOTE_RUNTIME_ROOT="${KUBE_ROOT}/pkg/kubelet/apis/cri/v1alpha1/runtime/"
KUBE_REMOTE_RUNTIME_ROOT="${KUBE_ROOT}/pkg/kubelet/apis/cri/runtime/v1alpha2/"
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env

View File

@ -29,7 +29,7 @@ source "${KUBE_ROOT}/hack/lib/swagger.sh"
kube::golang::setup_env
GROUP_VERSIONS=(meta/v1 meta/v1alpha1 ${KUBE_AVAILABLE_GROUP_VERSIONS})
GROUP_VERSIONS=(meta/v1 meta/v1beta1 ${KUBE_AVAILABLE_GROUP_VERSIONS})
# To avoid compile errors, remove the currently existing files.
for group_version in "${GROUP_VERSIONS[@]}"; do

View File

@ -75,6 +75,14 @@ process_content () {
go4.org/*)
package_root=$(echo ${package} |awk -F/ '{ print $1 }')
;;
gopkg.in/*)
# Root of gopkg.in package always ends with '.v(number)' and my contain
# more than two path elements. For example:
# - gopkg.in/yaml.v2
# - gopkg.in/inf.v0
# - gopkg.in/square/go-jose.v2
package_root=$(echo ${package} |grep -oh '.*\.v[0-9]')
;;
*)
package_root=$(echo ${package} |awk -F/ '{ print $1"/"$2 }')
;;

View File

@ -37,14 +37,17 @@ make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
function cleanup()
{
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
if [[ -n "${APISERVER_PID-}" ]]; then
kill "${APISERVER_PID}" &>/dev/null || :
wait "${APISERVER_PID}" &>/dev/null || :
fi
kube::etcd::cleanup
kube::log::status "Clean up complete"
}
trap cleanup EXIT SIGINT
kube::util::trap_add cleanup EXIT
kube::golang::setup_env
@ -55,6 +58,7 @@ ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
API_PORT=${API_PORT:-8050}
API_HOST=${API_HOST:-127.0.0.1}
API_LOGFILE=/tmp/swagger-api-server.log
kube::etcd::start
@ -70,10 +74,16 @@ kube::log::status "Starting kube-apiserver"
--advertise-address="10.10.10.10" \
--cert-dir="${TMP_DIR}/certs" \
--runtime-config=$(echo "${KUBE_AVAILABLE_GROUP_VERSIONS}" | sed -E 's|[[:blank:]]+|,|g') \
--service-cluster-ip-range="10.0.0.0/24" >/tmp/swagger-api-server.log 2>&1 &
--service-cluster-ip-range="10.0.0.0/24" >"${API_LOGFILE}" 2>&1 &
APISERVER_PID=$!
kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "
if ! kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "; then
kube::log::error "Here are the last 10 lines from kube-apiserver (${API_LOGFILE})"
kube::log::error "=== BEGIN OF LOG ==="
tail -10 "${API_LOGFILE}" || :
kube::log::error "=== END OF LOG ==="
exit 1
fi
SWAGGER_API_PATH="${API_HOST}:${API_PORT}/swaggerapi/"

View File

@ -21,9 +21,9 @@ export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
if [[ ! -f "${KUBE_ROOT}/vendor/BUILD" ]]; then
echo "${KUBE_ROOT}/vendor/BUILD does not exist."
echo
echo "Run ./hack/update-bazel.sh"
echo "${KUBE_ROOT}/vendor/BUILD does not exist." >&2
echo >&2
echo "Run ./hack/update-bazel.sh" >&2
exit 1
fi
@ -45,8 +45,8 @@ GOPATH="${_tmp_gopath}" ./hack/update-bazel.sh
diff=$(diff -Naupr "${KUBE_ROOT}" "${_tmp_kuberoot}" || true)
if [[ -n "${diff}" ]]; then
echo "${diff}"
echo
echo "Run ./hack/update-bazel.sh"
echo "${diff}" >&2
echo >&2
echo "Run ./hack/update-bazel.sh" >&2
exit 1
fi

View File

@ -28,7 +28,7 @@ files_need_boilerplate=($(${boiler} "$@"))
# Run boilerplate check
if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then
for file in "${files_need_boilerplate[@]}"; do
echo "Boilerplate header is wrong for: ${file}"
echo "Boilerplate header is wrong for: ${file}" >&2
done
exit 1

49
vendor/k8s.io/kubernetes/hack/verify-cloudprovider-gce.sh generated vendored Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
# Copyright 2018 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"
GENERATOR="${KUBE_ROOT}/pkg/cloudprovider/providers/gce/cloud/gen/main.go"
GEN_GO="${KUBE_ROOT}/pkg/cloudprovider/providers/gce/cloud/gen.go"
GEN_TEST_GO="${KUBE_ROOT}/pkg/cloudprovider/providers/gce/cloud/gen_test.go"
kube::golang::setup_env
TMPFILE=$(mktemp verify-cloudprovider-gce-XXXX)
trap "{ rm -f ${TMPFILE}; }" EXIT
go run "${GENERATOR}" > ${TMPFILE}
if ! diff "${TMPFILE}" "${GEN_GO}"; then
echo "Generated file ${GEN_GO} needs to be updated (run hack/update-cloudprovider-gce.sh)"
echo
diff -u "${TMPFILE}" "${GEN_GO}" || true
exit 1
fi
go run "${GENERATOR}" -mode test > ${TMPFILE}
if ! diff "${TMPFILE}" "${GEN_TEST_GO}"; then
echo "Generated file ${GEN_TEST_GO} needs to be updated (run hack/update-cloudprovider-gce.sh)"
echo
diff -u "${TMPFILE}" "${GEN_TEST_GO}" || true
exit 1
fi
exit 0

View File

@ -23,3 +23,4 @@ retry_time
file_content_in_loop
break_on_expected_content
Premium_LRS
VCP_STRESS_ITERATIONS

View File

@ -20,20 +20,26 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
ERROR="Device plugin api is out of date. Please run hack/update-generated-device-plugin.sh"
DEVICE_PLUGIN_ROOT="${KUBE_ROOT}/pkg/kubelet/apis/deviceplugin/v1alpha/"
DEVICE_PLUGIN_ALPHA="${KUBE_ROOT}/pkg/kubelet/apis/deviceplugin/v1alpha/"
DEVICE_PLUGIN_V1BETA1="${KUBE_ROOT}/pkg/kubelet/apis/deviceplugin/v1beta1/"
source "${KUBE_ROOT}/hack/lib/protoc.sh"
kube::golang::setup_env
function cleanup {
rm -rf ${DEVICE_PLUGIN_ROOT}/_tmp/
rm -rf ${DEVICE_PLUGIN_ALPHA}/_tmp/
rm -rf ${DEVICE_PLUGIN_V1BETA1}/_tmp/
}
trap cleanup EXIT
mkdir -p ${DEVICE_PLUGIN_ROOT}/_tmp
cp ${DEVICE_PLUGIN_ROOT}/api.pb.go ${DEVICE_PLUGIN_ROOT}/_tmp/
mkdir -p ${DEVICE_PLUGIN_ALPHA}/_tmp
cp ${DEVICE_PLUGIN_ALPHA}/api.pb.go ${DEVICE_PLUGIN_ALPHA}/_tmp/
mkdir -p ${DEVICE_PLUGIN_V1BETA1}/_tmp
cp ${DEVICE_PLUGIN_V1BETA1}/api.pb.go ${DEVICE_PLUGIN_V1BETA1}/_tmp/
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-device-plugin.sh"
kube::protoc::diff "${DEVICE_PLUGIN_ROOT}/api.pb.go" "${DEVICE_PLUGIN_ROOT}/_tmp/api.pb.go" ${ERROR}
echo "Generated device plugin api is up to date."
kube::protoc::diff "${DEVICE_PLUGIN_ALPHA}/api.pb.go" "${DEVICE_PLUGIN_ALPHA}/_tmp/api.pb.go" ${ERROR}
echo "Generated device plugin alpha api is up to date."
kube::protoc::diff "${DEVICE_PLUGIN_V1BETA1}/api.pb.go" "${DEVICE_PLUGIN_V1BETA1}/_tmp/api.pb.go" ${ERROR}
echo "Generated device plugin beta api is up to date."

45
vendor/k8s.io/kubernetes/hack/verify-generated-kms.sh generated vendored Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Copyright 2018 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}")/..
KUBE_KMS_GRPC_ROOT="${KUBE_ROOT}/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/"
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
function cleanup {
rm -rf ${KUBE_KMS_GRPC_ROOT}/_tmp/
}
trap cleanup EXIT
mkdir -p ${KUBE_KMS_GRPC_ROOT}/_tmp
cp ${KUBE_KMS_GRPC_ROOT}/service.pb.go ${KUBE_KMS_GRPC_ROOT}/_tmp/
ret=0
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-kms.sh"
diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr ${KUBE_KMS_GRPC_ROOT}/_tmp/service.pb.go ${KUBE_KMS_GRPC_ROOT}/service.pb.go || ret=$?
if [[ $ret -eq 0 ]]; then
echo "Generated KMS gRPC is up to date."
cp ${KUBE_KMS_GRPC_ROOT}/_tmp/service.pb.go ${KUBE_KMS_GRPC_ROOT}/
else
echo "Generated KMS gRPC is out of date. Please run hack/update-generated-kms.sh"
exit 1
fi

View File

@ -43,7 +43,7 @@ for APIROOT in ${APIROOTS}; do
TMP_APIROOT="${_tmp}/${APIROOT}"
echo "diffing ${APIROOT} against freshly generated protobuf"
ret=0
diff -Naupr -I 'Auto generated by' -x 'zz_generated.*' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
diff -Naupr -I 'Auto generated by' -x 'zz_generated.*' -x '.github' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
cp -a "${TMP_APIROOT}"/* "${KUBE_ROOT}/${APIROOT}/"
if [[ $ret -eq 0 ]]; then
echo "${APIROOT} up to date."

View File

@ -19,7 +19,7 @@ set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
KUBE_REMOTE_RUNTIME_ROOT="${KUBE_ROOT}/pkg/kubelet/apis/cri/v1alpha1/runtime"
KUBE_REMOTE_RUNTIME_ROOT="${KUBE_ROOT}/pkg/kubelet/apis/cri/runtime/v1alpha2"
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env

View File

@ -49,7 +49,7 @@ LICENSE_ROOT="${_tmpdir}" "${KUBE_ROOT}/hack/update-godep-licenses.sh"
# Compare Godep Licenses
if ! _out="$(diff -Naupr ${KUBE_ROOT}/Godeps/LICENSES ${_tmpdir}/Godeps/LICENSES)"; then
echo "Your godep licenses file is out of date. Run hack/update-godep-licenses.sh and commit the results."
echo "${_out}"
echo "Your godep licenses file is out of date. Run hack/update-godep-licenses.sh and commit the results." >&2
echo "${_out}" >&2
exit 1
fi

View File

@ -18,30 +18,6 @@ set -o errexit
set -o nounset
set -o pipefail
# As of go 1.6, the vendor experiment is enabled by default.
export GO15VENDOREXPERIMENT=1
#### HACK ####
# Sometimes godep just can't handle things. This lets use manually put
# some deps in place first, so godep won't fall over.
preload-dep() {
org="$1"
project="$2"
sha="$3"
# project_dir ($4) is optional, if unset we will generate it
if [[ -z ${4:-} ]]; then
project_dir="${GOPATH}/src/${org}/${project}.git"
else
project_dir="${4}"
fi
echo "**HACK** preloading dep for ${org} ${project} at ${sha} into ${project_dir}"
git clone "https://${org}/${project}" "${project_dir}" > /dev/null 2>&1
pushd "${project_dir}" > /dev/null
git checkout "${sha}"
popd > /dev/null
}
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
@ -49,10 +25,14 @@ readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}
if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'Godeps/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'vendor/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'hack/lib/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'hack/.*godep'; then
exit 0
fi
# Ensure we have the right godep version available
kube::util::ensure_godep_version
if [[ -z ${TMP_GOPATH:-} ]]; then
# Create a nice clean place to put our new godeps
_tmpdir="$(mktemp -d -t gopath.XXXXXX)"
@ -105,14 +85,14 @@ ret=0
pushd "${KUBE_ROOT}" 2>&1 > /dev/null
# Test for diffs
if ! _out="$(diff -Naupr --ignore-matching-lines='^\s*\"GoVersion\":' --ignore-matching-line='^\s*\"GodepVersion\":' --ignore-matching-lines='^\s*\"Comment\":' Godeps/Godeps.json ${_kubetmp}/Godeps/Godeps.json)"; then
echo "Your Godeps.json is different:"
echo "${_out}"
echo "Godeps Verify failed."
echo "Your Godeps.json is different:" >&2
echo "${_out}" >&2
echo "Godeps Verify failed." >&2
echo "${_out}" > godepdiff.patch
echo "If you're seeing this locally, run the below command to fix your Godeps.json:"
echo "patch -p0 < godepdiff.patch"
echo "(The above output can be saved as godepdiff.patch if you're not running this locally)"
echo "(The patch file should also be exported as a build artifact if run through CI)"
echo "If you're seeing this locally, run the below command to fix your Godeps.json:" >&2
echo "patch -p0 < godepdiff.patch" >&2
echo "(The above output can be saved as godepdiff.patch if you're not running this locally)" >&2
echo "(The patch file should also be exported as a build artifact if run through CI)" >&2
KEEP_TMP=true
if [[ -f godepdiff.patch && -d "${ARTIFACTS_DIR:-}" ]]; then
echo "Copying patch to artifacts.."
@ -122,14 +102,14 @@ pushd "${KUBE_ROOT}" 2>&1 > /dev/null
fi
if ! _out="$(diff -Naupr -x "BUILD" -x "AUTHORS*" -x "CONTRIBUTORS*" vendor ${_kubetmp}/vendor)"; then
echo "Your vendored results are different:"
echo "${_out}"
echo "Godeps Verify failed."
echo "Your vendored results are different:" >&2
echo "${_out}" >&2
echo "Godeps Verify failed." >&2
echo "${_out}" > vendordiff.patch
echo "If you're seeing this locally, run the below command to fix your directories:"
echo "patch -p0 < vendordiff.patch"
echo "(The above output can be saved as godepdiff.patch if you're not running this locally)"
echo "(The patch file should also be exported as a build artifact if run through CI)"
echo "If you're seeing this locally, run the below command to fix your directories:" >&2
echo "patch -p0 < vendordiff.patch" >&2
echo "(The above output can be saved as godepdiff.patch if you're not running this locally)" >&2
echo "(The patch file should also be exported as a build artifact if run through CI)" >&2
KEEP_TMP=true
if [[ -f vendordiff.patch && -d "${ARTIFACTS_DIR:-}" ]]; then
echo "Copying patch to artifacts.."

View File

@ -54,6 +54,8 @@ find_files() {
# have failed before getting to the "echo" in the block below.
diff=$(find_files | xargs ${gofmt} -d -s 2>&1) || true
if [[ -n "${diff}" ]]; then
echo "${diff}"
echo "${diff}" >&2
echo >&2
echo "Run ./hack/update-gofmt.sh" >&2
exit 1
fi

View File

@ -35,7 +35,7 @@ mkdir -p "${_tmp}"
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
trap "cp -a ${TMP_SPECROOT} ${SPECROOT}/..; rm -rf ${_tmp}" EXIT SIGINT
rm ${SPECROOT}/*
cp ${TMP_SPECROOT}/BUILD ${SPECROOT}/BUILD
cp ${TMP_SPECROOT}/BUILD ${SPECROOT}/BUILD
cp ${TMP_SPECROOT}/README.md ${SPECROOT}/README.md
"${KUBE_ROOT}/hack/update-openapi-spec.sh"
@ -46,7 +46,7 @@ if [[ $ret -eq 0 ]]
then
echo "${SPECROOT} up to date."
else
echo "${SPECROOT} is out of date. Please run hack/update-openapi-spec.sh"
echo "${SPECROOT} is out of date. Please run hack/update-openapi-spec.sh" >&2
exit 1
fi

37
vendor/k8s.io/kubernetes/hack/verify-spelling.sh generated vendored Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Copyright 2018 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
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
# Install tools we need, but only from vendor/...
cd ${KUBE_ROOT}
go install ./vendor/github.com/client9/misspell/cmd/misspell
if ! which misspell >/dev/null 2>&1; then
echo "Can't find misspell - is your GOPATH 'bin' in your PATH?" >&2
echo " GOPATH: ${GOPATH}" >&2
echo " PATH: ${PATH}" >&2
exit 1
fi
# Spell checking
# All the skipping files are defined in hack/.spelling_failures
skipping_file="${KUBE_ROOT}/hack/.spelling_failures"
failing_packages=$(echo `cat ${skipping_file}` | sed "s| | -e |g")
git ls-files | grep -v -e ${failing_packages} | xargs misspell -i "Creater,creater,ect" -error -o stderr

View File

@ -19,4 +19,17 @@ set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}
if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'staging/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'build/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'Godeps/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'vendor/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'hack/lib/' && \
! kube::util::has_changes_against_upstream_branch "${branch}" 'hack/.*godep'; then
exit 0
fi
KUBE_VERBOSE="${KUBE_VERBOSE:-3}" KUBE_RUN_COPY_OUTPUT=N ${KUBE_ROOT}/hack/update-staging-godeps.sh -d -f "$@"

Some files were not shown because too many files have changed in this diff Show More