Skip to content

Commit 4317d51

Browse files
committed
use cluster/kubectl.sh for version check
Change-Id: I894291ff99929f9a4bf9ee295c7352749c6f7434
1 parent 97bbd2b commit 4317d51

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/k8s-integration/cluster.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ func getNormalizedVersion(kubeVersion, gkeVersion string) (string, error) {
312312

313313
}
314314

315-
func getKubeClusterVersion() (string, error) {
316-
out, err := exec.Command("kubectl", "version", "-o=json").CombinedOutput()
315+
func getKubeClusterVersion(k8sDir string) (string, error) {
316+
out, err := exec.Command(filepath.Join(k8sDir, "cluster", "kubectl.sh"), "version", "-o=json").CombinedOutput()
317317
if err != nil {
318318
return "", fmt.Errorf("failed to obtain cluster version, error: %v", err)
319319
}
@@ -331,8 +331,8 @@ func getKubeClusterVersion() (string, error) {
331331
return v.ServerVersion.GitVersion, nil
332332
}
333333

334-
func mustGetKubeClusterVersion() string {
335-
ver, err := getKubeClusterVersion()
334+
func mustGetKubeClusterVersion(k8sDir string) string {
335+
ver, err := getKubeClusterVersion(k8sDir)
336336
if err != nil {
337337
klog.Fatalf("Error: %v", err)
338338
}

test/k8s-integration/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func handle() error {
355355
// Kubernetes version of GKE deployments are expected to be of the pattern x.y.z-gke.k,
356356
// hence we use the main.Version utils to parse and compare GKE managed cluster versions.
357357
// For clusters deployed on GCE, use the apimachinery version utils (which supports non-gke based semantic versioning).
358-
clusterVersion := mustGetKubeClusterVersion()
358+
clusterVersion := mustGetKubeClusterVersion(k8sDir)
359359
var testSkip string
360360
switch *deploymentStrat {
361361
case "gce":

0 commit comments

Comments
 (0)