Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7229096

Browse files
committed
Add config for the main gke-jenkins jobs to e2e.sh
1 parent bff6ee8 commit 7229096

File tree

3 files changed

+131
-12
lines changed

3 files changed

+131
-12
lines changed

cluster/gke/config-common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ NETWORK="${NETWORK:-default}"
2525
NETWORK_RANGE="${NETWORK_RANGE:-10.240.0.0/16}"
2626
FIREWALL_SSH="${FIREWALL_SSH:-${NETWORK}-allow-ssh}"
2727
GCLOUD="${GCLOUD:-gcloud}"
28-
CMD_GROUP="${CMD_GROUP:-beta}"
28+
CMD_GROUP="${CMD_GROUP:-}"
2929
GCLOUD_CONFIG_DIR="${GCLOUD_CONFIG_DIR:-${HOME}/.config/gcloud/kubernetes}"
3030
MINION_SCOPES="${MINION_SCOPES:-"compute-rw,storage-ro"}"
3131
MACHINE_TYPE="${MACHINE_TYPE:-n1-standard-1}"

cluster/gke/util.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function verify-prereqs() {
9999
sudo_prefix="sudo"
100100
fi
101101
${sudo_prefix} gcloud ${gcloud_prompt:-} components update preview || true
102-
${sudo_prefix} gcloud ${gcloud_prompt:-} components update "${CMD_GROUP}"|| true
102+
${sudo_prefix} gcloud ${gcloud_prompt:-} components update ${CMD_GROUP:-} || true
103103
${sudo_prefix} gcloud ${gcloud_prompt:-} components update kubectl|| true
104104
${sudo_prefix} gcloud ${gcloud_prompt:-} components update || true
105105
}
@@ -150,7 +150,7 @@ function kube-up() {
150150
)
151151

152152
# Bring up the cluster.
153-
"${GCLOUD}" "${CMD_GROUP}" container clusters create "${CLUSTER_NAME}" "${create_args[@]}"
153+
"${GCLOUD}" ${CMD_GROUP:-} container clusters create "${CLUSTER_NAME}" "${create_args[@]}"
154154
}
155155

156156
# Execute prior to running tests to initialize required structure. This is
@@ -200,7 +200,7 @@ function test-setup() {
200200
function detect-master() {
201201
echo "... in gke:detect-master()" >&2
202202
detect-project >&2
203-
KUBE_MASTER_IP=$("${GCLOUD}" "${CMD_GROUP}" container clusters describe \
203+
KUBE_MASTER_IP=$("${GCLOUD}" ${CMD_GROUP:-} container clusters describe \
204204
--project="${PROJECT}" --zone="${ZONE}" "${CLUSTER_NAME}" \
205205
| grep endpoint | cut -f 2 -d ' ')
206206
}
@@ -242,7 +242,7 @@ function detect-minion-names {
242242
# NODE_INSTANCE_GROUP
243243
function detect-node-instance-group {
244244
echo "... in gke:detect-node-instance-group()" >&2
245-
NODE_INSTANCE_GROUP=$("${GCLOUD}" "${CMD_GROUP}" container clusters describe \
245+
NODE_INSTANCE_GROUP=$("${GCLOUD}" ${CMD_GROUP:-} container clusters describe \
246246
--project="${PROJECT}" --zone="${ZONE}" "${CLUSTER_NAME}" \
247247
| grep instanceGroupManagers | cut -d '/' -f 11)
248248
}
@@ -318,6 +318,6 @@ function test-teardown() {
318318
function kube-down() {
319319
echo "... in gke:kube-down()" >&2
320320
detect-project >&2
321-
"${GCLOUD}" "${CMD_GROUP}" container clusters delete --project="${PROJECT}" \
321+
"${GCLOUD}" ${CMD_GROUP:-} container clusters delete --project="${PROJECT}" \
322322
--zone="${ZONE}" "${CLUSTER_NAME}" --quiet
323323
}

hack/jenkins/e2e.sh

Lines changed: 125 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ if [[ ${JOB_NAME} =~ ^kubernetes-.*-gce ]]; then
7070
: ${E2E_MIN_STARTUP_PODS:="1"}
7171
: ${E2E_ZONE:="us-central1-f"}
7272
: ${NUM_MINIONS_PARALLEL:="6"} # Number of nodes required to run all of the tests in parallel
73+
74+
elif [[ ${JOB_NAME} =~ ^kubernetes-.*-gke ]]; then
75+
KUBERNETES_PROVIDER="gke"
76+
: ${E2E_ZONE:="us-central1-f"}
7377
fi
7478

7579
if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
@@ -84,15 +88,29 @@ if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
8488
fi
8589
fi
8690

87-
# Specialized tests which should be skipped by default for projects.
88-
GCE_DEFAULT_SKIP_TESTS=(
91+
# Specialized to skip when running reboot tests.
92+
REBOOT_SKIP_TESTS=(
8993
"Autoscaling\sSuite"
9094
"Skipped"
9195
"Reboot"
9296
"Restart"
9397
"Example"
9498
)
9599

100+
# Specialized tests which should be skipped by default for projects.
101+
GCE_DEFAULT_SKIP_TESTS=(
102+
"${REBOOT_SKIP_TESTS[@]}"
103+
"Reboot")
104+
105+
# Tests which cannot be run on GKE, e.g. because they require
106+
# master ssh access.
107+
GKE_REQUIRED_SKIP_TESTS=(
108+
"Nodes"
109+
"Etcd\sFailure"
110+
"MasterCerts"
111+
"Shell"
112+
)
113+
96114
# The following tests are known to be flaky, and are thus run only in their own
97115
# -flaky- build variants.
98116
GCE_FLAKY_TESTS=(
@@ -345,6 +363,81 @@ case ${JOB_NAME} in
345363
: ${KUBE_GCE_INSTANCE_PREFIX="e2e-gce"}
346364
: ${PROJECT:="k8s-jkns-e2e-gce-release"}
347365
;;
366+
367+
kubernetes-e2e-gke-prod)
368+
: ${DOGFOOD_GCLOUD:="true"}
369+
: ${E2E_CLUSTER_NAME:="jkns-gke-e2e-prod"}
370+
: ${E2E_NETWORK:="e2e-gke-prod"}
371+
: ${E2E_SET_CLUSTER_API_VERSION:=y}
372+
: ${JENKINS_USE_SERVER_VERSION:=y}
373+
: ${PROJECT:="k8s-jkns-e2e-gke-prod"}
374+
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
375+
${GKE_REQUIRED_SKIP_TESTS[@]:+${GKE_REQUIRED_SKIP_TESTS[@]}} \
376+
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
377+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
378+
)"}
379+
;;
380+
381+
kubernetes-e2e-gke-staging)
382+
: ${DOGFOOD_GCLOUD:="true"}
383+
: ${GKE_API_ENDPOINT:="https://staging-container.sandbox.googleapis.com/"}
384+
: ${E2E_CLUSTER_NAME:="jkns-gke-e2e-staging"}
385+
: ${E2E_NETWORK:="e2e-gke-staging"}
386+
: ${E2E_SET_CLUSTER_API_VERSION:=y}
387+
: ${JENKINS_USE_SERVER_VERSION:=y}
388+
: ${PROJECT:="k8s-jkns-e2e-gke-staging"}
389+
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
390+
${GKE_REQUIRED_SKIP_TESTS[@]:+${GKE_REQUIRED_SKIP_TESTS[@]}} \
391+
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
392+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
393+
)"}
394+
;;
395+
396+
kubernetes-e2e-gke-test)
397+
: ${DOGFOOD_GCLOUD:="true"}
398+
: ${CLOUDSDK_BUCKET:="gs://cloud-sdk-build/testing/rc"}
399+
: ${GKE_API_ENDPOINT:="https://test-container.sandbox.googleapis.com/"}
400+
: ${E2E_CLUSTER_NAME:="jkns-gke-e2e-test"}
401+
: ${E2E_NETWORK:="e2e-gke-test"}
402+
: ${JENKINS_USE_RELEASE_TARS:=y}
403+
: ${PROJECT:="k8s-jkns-e2e-gke-ci"}
404+
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
405+
${GKE_REQUIRED_SKIP_TESTS[@]:+${GKE_REQUIRED_SKIP_TESTS[@]}} \
406+
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
407+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
408+
)"}
409+
;;
410+
411+
kubernetes-e2e-gke-ci)
412+
: ${DOGFOOD_GCLOUD:="true"}
413+
: ${CLOUDSDK_BUCKET:="gs://cloud-sdk-build/testing/staging"}
414+
: ${GKE_API_ENDPOINT:="https://test-container.sandbox.googleapis.com/"}
415+
: ${E2E_CLUSTER_NAME:="jkns-gke-e2e-ci"}
416+
: ${E2E_NETWORK:="e2e-gke-ci"}
417+
: ${E2E_SET_CLUSTER_API_VERSION:=y}
418+
: ${PROJECT:="k8s-jkns-e2e-gke-ci"}
419+
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
420+
${GKE_REQUIRED_SKIP_TESTS[@]:+${GKE_REQUIRED_SKIP_TESTS[@]}} \
421+
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
422+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
423+
)"}
424+
;;
425+
426+
kubernetes-e2e-gke-ci-reboot)
427+
: ${DOGFOOD_GCLOUD:="true"}
428+
: ${CLOUDSDK_BUCKET:="gs://cloud-sdk-build/testing/staging"}
429+
: ${GKE_API_ENDPOINT:="https://test-container.sandbox.googleapis.com/"}
430+
: ${E2E_CLUSTER_NAME:="jkns-gke-e2e-ci-reboot"}
431+
: ${E2E_NETWORK:="e2e-gke-ci"}
432+
: ${E2E_SET_CLUSTER_API_VERSION:=y}
433+
: ${PROJECT:="k8s-jkns-e2e-gke-ci"}
434+
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
435+
${GKE_REQUIRED_SKIP_TESTS[@]:+${GKE_REQUIRED_SKIP_TESTS[@]}} \
436+
${REBOOT_SKIP_TESTS[@]:+${REBOOT_SKIP_TESTS[@]}} \
437+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
438+
${GCE_PARALLEL_SKIP_TESTS[@]:+${GCE_PARALLEL_SKIP_TESTS[@]}} \
439+
)"}
440+
;;
348441
esac
349442

350443
# AWS variables
@@ -362,6 +455,13 @@ export KUBE_GCS_STAGING_PATH_SUFFIX=${KUBE_GCS_STAGING_PATH_SUFFIX:-}
362455
export CLUSTER_NAME=${E2E_CLUSTER_NAME}
363456
export ZONE=${E2E_ZONE}
364457
export KUBE_GKE_NETWORK=${E2E_NETWORK}
458+
export E2E_SET_CLUSTER_API_VERSION=${E2E_SET_CLUSTER_API_VERSION:-}
459+
export DOGFOOD_GCLOUD=${DOGFOOD_GCLOUD:-}
460+
export CMD_GROUP=${CMD_GROUP:-}
461+
462+
if [[ ! -z "${GKE_API_ENDPOINT:-}" ]]; then
463+
export CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER=${GKE_API_ENDPOINT}
464+
fi
365465

366466
# Shared cluster variables
367467
export E2E_MIN_STARTUP_PODS=${E2E_MIN_STARTUP_PODS:-}
@@ -371,6 +471,7 @@ export MINION_SIZE=${MINION_SIZE:-}
371471
export NUM_MINIONS=${NUM_MINIONS:-}
372472
export PROJECT=${PROJECT:-}
373473

474+
export KUBERNETES_PROVIDER=${KUBERNETES_PROVIDER}
374475
export PATH=${PATH}:/usr/local/go/bin
375476
export KUBE_SKIP_CONFIRMATIONS=y
376477

@@ -407,10 +508,13 @@ if [[ "${E2E_UP,,}" == "true" || "${JENKINS_FORCE_GET_TARS:-}" =~ ^[yY]$ ]]; the
407508
# gcloud bug can cause racing component updates to stomp on each
408509
# other.
409510
export KUBE_SKIP_UPDATE=y
410-
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update -q" || true
411-
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update preview -q" || true
412-
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update alpha -q" || true
413-
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update beta -q" || true
511+
{
512+
sudo flock -x -n 9
513+
gcloud components update -q || true
514+
gcloud components update preview -q || true
515+
gcloud components update alpha -q || true
516+
gcloud components update beta -q || true
517+
} 9>/var/run/lock/gcloud-components.lock
414518

415519
if [[ ! -z ${JENKINS_EXPLICIT_VERSION:-} ]]; then
416520
# Use an explicit pinned version like "ci/v0.10.0-101-g6c814c4" or
@@ -496,6 +600,21 @@ ARTIFACTS=${WORKSPACE}/_artifacts
496600
mkdir -p ${ARTIFACTS}
497601
export E2E_REPORT_DIR=${ARTIFACTS}
498602

603+
### Pre Set Up ###
604+
# Install gcloud from a custom path if provided. Used to test GKE with gcloud
605+
# at HEAD, release candidate.
606+
if [[ ! -z "${CLOUDSDK_BUCKET:-}" ]]; then
607+
sudo gsutil -m cp -r "${CLOUDSDK_BUCKET}" ~
608+
mv ~/$(basename "${CLOUDSDK_BUCKET}") ~/repo
609+
mkdir ~/cloudsdk
610+
tar zvxf ~/repo/google-cloud-sdk.tar.gz -C ~/cloudsdk
611+
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
612+
export CLOUDSDK_COMPONENT_MANAGER_SNAPSHOT_URL=file://${HOME}/repo/components-2.json
613+
~/cloudsdk/google-cloud-sdk/install.sh --disable-installation-options --bash-completion=false --path-update=false --usage-reporting=false
614+
export PATH=${HOME}/cloudsdk/google-cloud-sdk/bin:${PATH}
615+
export CLOUDSDK_CONFIG=/var/lib/jenkins/.config/gcloud
616+
fi
617+
499618
### Set up ###
500619
if [[ "${E2E_UP,,}" == "true" ]]; then
501620
go run ./hack/e2e.go ${E2E_OPT} -v --down

0 commit comments

Comments
 (0)