Skip to content

Commit 8f21166

Browse files
committed
e2e test should take GKE node version as an input
For GKE clusters, node-version flag can be provided during cluster creation to specify worker node k8s version. This change is needed to test node and master version skew combinations.
1 parent c949b4f commit 8f21166

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

test/k8s-integration/cluster.go

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, imageType string, use
167167
cmdParams = append(cmdParams, "--enable-autorepair")
168168
}
169169

170+
if isVariableSet(gkeNodeVersion) {
171+
cmdParams = append(cmdParams, "--node-version", *gkeNodeVersion)
172+
}
173+
170174
if useManagedDriver {
171175
// PD CSI Driver add on is enabled only in gcloud beta.
172176
cmdParams = append([]string{"beta"}, cmdParams...)

test/k8s-integration/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var (
4848
imageType = flag.String("image-type", "cos", "the image type to use for the cluster")
4949
gkeReleaseChannel = flag.String("gke-release-channel", "", "GKE release channel to be used for cluster deploy. One of 'rapid', 'stable' or 'regular'")
5050
gkeTestClusterName = flag.String("gke-cluster-name", "gcp-pd-csi-driver-test-cluster", "GKE cluster name")
51+
gkeNodeVersion = flag.String("gke-node-version", "", "GKE cluster worker node version")
5152

5253
// Test infrastructure flags
5354
boskosResourceType = flag.String("boskos-resource-type", "gce-project", "name of the boskos resource type to reserve")

test/run-k8s-integration-ci.sh

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ readonly image_type=${IMAGE_TYPE:-cos}
2323
readonly use_gke_managed_driver=${USE_GKE_MANAGED_DRIVER:-false}
2424
readonly gke_release_channel=${GKE_RELEASE_CHANNEL:-""}
2525
readonly teardown_driver=${GCE_PD_TEARDOWN_DRIVER:-true}
26+
readonly gke_node_version=${GKE_NODE_VERSION:-}
2627

2728
export GCE_PD_VERBOSITY=9
2829

@@ -57,4 +58,8 @@ else
5758
base_cmd="${base_cmd} --gce-region=${gce_region}"
5859
fi
5960

61+
if [ -z "$gke_node_version" ]; then
62+
base_cmd="${base_cmd} --gke-node-version=${gke_node_version}"
63+
fi
64+
6065
eval "$base_cmd"

test/run-k8s-integration-local.sh

+18
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@ make -C "${PKGDIR}" test-k8s-integration
7373
# --gce-zone="us-central1-c" --num-nodes=${NUM_NODES:-3} --gke-release-channel="rapid" --deployment-strategy="gke" \
7474
# --use-gke-managed-driver=true --teardown-cluster=true
7575

76+
# This version of the command brings up (and subsequently tears down) a GKE
77+
# cluster using a release channel, and a given worker node version and with managed GCE PersistentDisk CSI driver add-on enabled, and points to
78+
# the local K8s repository to get the e2e test binary.
79+
# ${PKGDIR}/bin/k8s-integration-test --run-in-prow=false --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
80+
# --test-focus="External.Storage.*snapshot" --local-k8s-dir=$KTOP --storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml \
81+
# --snapshotclass-file=pd-volumesnapshotclass.yaml --do-driver-build=false --teardown-driver=false \
82+
# --gce-zone="us-central1-c" --num-nodes=${NUM_NODES:-3} --gke-release-channel="rapid" --deployment-strategy="gke" \
83+
# --use-gke-managed-driver=true --teardown-cluster=true --node-version="1.16"
84+
85+
# This version of the command brings up (and subsequently tears down) a GKE
86+
# cluster with managed GCE PersistentDisk CSI driver add-on enabled, and points to
87+
# the local K8s repository to get the e2e test binary.
88+
# ${PKGDIR}/bin/k8s-integration-test --run-in-prow=false --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
89+
# --test-focus="External.Storage.sc-balanced" --local-k8s-dir=$KTOP --storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml \
90+
# --snapshotclass-file=pd-volumesnapshotclass.yaml --do-driver-build=false --teardown-driver=false \
91+
# --gce-zone="us-central1-c" --num-nodes=${NUM_NODES:-3} --gke-cluster-version="latest" --deployment-strategy="gke" \
92+
# --use-gke-managed-driver=true --teardown-cluster=true --gke-node-version="1.16"
93+
7694
# This version of the command does not build the driver or K8s, points to a
7795
# local K8s repo to get the e2e.test binary, and does not bring up or down the cluster
7896

test/run-k8s-integration.sh

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ readonly image_type=${IMAGE_TYPE:-cos}
2323
readonly use_gke_managed_driver=${USE_GKE_MANAGED_DRIVER:-false}
2424
readonly gke_release_channel=${GKE_RELEASE_CHANNEL:-""}
2525
readonly teardown_driver=${GCE_PD_TEARDOWN_DRIVER:-true}
26+
readonly gke_node_version=${GKE_NODE_VERSION:-}
2627

2728
export GCE_PD_VERBOSITY=9
2829

@@ -57,4 +58,7 @@ else
5758
base_cmd="${base_cmd} --gce-region=${gce_region}"
5859
fi
5960

61+
if [ -z "$gke_node_version" ]; then
62+
base_cmd="${base_cmd} --gke-node-version=${gke_node_version}"
63+
fi
6064
eval "$base_cmd"

0 commit comments

Comments
 (0)