[master] Auto-update dependencies (#323)

Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
This commit is contained in:
Matt Moore 2020-08-31 09:34:11 -07:00 committed by GitHub
parent ccf6aa3309
commit fd71d66116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 87 additions and 92 deletions

4
go.mod
View File

@ -16,8 +16,8 @@ require (
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/code-generator v0.18.6
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
knative.dev/pkg v0.0.0-20200827231407-8d478d55c0e6
knative.dev/test-infra v0.0.0-20200828024406-bf34ea55d769
knative.dev/pkg v0.0.0-20200831094608-e9da10bc8a18
knative.dev/test-infra v0.0.0-20200828211307-9d4372c9b1c7
)
replace (

8
go.sum
View File

@ -1868,8 +1868,8 @@ knative.dev/pkg v0.0.0-20200505191044-3da93ebb24c2/go.mod h1:Q6sL35DdGs8hIQZKdaC
knative.dev/pkg v0.0.0-20200515002500-16d7b963416f/go.mod h1:tMOHGbxtRz8zYFGEGpV/bpoTEM1o89MwYFC4YJXl3GY=
knative.dev/pkg v0.0.0-20200528142800-1c6815d7e4c9/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/pkg v0.0.0-20200711004937-22502028e31a/go.mod h1:AqAJV6rYi8IGikDjJ/9ZQd9qKdkXVlesVnVjwx62YB8=
knative.dev/pkg v0.0.0-20200827231407-8d478d55c0e6 h1:Wj8q6aj02ht5vimP6wLKfxG3I50v637wXxoyt0oLnTE=
knative.dev/pkg v0.0.0-20200827231407-8d478d55c0e6/go.mod h1:vOVUMtkIWK+hq1+KwlLYBSYVjz5SNIP1vMj3/5SNGZw=
knative.dev/pkg v0.0.0-20200831094608-e9da10bc8a18 h1:BJTbbN0/J0BY76tzHE6/oko4lw6GEeahMrZUfigySyc=
knative.dev/pkg v0.0.0-20200831094608-e9da10bc8a18/go.mod h1:vOVUMtkIWK+hq1+KwlLYBSYVjz5SNIP1vMj3/5SNGZw=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
@ -1877,8 +1877,8 @@ knative.dev/test-infra v0.0.0-20200519015156-82551620b0a9/go.mod h1:A5b2OAXTOeHT
knative.dev/test-infra v0.0.0-20200707183444-aed09e56ddc7/go.mod h1:RjYAhXnZqeHw9+B0zsbqSPlae0lCvjekO/nw5ZMpLCs=
knative.dev/test-infra v0.0.0-20200825022047-cb4bb218c5e5 h1:iqbpe5rccMW2r1Mu1Prw4gJ9xi7yqahmtxzckTUHBeI=
knative.dev/test-infra v0.0.0-20200825022047-cb4bb218c5e5/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20200828024406-bf34ea55d769 h1:4F657CFFjQ81XPe/hOSj2OoCA9G0GUVmgW/5FWAy6vM=
knative.dev/test-infra v0.0.0-20200828024406-bf34ea55d769/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20200828211307-9d4372c9b1c7 h1:yIzao6i9Hu51SCdpyqBEnhpt7G12FqFrxHK6ZnQnu8o=
knative.dev/test-infra v0.0.0-20200828211307-9d4372c9b1c7/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=

View File

@ -118,7 +118,7 @@ type ComponentConfig struct {
// Autoscaler need to know the Lease names to filter out Leases which are not
// used for Autoscaler. Instead of exposing the names from leadelection package,
// we let Autoscaler to pass them in.
LeaseName func(i uint32) string
LeaseName func(i uint32) string `json:"-"`
// Identity is the unique string identifying a resource lock holder across
// all participants in an election. If not present, a new unique string will
// be generated to be used as identity for each BuildElector call.

View File

@ -51,11 +51,8 @@ function setup_test_cluster() {
set -o errexit
set -o pipefail
header "Test cluster setup"
kubectl get nodes
header "Setting up test cluster"
kubectl get nodes
# Set the actual project the test cluster resides in
# It will be a project assigned by Boskos if test is running on Prow,
# otherwise will be ${E2E_GCP_PROJECT_ID} set up by user.
@ -63,21 +60,17 @@ function setup_test_cluster() {
export E2E_PROJECT_ID
readonly E2E_PROJECT_ID
local k8s_user
k8s_user=$(gcloud config get-value core/account)
local k8s_cluster
k8s_cluster=$(kubectl config current-context)
is_protected_cluster "${k8s_cluster}" && \
abort "kubeconfig context set to ${k8s_cluster}, which is forbidden"
# If cluster admin role isn't set, this is a brand new cluster
# Setup the admin role and also KO_DOCKER_REPO if it is a GKE cluster
if [[ -z "$(kubectl get clusterrolebinding cluster-admin-binding 2> /dev/null)" && "${k8s_cluster}" =~ ^gke_.* ]]; then
acquire_cluster_admin_role "${k8s_user}" "${E2E_CLUSTER_NAME}" "${E2E_GKE_CLUSTER_REGION}" "${E2E_GKE_CLUSTER_ZONE}"
# Incorporate an element of randomness to ensure that each run properly publishes images.
export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${REPO_NAME}-e2e-img/${RANDOM}
fi
# Acquire cluster admin role for the current user.
acquire_cluster_admin_role "${k8s_cluster}"
# Setup KO_DOCKER_REPO if it is a GKE cluster. Incorporate an element of randomness to ensure that each run properly publishes images.
[[ "${k8s_cluster}" =~ ^gke_.* ]] && export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${REPO_NAME}-e2e-img/${RANDOM}
# Safety checks
is_protected_gcr "${KO_DOCKER_REPO}" && \
@ -92,7 +85,7 @@ function setup_test_cluster() {
export KO_DATA_PATH="${REPO_ROOT_DIR}/.git"
# Do not run teardowns if we explicitly want to skip them.
(( ! SKIP_TEARDOWNS )) && trap teardown_test_resources EXIT
(( ! SKIP_TEARDOWNS )) && add_trap teardown_test_resources EXIT
# Handle failures ourselves, so we can dump useful info.
set +o errexit
@ -130,6 +123,7 @@ function fail_test() {
SKIP_TEARDOWNS=0
SKIP_ISTIO_ADDON=0
E2E_SCRIPT=""
CLOUD_PROVIDER="gke"
# Parse flags and initialize the test cluster.
function initialize() {
@ -166,6 +160,7 @@ function initialize() {
[[ $# -ge 2 ]] || abort "missing parameter after $1"
shift
case ${parameter} in
--cloud-provider) CLOUD_PROVIDER="$1" ;;
--kubetest2-flag) extra_kubetest2_flags+=("$1") ;;
--cluster-creation-flag) extra_cluster_creation_flags+=("$1") ;;
*) abort "unknown option ${parameter}" ;;
@ -186,7 +181,7 @@ function initialize() {
readonly SKIP_TEARDOWNS
if (( ! run_tests )); then
create_gke_test_cluster extra_kubetest2_flags extra_cluster_creation_flags e2e_script_command
create_test_cluster "${CLOUD_PROVIDER}" extra_kubetest2_flags extra_cluster_creation_flags e2e_script_command
else
setup_test_cluster
fi

View File

@ -106,6 +106,7 @@ function dump_cluster_state() {
}
# On a Prow job, save some metadata about the test for Testgrid.
# Parameters: $1 - cluster provider name
function save_metadata() {
(( ! IS_PROW )) && return
local geo_key="Region"
@ -116,6 +117,7 @@ function save_metadata() {
fi
local cluster_version
cluster_version="$(kubectl version --short=true)"
run_kntest metadata set --key="E2E:Provider" --value="$1"
run_kntest metadata set --key="E2E:${geo_key}" --value="${geo_value}"
run_kntest metadata set --key="E2E:Machine" --value="${E2E_GKE_CLUSTER_MACHINE}"
run_kntest metadata set --key="E2E:Version" --value="${cluster_version}"
@ -123,30 +125,74 @@ function save_metadata() {
run_kntest metadata set --key="E2E:MaxNodes" --value="${E2E_MAX_CLUSTER_NODES}"
}
# Create a GKE test cluster with kubetest2 and call the current script again.
# Parameters: $1 - extra kubetest2 flags
# $2 - extra cluster creation flags
# $3 - test command to run by the kubetest2 tester
function create_gke_test_cluster() {
# Sets the current user as cluster admin for the given cluster.
# Parameters: $1 - cluster context name
function acquire_cluster_admin_role() {
if [[ -z "$(kubectl get clusterrolebinding cluster-admin-binding 2> /dev/null)" ]]; then
if [[ "$1" =~ ^gke_.* ]]; then
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin --user="$(gcloud config get-value core/account)"
else
kubectl create clusterrolebinding cluster-admin-binding-"${USER}" \
--clusterrole=cluster-admin --user="${USER}"
fi
fi
}
# Create a test cluster and run the tests if provided.
# Parameters: $1 - cluster provider name, e.g. gke
# $2 - extra kubetest2 flags
# $3 - extra cluster creation flags
# $4 - test command to run by the kubetest2 tester
function create_test_cluster() {
# Fail fast during setup.
set -o errexit
set -o pipefail
local -n _extra_kubetest2_flags=$1
local -n _extra_cluster_creation_flags=$2
local -n _tester_command=$3
if function_exists cluster_setup; then
cluster_setup || fail_test "cluster setup failed"
fi
case "$1" in
gke) create_gke_test_cluster "$2" "$3" "$4" ;;
kind) create_kind_test_cluster "$2" "$3" "$4" ;;
*) echo "unsupported provider: $1"; exit 1 ;;
esac
local result="$?"
# Ignore any errors below, this is a best-effort cleanup and shouldn't affect the test result.
set +o errexit
set +o pipefail
function_exists cluster_teardown && cluster_teardown
echo "Artifacts were written to ${ARTIFACTS}"
echo "Test result code is ${result}"
exit "${result}"
}
# Create a KIND test cluster with kubetest2 and run the test command.
# Parameters: $1 - extra kubetest2 flags
# $2 - extra cluster creation flags
# $3 - test command to run by the kubetest2 tester
function create_kind_test_cluster() {
# TODO(chizhg): implement with kubetest2
return 0
}
# Create a GKE test cluster with kubetest2 and run the test command.
# Parameters: $1 - extra kubetest2 flags
# $2 - extra cluster creation flags
# $3 - test command to run by the kubetest2 tester after the cluster is created (optional)
function create_gke_test_cluster() {
local -n _extra_kubetest2_flags=$1
local -n _extra_cluster_creation_flags=$2
echo "Cluster will have a minimum of ${E2E_MIN_CLUSTER_NODES} and a maximum of ${E2E_MAX_CLUSTER_NODES} nodes."
local _kubetest2_flags=(
"gke"
"--create-command=${E2E_GKE_COMMAND_GROUP} container clusters create --quiet --enable-autoscaling
--min-nodes=${E2E_MIN_CLUSTER_NODES} --max-nodes=${E2E_MAX_CLUSTER_NODES}
--cluster-version=${E2E_CLUSTER_VERSION}
--scopes=${E2E_GKE_SCOPES} --enable-basic-auth --no-issue-client-certificate
--no-enable-ip-alias --no-enable-autoupgrade
--scopes=${E2E_GKE_SCOPES} --no-enable-autoupgrade
${_extra_cluster_creation_flags[@]}"
"--environment=${E2E_GKE_ENVIRONMENT}"
"--cluster-name=${E2E_CLUSTER_NAME}"
@ -163,7 +209,7 @@ function create_gke_test_cluster() {
_kubetest2_flags+=("--project=${gcloud_project}")
echo "gcloud project is ${gcloud_project}"
else
echo "Using boskos for the test cluster"
echo "Using boskos for provisioning the GCP project to create the test cluster"
fi
if (( IS_BOSKOS )); then
@ -176,24 +222,19 @@ function create_gke_test_cluster() {
fi
# Create cluster and run the tests
create_gke_test_cluster_with_retries _kubetest2_flags _tester_command
local result="$?"
# Ignore any errors below, this is a best-effort cleanup and shouldn't affect the test result.
set +o errexit
set +o pipefail
function_exists cluster_teardown && cluster_teardown
echo "Artifacts were written to ${ARTIFACTS}"
echo "Test result code is ${result}"
exit "${result}"
create_gke_test_cluster_with_retries _kubetest2_flags "$3"
}
# TODO(chizhg): move this to kubetest2 gke deployer.
# Retry backup regions/zones if cluster creations failed due to stockout.
# Parameters: $1 - kubetest2 flags other than geo flag
# $2 - test command to run by the kubetest2 tester
# $2 - test command to run by the kubetest2 tester after the cluster is created (optional)
function create_gke_test_cluster_with_retries() {
local -n kubetest2_flags=$1
local -n tester_command=$2
local -n command=$2
if (( ${#command[@]} )); then
tester_command=("--test=exec" "--" "${command[@]}")
fi
local cluster_creation_log=/tmp/${REPO_NAME}-cluster_creation-log
# zone_not_provided is a placeholder for e2e_cluster_zone to make for loop below work
local zone_not_provided="zone_not_provided"
@ -220,19 +261,16 @@ function create_gke_test_cluster_with_retries() {
header "Creating test cluster ${E2E_CLUSTER_VERSION} in ${cluster_creation_zone}"
if run_go_tool k8s-sigs.io/kubetest2 \
kubetest2 "${kubetest2_flags[@]}" --region="${cluster_creation_zone}" \
--test=exec -- "${tester_command[@]}" 2>&1 \
kubetest2 "${kubetest2_flags[@]}" --region="${cluster_creation_zone}" "${tester_command[@]}" 2>&1 \
| tee "${cluster_creation_log}"; then
# Save some metadata about cluster creation for using in prow and testgrid
save_metadata
save_metadata "gke"
return 0
fi
# Retry if cluster creation failed because of:
# - stockout (https://github.com/knative/test-infra/issues/592)
# - latest GKE not available in this region/zone yet (https://github.com/knative/test-infra/issues/694)
# Retry if cluster creation failed because of stockout (https://github.com/knative/test-infra/issues/592)
# or Nodes failing to start correctly.
# shellcheck disable=SC2143
[[ -z "$(grep -Fo 'does not have enough resources available to fulfill' "${cluster_creation_log}")" \
&& -z "$(grep -Fo 'ResponseError: code=400, message=No valid versions with the prefix' "${cluster_creation_log}")" \
&& -z "$(grep -Po 'ResponseError: code=400, message=Master version "[0-9a-z\-\.]+" is unsupported' "${cluster_creation_log}")" \
&& -z "$(grep -Po 'only \d+ nodes out of \d+ have registered; this is likely due to Nodes failing to start correctly' "${cluster_creation_log}")" ]] \
&& return 1
done

View File

@ -327,44 +327,6 @@ function dump_app_logs() {
done
}
# Sets the given user as cluster admin.
# Parameters: $1 - user
# $2 - cluster name
# $3 - cluster region
# $4 - cluster zone, optional
function acquire_cluster_admin_role() {
echo "Acquiring cluster-admin role for user '$1'"
local geoflag="--region=$3"
[[ -n $4 ]] && geoflag="--zone=$3-$4"
# Get the password of the admin and use it, as the service account (or the user)
# might not have the necessary permission.
local password=$(gcloud --format="value(masterAuth.password)" \
container clusters describe $2 ${geoflag})
if [[ -n "${password}" ]]; then
# Cluster created with basic authentication
kubectl config set-credentials cluster-admin \
--username=admin --password=${password}
else
local cert=$(mktemp)
local key=$(mktemp)
echo "Certificate in ${cert}, key in ${key}"
gcloud --format="value(masterAuth.clientCertificate)" \
container clusters describe $2 ${geoflag} | base64 --decode > ${cert}
gcloud --format="value(masterAuth.clientKey)" \
container clusters describe $2 ${geoflag} | base64 --decode > ${key}
kubectl config set-credentials cluster-admin \
--client-certificate=${cert} --client-key=${key}
fi
kubectl config set-context $(kubectl config current-context) \
--user=cluster-admin
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \
--user=$1
# Reset back to the default account
gcloud container clusters get-credentials \
$2 ${geoflag} --project $(gcloud config get-value project)
}
# Run a command through tee and capture its output.
# Parameters: $1 - file where the output will be stored.
# $2... - command to run.

4
vendor/modules.txt vendored
View File

@ -752,7 +752,7 @@ k8s.io/kube-openapi/pkg/util/sets
k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/trace
# knative.dev/pkg v0.0.0-20200827231407-8d478d55c0e6
# knative.dev/pkg v0.0.0-20200831094608-e9da10bc8a18
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck/ducktypes
@ -776,7 +776,7 @@ knative.dev/pkg/metrics/metricskey
knative.dev/pkg/network
knative.dev/pkg/reconciler
knative.dev/pkg/system
# knative.dev/test-infra v0.0.0-20200828024406-bf34ea55d769
# knative.dev/test-infra v0.0.0-20200828211307-9d4372c9b1c7
## explicit
knative.dev/test-infra/scripts
knative.dev/test-infra/tools/dep-collector