From 2b5b2e0ff77608cfdfc8a949076860672b38b93f Mon Sep 17 00:00:00 2001 From: Pawel Wieczorek Date: Tue, 6 Aug 2019 16:04:53 +0200 Subject: k8s: Add support for RKE-deployed clusters RKE is used as a Kubernetes cluster deployment method from ONAP Dublin release. RKE cluster definition is used to get access to necessary information. Issue-ID: SECCOM-235 Change-Id: I588598011ea746b5f7ba327a48f1cea605e56d31 Signed-off-by: Pawel Wieczorek --- test/security/k8s/src/check/cmd/check/check.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'test/security/k8s/src/check/cmd') diff --git a/test/security/k8s/src/check/cmd/check/check.go b/test/security/k8s/src/check/cmd/check/check.go index c4dd39870..3c005f77c 100644 --- a/test/security/k8s/src/check/cmd/check/check.go +++ b/test/security/k8s/src/check/cmd/check/check.go @@ -5,12 +5,35 @@ import ( "log" "check/rancher" + "check/raw" "check/validators/master" ) +var ( + ranchercli = flag.Bool("ranchercli", false, "use rancher utility for accessing cluster nodes") + rke = flag.Bool("rke", true, "use RKE cluster definition and ssh for accessing cluster nodes (default)") +) + func main() { flag.Parse() - k8sParams, err := rancher.GetK8sParams() + if *ranchercli && *rke { + log.Fatal("Not supported.") + } + + var ( + k8sParams []string + err error + ) + + switch { + case *ranchercli: + k8sParams, err = rancher.GetK8sParams() + case *rke: + k8sParams, err = raw.GetK8sParams() + default: + log.Fatal("Missing cluster access method.") + } + if err != nil { log.Fatal(err) } -- cgit 1.2.3-korg