From 836201611b9adec66df1ce3fd377ff0613c4cca6 Mon Sep 17 00:00:00 2001 From: Xavier Hurst Date: Wed, 9 Oct 2019 21:43:51 +0200 Subject: [PATCH] Enable --all for get-kubeconfig --- cli/commands.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cli/commands.go b/cli/commands.go index 40227456..b24f4a9e 100644 --- a/cli/commands.go +++ b/cli/commands.go @@ -365,14 +365,22 @@ func ListClusters(c *cli.Context) error { // GetKubeConfig grabs the kubeconfig from the running cluster and prints the path to stdout func GetKubeConfig(c *cli.Context) error { - cluster := c.String("name") - kubeConfigPath, err := getKubeConfig(cluster) + clusters, err := getClusters(c.Bool("all"), c.String("name")) if err != nil { return err } - // output kubeconfig file path to stdout - fmt.Println(kubeConfigPath) + for _, cluster := range clusters { + kubeConfigPath, err := getKubeConfig(cluster.name) + if err != nil { + log.Println(err) + continue + } + + // output kubeconfig file path to stdout + fmt.Println(kubeConfigPath) + } + return nil }