vendor update for CSI 0.3.0

This commit is contained in:
gman
2018-07-18 16:47:22 +02:00
parent 6f484f92fc
commit 8ea659f0d5
6810 changed files with 438061 additions and 193861 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2014 The Kubernetes Authors.
#
@ -16,7 +16,7 @@
# A set of helpers for starting/running etcd for tests
ETCD_VERSION=${ETCD_VERSION:-3.2.14}
ETCD_VERSION=${ETCD_VERSION:-3.2.18}
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
@ -103,6 +103,9 @@ kube::etcd::cleanup() {
kube::etcd::install() {
(
cd "${KUBE_ROOT}/third_party"
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-* ]]; then
return # already installed
fi
if [[ $(uname) == "Darwin" ]]; then
download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2014 The Kubernetes Authors.
#
@ -213,17 +213,27 @@ readonly KUBE_STATIC_LIBRARIES=(
kubectl
)
# Add any files with those //generate annotations in the array below.
readonly KUBE_BINDATAS=(
test/e2e/generated/gobindata_util.go
)
# KUBE_CGO_OVERRIDES is a space-separated list of binaries which should be built
# with CGO enabled, assuming CGO is supported on the target platform.
# This overrides any entry in KUBE_STATIC_LIBRARIES.
IFS=" " read -ra KUBE_CGO_OVERRIDES <<< "${KUBE_CGO_OVERRIDES:-}"
readonly KUBE_CGO_OVERRIDES
# KUBE_STATIC_OVERRIDES is a space-separated list of binaries which should be
# built with CGO disabled. This is in addition to the list in
# KUBE_STATIC_LIBRARIES.
IFS=" " read -ra KUBE_STATIC_OVERRIDES <<< "${KUBE_STATIC_OVERRIDES:-}"
readonly KUBE_STATIC_OVERRIDES
kube::golang::is_statically_linked_library() {
local e
# Explicitly enable cgo when building kubectl for darwin from darwin.
[[ "$(go env GOHOSTOS)" == "darwin" && "$(go env GOOS)" == "darwin" &&
"$1" == *"/kubectl" ]] && return 1
if [[ -n "${KUBE_CGO_OVERRIDES:+x}" ]]; then
for e in "${KUBE_CGO_OVERRIDES[@]}"; do [[ "$1" == *"/$e" ]] && return 1; done;
fi
for e in "${KUBE_STATIC_LIBRARIES[@]}"; do [[ "$1" == *"/$e" ]] && return 0; done;
# Allow individual overrides--e.g., so that you can get a static build of
# kubectl for inclusion in a container.
if [ -n "${KUBE_STATIC_OVERRIDES:+x}" ]; then
if [[ -n "${KUBE_STATIC_OVERRIDES:+x}" ]]; then
for e in "${KUBE_STATIC_OVERRIDES[@]}"; do [[ "$1" == *"/$e" ]] && return 0; done;
fi
return 1;
@ -326,7 +336,7 @@ EOF
local go_version
IFS=" " read -ra go_version <<< "$(go version)"
local minimum_go_version
minimum_go_version=go1.9.1
minimum_go_version=go1.10.2
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[*]}.
@ -355,6 +365,7 @@ kube::golang::setup_env() {
kube::golang::create_gopath_tree
export GOPATH="${KUBE_GOPATH}"
export GOCACHE="${KUBE_GOPATH}/cache"
# Append KUBE_EXTRA_GOPATH to the GOPATH if it is defined.
if [[ -n ${KUBE_EXTRA_GOPATH:-} ]]; then
@ -416,52 +427,9 @@ kube::golang::place_bins() {
done
}
kube::golang::fallback_if_stdlib_not_installable() {
local go_root_dir=$(go env GOROOT);
local go_host_os=$(go env GOHOSTOS);
local go_host_arch=$(go env GOHOSTARCH);
local cgo_pkg_dir=${go_root_dir}/pkg/${go_host_os}_${go_host_arch}_cgo;
if [ -e ${cgo_pkg_dir} ]; then
return 0;
fi
if [ -w ${go_root_dir}/pkg ]; then
return 0;
fi
kube::log::status "+++ Warning: stdlib pkg with cgo flag not found.";
kube::log::status "+++ Warning: stdlib pkg cannot be rebuilt since ${go_root_dir}/pkg is not writable by `whoami`";
kube::log::status "+++ Warning: Make ${go_root_dir}/pkg writable for `whoami` for a one-time stdlib install, Or"
kube::log::status "+++ Warning: Rebuild stdlib using the command 'CGO_ENABLED=0 go install -a -installsuffix cgo std'";
kube::log::status "+++ Falling back to go build, which is slower";
use_go_build=true
}
# Builds the toolchain necessary for building kube. This needs to be
# built only on the host platform.
# TODO: Find this a proper home.
# Ideally, not a shell script because testing shell scripts is painful.
kube::golang::build_kube_toolchain() {
local targets=(
hack/cmd/teststale
vendor/github.com/jteeuwen/go-bindata/go-bindata
)
local binaries
binaries=($(kube::golang::binaries_from_targets "${targets[@]}"))
kube::log::status "Building the toolchain targets:" "${binaries[@]}"
go install "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${binaries[@]:+${binaries[@]}}"
}
# Try and replicate the native binary placement of go install without
# calling go install.
kube::golang::output_filename_for_binary() {
kube::golang::outfile_for_binary() {
local binary=$1
local platform=$2
local output_path="${KUBE_GOPATH}/bin"
@ -477,7 +445,6 @@ kube::golang::output_filename_for_binary() {
kube::golang::build_binaries_for_platform() {
local platform=$1
local use_go_build=${2-}
local -a statics=()
local -a nonstatics=()
@ -496,79 +463,25 @@ kube::golang::build_binaries_for_platform() {
done
if [[ "${#statics[@]}" != 0 ]]; then
kube::golang::fallback_if_stdlib_not_installable;
CGO_ENABLED=0 go install -installsuffix static "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${statics[@]:+${statics[@]}}"
fi
if [[ -n ${use_go_build:-} ]]; then
kube::log::progress " "
for binary in "${statics[@]:+${statics[@]}}"; do
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
CGO_ENABLED=0 go build -o "${outfile}" \
"${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${binary}"
kube::log::progress "*"
done
for binary in "${nonstatics[@]:+${nonstatics[@]}}"; do
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
go build -o "${outfile}" \
"${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${binary}"
kube::log::progress "*"
done
kube::log::progress "\n"
else
# Use go install.
if [[ "${#nonstatics[@]}" != 0 ]]; then
go install "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${nonstatics[@]:+${nonstatics[@]}}"
fi
if [[ "${#statics[@]}" != 0 ]]; then
CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${statics[@]:+${statics[@]}}"
fi
if [[ "${#nonstatics[@]}" != 0 ]]; then
go install "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${nonstatics[@]:+${nonstatics[@]}}"
fi
for test in "${tests[@]:+${tests[@]}}"; do
local outfile=$(kube::golang::output_filename_for_binary "${test}" \
"${platform}")
local outfile=$(kube::golang::outfile_for_binary "${test}" "${platform}")
local testpkg="$(dirname ${test})"
# Staleness check always happens on the host machine, so we don't
# have to locate the `teststale` binaries for the other platforms.
# Since we place the host binaries in `$KUBE_GOPATH/bin`, we can
# assume that the binary exists there, if it exists at all.
# Otherwise, something has gone wrong with building the `teststale`
# binary and we should safely proceed building the test binaries
# assuming that they are stale. There is no good reason to error
# out.
if test -x "${KUBE_GOPATH}/bin/teststale" && ! "${KUBE_GOPATH}/bin/teststale" -binary "${outfile}" -package "${testpkg}"
then
continue
fi
# `go test -c` below directly builds the binary. It builds the packages,
# but it never installs them. `go test -i` only installs the dependencies
# of the test, but not the test package itself. So neither `go test -c`
# nor `go test -i` installs, for example, test/e2e.a. And without that,
# doing a staleness check on k8s.io/kubernetes/test/e2e package always
# returns true (always stale). And that's why we need to install the
# test package.
go install "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${testpkg}"
mkdir -p "$(dirname ${outfile})"
go test -i -c \
go test -c \
"${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
@ -629,14 +542,11 @@ kube::golang::build_binaries() {
goldflags="${GOLDFLAGS:-} $(kube::version::ldflags)"
gogcflags="${GOGCFLAGS:-}"
local use_go_build
local -a targets=()
local arg
for arg; do
if [[ "${arg}" == "--use_go_build" ]]; then
use_go_build=true
elif [[ "${arg}" == -* ]]; then
if [[ "${arg}" == -* ]]; then
# Assume arguments starting with a dash are flags to pass to go.
goflags+=("${arg}")
else
@ -671,26 +581,14 @@ kube::golang::build_binaries() {
fi
fi
# First build the toolchain before building any other targets
kube::golang::build_kube_toolchain
kube::log::status "Generating bindata:" "${KUBE_BINDATAS[@]}"
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
go generate "${goflags[@]:+${goflags[@]}}" "${KUBE_ROOT}/${bindata}"
fi
done
if [[ "${parallel}" == "true" ]]; then
kube::log::status "Building go targets for {${platforms[*]}} in parallel (output will appear in a burst when complete):" "${targets[@]}"
local platform
for platform in "${platforms[@]}"; do (
kube::golang::set_platform_envs "${platform}"
kube::log::status "${platform}: go build started"
kube::golang::build_binaries_for_platform ${platform} ${use_go_build:-}
kube::log::status "${platform}: go build finished"
kube::log::status "${platform}: build started"
kube::golang::build_binaries_for_platform ${platform}
kube::log::status "${platform}: build finished"
) &> "/tmp//${platform//\//_}.build" &
done
@ -709,7 +607,7 @@ kube::golang::build_binaries() {
kube::log::status "Building go targets for ${platform}:" "${targets[@]}"
(
kube::golang::set_platform_envs "${platform}"
kube::golang::build_binaries_for_platform ${platform} ${use_go_build:-}
kube::golang::build_binaries_for_platform ${platform}
)
done
fi

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2014 The Kubernetes Authors.
#
@ -81,6 +81,7 @@ rbac.authorization.k8s.io/v1 \
rbac.authorization.k8s.io/v1beta1 \
rbac.authorization.k8s.io/v1alpha1 \
scheduling.k8s.io/v1alpha1 \
scheduling.k8s.io/v1beta1 \
settings.k8s.io/v1alpha1 \
storage.k8s.io/v1beta1 \
storage.k8s.io/v1 \

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2014 The Kubernetes Authors.
#

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2017 The Kubernetes Authors.
#
@ -71,8 +71,7 @@ function kube::protoc::format() {
local package=${1}
# Update boilerplate for the generated file.
echo "$(cat hack/boilerplate/boilerplate.go.txt ${package}/api.pb.go)" > ${package}/api.pb.go
sed -i".bak" "s/Copyright YEAR/Copyright $(date '+%Y')/g" ${package}/api.pb.go
echo "$(cat hack/boilerplate/boilerplate.generatego.txt ${package}/api.pb.go)" > ${package}/api.pb.go
# Run gofmt to clean up the generated code.
kube::golang::verify_go_version

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2016 The Kubernetes Authors.
#
@ -34,7 +34,7 @@ kube::swagger::gen_types_swagger_doc() {
echo "Generating swagger type docs for ${group_version} at ${gv_dir}"
sed 's/YEAR/2016/' hack/boilerplate/boilerplate.go.txt > "$TMPFILE"
echo -e "$(cat hack/boilerplate/boilerplate.generatego.txt)\n" > "$TMPFILE"
echo "package ${group_version##*/}" >> "$TMPFILE"
cat >> "$TMPFILE" <<EOF
@ -48,7 +48,7 @@ kube::swagger::gen_types_swagger_doc() {
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
EOF
go run cmd/genswaggertypedocs/swagger_type_docs.go -s \

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#
@ -76,7 +76,7 @@ kube::test::object_assert() {
local args=${5:-}
for j in $(seq 1 ${tries}); do
res=$(eval kubectl get -a "${kube_flags[@]}" ${args} $object -o go-template=\"$request\")
res=$(eval kubectl get "${kube_flags[@]}" ${args} $object -o go-template=\"$request\")
if [[ "$res" =~ ^$expected$ ]]; then
echo -n ${green}
echo "$(kube::test::get_caller 3): Successful get $object $request: $res"
@ -103,7 +103,7 @@ kube::test::get_object_jsonpath_assert() {
local request=$2
local expected=$3
res=$(eval kubectl get -a "${kube_flags[@]}" $object -o jsonpath=\"$request\")
res=$(eval kubectl get "${kube_flags[@]}" $object -o jsonpath=\"$request\")
if [[ "$res" =~ ^$expected$ ]]; then
echo -n ${green}

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2014 The Kubernetes Authors.
#
@ -23,6 +23,7 @@ kube::util::wait_for_url() {
local prefix=${2:-}
local wait=${3:-1}
local times=${4:-30}
local maxtime=${5:-1}
which curl >/dev/null || {
kube::log::usage "curl must be installed"
@ -32,7 +33,7 @@ kube::util::wait_for_url() {
local i
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 "$maxtime" -gkfs "$url" 2>/dev/null); then
kube::log::status "On try ${i}, ${prefix}: ${out}"
return 0
fi
@ -275,9 +276,6 @@ kube::util::group-version-to-pkg-path() {
meta/v1beta1)
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1"
;;
unversioned)
echo "pkg/api/unversioned"
;;
*.k8s.io)
echo "pkg/apis/${group_version%.*k8s.io}"
;;
@ -430,7 +428,7 @@ kube::util::ensure_clean_working_dir() {
# Ensure that the given godep version is installed and in the path. Almost
# nobody should use any version but the default.
kube::util::ensure_godep_version() {
GODEP_VERSION=${1:-"v79"} # this version is known to work
GODEP_VERSION=${1:-"v80"} # this version is known to work
if [[ "$(godep version 2>/dev/null)" == *"godep ${GODEP_VERSION}"* ]]; then
return
@ -438,12 +436,19 @@ 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 ! which godep >/dev/null 2>&1; then
kube::log::error "Can't find godep - is your GOPATH 'bin' in your PATH?"
kube::log::error " GOPATH: ${GOPATH}"
kube::log::error " PATH: ${PATH}"
return 1
fi
if [[ "$(godep version 2>/dev/null)" != *"godep ${GODEP_VERSION}"* ]]; then
kube::log::error "Expected godep ${GODEP_VERSION}, got $(godep version)"
kube::log::error "Wrong godep version - is your GOPATH 'bin' in your PATH?"
kube::log::error " expected: godep ${GODEP_VERSION}"
kube::log::error " got: $(godep version)"
kube::log::error " GOPATH: ${GOPATH}"
kube::log::error " PATH: ${PATH}"
return 1
fi
}
@ -469,23 +474,6 @@ kube::util::ensure_no_staging_repos_in_gopath() {
fi
}
# Installs the specified go package at a particular commit.
kube::util::go_install_from_commit() {
local -r pkg=$1
local -r commit=$2
kube::util::ensure-temp-dir
mkdir -p "${KUBE_TEMP}/go/src"
GOPATH="${KUBE_TEMP}/go" go get -d -u "${pkg}"
(
cd "${KUBE_TEMP}/go/src/${pkg}"
git checkout -q "${commit}"
GOPATH="${KUBE_TEMP}/go" go install "${pkg}"
)
PATH="${KUBE_TEMP}/go/bin:${PATH}"
hash -r # force bash to clear PATH cache
}
# Checks that the GOPATH is simple, i.e. consists only of one directory, not multiple.
kube::util::ensure_single_dir_gopath() {
if [[ "${GOPATH}" == *:* ]]; then
@ -566,7 +554,7 @@ function kube::util::create_signing_certkey {
local id=$3
local purpose=$4
# Create client ca
${sudo} /bin/bash -e <<EOF
${sudo} /usr/bin/env bash -e <<EOF
rm -f "${dest_dir}/${id}-ca.crt" "${dest_dir}/${id}-ca.key"
${OPENSSL_BIN} req -x509 -sha256 -new -nodes -days 365 -newkey rsa:2048 -keyout "${dest_dir}/${id}-ca.key" -out "${dest_dir}/${id}-ca.crt" -subj "/C=xx/ST=x/L=x/O=x/OU=x/CN=ca/emailAddress=x/"
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment",${purpose}]}}}' > "${dest_dir}/${id}-ca-config.json"
@ -588,7 +576,7 @@ function kube::util::create_client_certkey {
SEP=","
shift 1
done
${sudo} /bin/bash -e <<EOF
${sudo} /usr/bin/env bash -e <<EOF
cd ${dest_dir}
echo '{"CN":"${cn}","names":[${groups}],"hosts":[""],"key":{"algo":"rsa","size":2048}}' | ${CFSSL_BIN} gencert -ca=${ca}.crt -ca-key=${ca}.key -config=${ca}-config.json - | ${CFSSLJSON_BIN} -bare client-${id}
mv "client-${id}-key.pem" "client-${id}.key"
@ -612,7 +600,7 @@ function kube::util::create_serving_certkey {
SEP=","
shift 1
done
${sudo} /bin/bash -e <<EOF
${sudo} /usr/bin/env bash -e <<EOF
cd ${dest_dir}
echo '{"CN":"${cn}","hosts":[${hosts}],"key":{"algo":"rsa","size":2048}}' | ${CFSSL_BIN} gencert -ca=${ca}.crt -ca-key=${ca}.key -config=${ca}-config.json - | ${CFSSLJSON_BIN} -bare serving-${id}
mv "serving-${id}-key.pem" "serving-${id}.key"
@ -654,7 +642,7 @@ EOF
# flatten the kubeconfig files to make them self contained
username=$(whoami)
${sudo} /bin/bash -e <<EOF
${sudo} /usr/bin/env bash -e <<EOF
$(kube::util::find-binary kubectl) --kubeconfig="${dest_dir}/${client_id}.kubeconfig" config view --minify --flatten > "/tmp/${client_id}.kubeconfig"
mv -f "/tmp/${client_id}.kubeconfig" "${dest_dir}/${client_id}.kubeconfig"
chown ${username} "${dest_dir}/${client_id}.kubeconfig"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2014 The Kubernetes Authors.
#
@ -45,7 +45,7 @@ kube::version::get_version_vars() {
# When a 'git archive' is exported, the '$Format:%D$' below will look
# something like 'HEAD -> release-1.8, tag: v1.8.3' where then 'tag: '
# can be extracted from it.
if [[ '$Format:%D$' =~ tag:\ (v[^ ]+) ]]; then
if [[ '$Format:%D$' =~ tag:\ (v[^ ,]+) ]]; then
KUBE_GIT_VERSION="${BASH_REMATCH[1]}"
fi
fi
@ -99,7 +99,7 @@ kube::version::get_version_vars() {
# 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 "KUBE_GIT_VERSION should be a valid Semantic Version. Current value: ${KUBE_GIT_VERSION}"
echo "Please see more details here: https://semver.org"
exit 1
fi