From 39d94df81b78df8fec427e4b487455f4977892c5 Mon Sep 17 00:00:00 2001
From: Jeppe Fihl-Pearson <jeppe@memrise.com>
Date: Fri, 11 May 2018 18:58:24 +0100
Subject: [PATCH] Add tip about the `--version` flag to error output

If people are trying to use the Docker image to check their cluster, there's a
big likelyhood of them hitting the error message saying that either `kubectl`
or `kubelet` need to be found in order for `kube-bench` to be able to determine
the Kubernetes version in use.

This adds a tip that the version can be specified manually with the `--version`
flag which is a lot easier than having to make a new Docker image with the
right version of `kubelet`/`kubectl` in order for `kube-bench` to work.
---
 cmd/util.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/util.go b/cmd/util.go
index 7b8e9de..ab78945 100644
--- a/cmd/util.go
+++ b/cmd/util.go
@@ -219,7 +219,7 @@ func getKubeVersion() string {
 	if err != nil {
 		_, err = exec.LookPath("kubelet")
 		if err != nil {
-			exitWithError(fmt.Errorf("Version check failed: need kubectl or kubelet binaries to get kubernetes version"))
+			exitWithError(fmt.Errorf("Version check failed: need kubectl or kubelet binaries to get kubernetes version.\nAlternately, you can specify the version with --version"))
 		}
 		return getKubeVersionFromKubelet()
 	}
@@ -240,7 +240,7 @@ func getKubeVersionFromKubectl() string {
 func getKubeVersionFromKubelet() string {
 	cmd := exec.Command("kubelet", "--version")
 	out, err := cmd.CombinedOutput()
-	
+
 	if err != nil {
 		continueWithError(fmt.Errorf("%s", out), "")
 	}
-- 
GitLab