Skip to content

Commit 6935995

Browse files
authored
Merge pull request #1090 from Sneha-at/update_sidecar
use full GKE version for feature support version comparison
2 parents 9b39767 + df7622d commit 6935995

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

test/e2e/run-e2e-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set -o errexit
2121

2222
readonly PKGDIR=$(realpath "$( dirname -- "$0"; )/../..")
2323
readonly gke_cluster_region=${GKE_CLUSTER_REGION:-us-central1}
24-
readonly gke_cluster_version=$(kubectl version | grep -Eo 'Server Version: v[0-9]+\.[0-9]+\.[0-9]+' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
24+
readonly gke_cluster_version=$(kubectl version 2>/dev/null | grep 'Server Version:' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-gke\.[0-9]+)?$')
2525
readonly gke_release_channel=${GKE_RELEASE_CHANNEL:-rapid}
2626
readonly use_gke_autopilot=${E2E_TEST_USE_GKE_AUTOPILOT:-false}
2727
readonly cloudsdk_api_endpoint_overrides_container=${CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER:-https://container.googleapis.com/}

test/e2e/utils/handler.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ func Handle(testParams *TestParameters) error {
150150
klog.Errorf("failed to cluster down: %v", err)
151151
}
152152
}()
153+
154+
// Fetch the cluster version.
155+
cmd := exec.Command("bash", "-c",
156+
fmt.Sprintf("gcloud container clusters describe %s --location %s --format=\"value(currentMasterVersion)\"",
157+
testParams.GkeClusterName,
158+
testParams.GkeClusterRegion))
159+
output, err = cmd.CombinedOutput()
160+
if err != nil {
161+
return fmt.Errorf("failed to get cluster version, output: %s, err: %w", string(output), err)
162+
}
163+
testParams.GkeClusterVersion = strings.TrimSpace(string(output))
164+
klog.Infof("GKE cluster version: %s", testParams.GkeClusterVersion)
153165
}
154166
// TODO(jaimebz): Extract server version using kubeapi if not present.
155167

0 commit comments

Comments
 (0)