From ecfe035895e36b6cfec07db76dd2fc178de11fb5 Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Thu, 24 Oct 2019 14:01:46 +0200 Subject: [PATCH] getkubeconfig --- cmd/get/getKubeconfig.go | 9 +++++---- go.mod | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/get/getKubeconfig.go b/cmd/get/getKubeconfig.go index f3dff617..08e9103c 100644 --- a/cmd/get/getKubeconfig.go +++ b/cmd/get/getKubeconfig.go @@ -24,6 +24,7 @@ package get import ( "github.com/rancher/k3d/pkg/cluster" "github.com/rancher/k3d/pkg/runtimes" + k3d "github.com/rancher/k3d/pkg/types" "github.com/spf13/cobra" log "github.com/sirupsen/logrus" @@ -39,8 +40,8 @@ func NewCmdGetKubeconfig() *cobra.Command { Long: `Get kubeconfig.`, Run: func(cmd *cobra.Command, args []string) { log.Debugln("get kubeconfig called") - rt := parseGetKubeconfigCmd(cmd, args) - cluster.GetKubeConfig() + rt, c := parseGetKubeconfigCmd(cmd, args) + cluster.GetKubeconfig(rt, c) }, } @@ -50,7 +51,7 @@ func NewCmdGetKubeconfig() *cobra.Command { return cmd } -func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) runtimes.Runtime { +func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) (runtimes.Runtime, *k3d.Cluster) { // --runtime rt, err := cmd.Flags().GetString("runtime") if err != nil { @@ -60,5 +61,5 @@ func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) runtimes.Runtime { if err != nil { log.Fatalln(err) } - return runtime + return runtime, &k3d.Cluster{Name: args[0]} // TODO: validate first? } diff --git a/go.mod b/go.mod index 18e0005b..0b2c66db 100644 --- a/go.mod +++ b/go.mod @@ -41,3 +41,5 @@ require ( gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gotest.tools v2.2.0+incompatible // indirect ) + +replace github.com/rancher/k3d => /home/thklein/Go/src/github.com/rancher/k3d