getkubeconfig

pull/227/head
iwilltry42 5 years ago
parent 1f4b292c53
commit ecfe035895
  1. 9
      cmd/get/getKubeconfig.go
  2. 2
      go.mod

@ -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?
}

@ -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

Loading…
Cancel
Save