33
33
# The expected environment is:
34
34
# - $GOPATH/src/<import path> for the repository that is to be tested,
35
35
# with PR branch merged (when testing a PR)
36
- # - optional: bazel installed (when testing against Kubernetes master),
37
- # must be recent enough for Kubernetes master
38
36
# - running on linux-amd64
39
37
# - kind (https://github.com/kubernetes-sigs/kind) installed
40
38
# - optional: Go already installed
@@ -139,11 +137,8 @@ kind_version_default () {
139
137
case " ${CSI_PROW_KUBERNETES_VERSION} " in
140
138
latest|master)
141
139
echo main;;
142
- 1.21* |release-1.21)
143
- # TODO: replace this special case once the next KinD release supports 1.21.
144
- echo main;;
145
140
* )
146
- echo v0.10 .0;;
141
+ echo v0.11 .0;;
147
142
esac
148
143
}
149
144
@@ -154,16 +149,14 @@ configvar CSI_PROW_KIND_VERSION "$(kind_version_default)" "kind"
154
149
155
150
# kind images to use. Must match the kind version.
156
151
# The release notes of each kind release list the supported images.
157
- configvar CSI_PROW_KIND_IMAGES " kindest/node:v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab
158
- kindest/node:v1.19.7@sha256:a70639454e97a4b733f9d9b67e12c01f6b0297449d5b9cbbef87473458e26dca
159
- kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
160
- kindest/node:v1.17.17@sha256:7b6369d27eee99c7a85c48ffd60e11412dc3f373658bc59b7f4d530b7056823e
161
- kindest/node:v1.16.15@sha256:c10a63a5bda231c0a379bf91aebf8ad3c79146daca59db816fb963f731852a99
162
- kindest/node:v1.15.12@sha256:67181f94f0b3072fb56509107b380e38c55e23bf60e6f052fbd8052d26052fb5
163
- kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f5ec34578f6180" " kind images"
164
-
165
- # Use kind node-image --type=bazel by default, but allow to disable that.
166
- configvar CSI_PROW_USE_BAZEL true " use Bazel during 'kind node-image' invocation"
152
+ configvar CSI_PROW_KIND_IMAGES " kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
153
+ kindest/node:v1.20.7@sha256:e645428988191fc824529fd0bb5c94244c12401cf5f5ea3bd875eb0a787f0fe9
154
+ kindest/node:v1.19.11@sha256:7664f21f9cb6ba2264437de0eb3fe99f201db7a3ac72329547ec4373ba5f5911
155
+ kindest/node:v1.18.19@sha256:530378628c7c518503ade70b1df698b5de5585dcdba4f349328d986b8849b1ee
156
+ kindest/node:v1.17.17@sha256:c581fbf67f720f70aaabc74b44c2332cc753df262b6c0bca5d26338492470c17
157
+ kindest/node:v1.16.15@sha256:430c03034cd856c1f1415d3e37faf35a3ea9c5aaa2812117b79e6903d1fc9651
158
+ kindest/node:v1.15.12@sha256:8d575f056493c7778935dd855ded0e95c48cb2fab90825792e8fc9af61536bf9
159
+ kindest/node:v1.14.10@sha256:6033e04bcfca7c5f2a9c4ce77551e1abf385bcd2709932ec2f6a9c8c0aff6d4f" " kind images"
167
160
168
161
# By default, this script tests sidecars with the CSI hostpath driver,
169
162
# using the install_csi_driver function. That function depends on
@@ -305,10 +298,12 @@ tests_need_alpha_cluster () {
305
298
# in the e2e.test's normal YAML files.
306
299
#
307
300
# The default is to enable this for all jobs which use canary images
308
- # because we want to know whether our release candidates will pass all
309
- # existing tests (the storage testsuites and mock testing in
310
- # Kubernetes).
311
- configvar CSI_PROW_E2E_MOCK " $( if [ " ${CSI_PROW_DRIVER_CANARY} " = " canary" ]; then echo true ; else echo false ; fi) " " enable CSI mock volume tests"
301
+ # and the latest Kubernetes because those images will be used for mock
302
+ # testing once they are released. Using them for mock testing with
303
+ # older Kubernetes releases is too risky because the deployment files
304
+ # can be very old (for example, still using a removed -provisioner
305
+ # parameter in external-provisioner).
306
+ configvar CSI_PROW_E2E_MOCK " $( if [ " ${CSI_PROW_DRIVER_CANARY} " = " canary" ] && [ " ${CSI_PROW_KUBERNETES_VERSION} " = " latest" ]; then echo true ; else echo false ; fi) " " enable CSI mock volume tests"
312
307
313
308
# Regex for non-alpha, feature-tagged tests that should be run.
314
309
#
@@ -591,17 +586,12 @@ start_cluster () {
591
586
if [ " $version " = " latest" ]; then
592
587
version=master
593
588
fi
594
- if ${CSI_PROW_USE_BAZEL} ; then
595
- type=" bazel"
596
- else
597
- type=" docker"
598
- fi
599
589
git_clone https://github.com/kubernetes/kubernetes " ${CSI_PROW_WORK} /src/kubernetes" " $( version_to_git " $version " ) " || die " checking out Kubernetes $version failed"
600
590
601
591
go_version=" $( go_version_for_kubernetes " ${CSI_PROW_WORK} /src/kubernetes" " $version " ) " || die " cannot proceed without knowing Go version for Kubernetes"
602
592
# Changing into the Kubernetes source code directory is a workaround for https://github.com/kubernetes-sigs/kind/issues/1910
603
593
# shellcheck disable=SC2046
604
- (cd " ${CSI_PROW_WORK} /src/kubernetes" && run_with_go " $go_version " kind build node-image --image csiprow/node:latest $( if [ " $CSI_PROW_KIND_VERSION " != " main " ] ; then echo --type= " $type " ; fi ) --kube-root " ${CSI_PROW_WORK} /src/kubernetes" ) || die " 'kind build node-image' failed"
594
+ (cd " ${CSI_PROW_WORK} /src/kubernetes" && run_with_go " $go_version " kind build node-image --image csiprow/node:latest --kube-root " ${CSI_PROW_WORK} /src/kubernetes" ) || die " 'kind build node-image' failed"
605
595
csi_prow_kind_have_kubernetes=true
606
596
fi
607
597
image=" csiprow/node:latest"
@@ -654,24 +644,38 @@ delete_cluster_inside_prow_job() {
654
644
# Looks for the deployment as specified by CSI_PROW_DEPLOYMENT and CSI_PROW_KUBERNETES_VERSION
655
645
# in the given directory.
656
646
find_deployment () {
657
- local dir file
658
- dir= " $1 "
647
+ local dir= " $1 "
648
+ local file
659
649
660
- # Fixed deployment name? Use it if it exists, otherwise fail.
650
+ # major/minor without release- prefix.
651
+ local k8sver
652
+ # Ignore: See if you can use ${variable//search/replace} instead.
653
+ # shellcheck disable=SC2001
654
+ k8sver=" $( echo " ${CSI_PROW_KUBERNETES_VERSION} " | sed -e ' s/^release-//' -e ' s/\([0-9]*\)\.\([0-9]*\).*/\1.\2/' ) "
655
+
656
+ # Desired deployment, either specified completely, including version, or derived from other variables.
657
+ local deployment
658
+ deployment=${CSI_PROW_DEPLOYMENT:- kubernetes-${k8sver}${CSI_PROW_DEPLOYMENT_SUFFIX} }
659
+
660
+ # Fixed deployment name? Use it if it exists.
661
661
if [ " ${CSI_PROW_DEPLOYMENT} " ]; then
662
662
file=" $dir /${CSI_PROW_DEPLOYMENT} /deploy.sh"
663
- if ! [ -e " $file " ]; then
664
- return 1
663
+ if [ -e " $file " ]; then
664
+ echo " $file "
665
+ return 0
665
666
fi
666
- echo " $file "
667
- return 0
667
+
668
+ # CSI_PROW_DEPLOYMENT=kubernetes-x.yy must be mapped to kubernetes-latest
669
+ # as fallback. Same for kubernetes-distributed-x.yy.
668
670
fi
669
671
670
- # Ignore: See if you can use ${variable//search/replace} instead.
671
- # shellcheck disable=SC2001
672
- file=" $dir /kubernetes-$( echo " ${CSI_PROW_KUBERNETES_VERSION} " | sed -e ' s/\([0-9]*\)\.\([0-9]*\).*/\1.\2/' ) ${CSI_PROW_DEPLOYMENT_SUFFIX} /deploy.sh"
672
+ file=" $dir /${deployment} /deploy.sh"
673
673
if ! [ -e " $file " ]; then
674
- file=" $dir /kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX} /deploy.sh"
674
+ # Replace the first xx.yy number with "latest", for example
675
+ # kubernetes-1.21-test -> kubernetes-latest-test.
676
+ # Ignore: See if you can use ${variable//search/replace} instead.
677
+ # shellcheck disable=SC2001
678
+ file=" $dir /$( echo " $deployment " | sed -e ' s/[0-9][0-9]*\.[0-9][0-9]*/latest/' ) /deploy.sh"
675
679
if ! [ -e " $file " ]; then
676
680
return 1
677
681
fi
@@ -969,7 +973,7 @@ run_e2e () (
969
973
# the full Kubernetes E2E testsuite while only running a few tests.
970
974
move_junit () {
971
975
if ls " ${ARTIFACTS} " /junit_[0-9]* .xml 2> /dev/null > /dev/null; then
972
- run_filter_junit -t=" External Storage" -o " ${ARTIFACTS} /junit_${name} .xml" " ${ARTIFACTS} " /junit_[0-9]* .xml && rm -f " ${ARTIFACTS} " /junit_[0-9]* .xml
976
+ run_filter_junit -t=" External. Storage|CSI.mock.volume " -o " ${ARTIFACTS} /junit_${name} .xml" " ${ARTIFACTS} " /junit_[0-9]* .xml && rm -f " ${ARTIFACTS} " /junit_[0-9]* .xml
973
977
fi
974
978
}
975
979
trap move_junit EXIT
@@ -982,9 +986,17 @@ run_e2e () (
982
986
run_sanity () (
983
987
install_sanity || die " installing csi-sanity failed"
984
988
989
+ if [[ " ${CSI_PROW_SANITY_POD} " =~ " " ]]; then
990
+ # Contains spaces, more complex than a simple pod name.
991
+ # Evaluate as a shell command.
992
+ pod=$( eval " ${CSI_PROW_SANITY_POD} " ) || die " evaluation failed: CSI_PROW_SANITY_POD=${CSI_PROW_SANITY_POD} "
993
+ else
994
+ pod=" ${CSI_PROW_SANITY_POD} "
995
+ fi
996
+
985
997
cat > " ${CSI_PROW_WORK} /mkdir_in_pod.sh" << EOF
986
998
#!/bin/sh
987
- kubectl exec "${CSI_PROW_SANITY_POD} " -c "${CSI_PROW_SANITY_CONTAINER} " -- mkdir "\$ @" && echo "\$ @"
999
+ kubectl exec "$pod " -c "${CSI_PROW_SANITY_CONTAINER} " -- mkdir "\$ @" && echo "\$ @"
988
1000
EOF
989
1001
# Using "rm -rf" as fallback for "rmdir" is a workaround for:
990
1002
# Node Service
@@ -1009,8 +1021,8 @@ EOF
1009
1021
# why it happened.
1010
1022
cat > " ${CSI_PROW_WORK} /rmdir_in_pod.sh" << EOF
1011
1023
#!/bin/sh
1012
- if ! kubectl exec "${CSI_PROW_SANITY_POD} " -c "${CSI_PROW_SANITY_CONTAINER} " -- rmdir "\$ @"; then
1013
- kubectl exec "${CSI_PROW_SANITY_POD} " -c "${CSI_PROW_SANITY_CONTAINER} " -- rm -rf "\$ @"
1024
+ if ! kubectl exec "$pod " -c "${CSI_PROW_SANITY_CONTAINER} " -- rmdir "\$ @"; then
1025
+ kubectl exec "$pod " -c "${CSI_PROW_SANITY_CONTAINER} " -- rm -rf "\$ @"
1014
1026
exit 1
1015
1027
fi
1016
1028
EOF
@@ -1029,7 +1041,7 @@ else
1029
1041
fi
1030
1042
SCRIPT
1031
1043
)
1032
- kubectl exec "${CSI_PROW_SANITY_POD} " -c "${CSI_PROW_SANITY_CONTAINER} " -- /bin/sh -c "\$ {CHECK_PATH}"
1044
+ kubectl exec "$pod " -c "${CSI_PROW_SANITY_CONTAINER} " -- /bin/sh -c "\$ {CHECK_PATH}"
1033
1045
EOF
1034
1046
1035
1047
chmod u+x " ${CSI_PROW_WORK} " /* dir_in_pod.sh
0 commit comments