getkubeconfig
This commit is contained in:
parent
1f4b292c53
commit
ecfe035895
@ -24,6 +24,7 @@ package get
|
|||||||
import (
|
import (
|
||||||
"github.com/rancher/k3d/pkg/cluster"
|
"github.com/rancher/k3d/pkg/cluster"
|
||||||
"github.com/rancher/k3d/pkg/runtimes"
|
"github.com/rancher/k3d/pkg/runtimes"
|
||||||
|
k3d "github.com/rancher/k3d/pkg/types"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -39,8 +40,8 @@ func NewCmdGetKubeconfig() *cobra.Command {
|
|||||||
Long: `Get kubeconfig.`,
|
Long: `Get kubeconfig.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
log.Debugln("get kubeconfig called")
|
log.Debugln("get kubeconfig called")
|
||||||
rt := parseGetKubeconfigCmd(cmd, args)
|
rt, c := parseGetKubeconfigCmd(cmd, args)
|
||||||
cluster.GetKubeConfig()
|
cluster.GetKubeconfig(rt, c)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ func NewCmdGetKubeconfig() *cobra.Command {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) runtimes.Runtime {
|
func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) (runtimes.Runtime, *k3d.Cluster) {
|
||||||
// --runtime
|
// --runtime
|
||||||
rt, err := cmd.Flags().GetString("runtime")
|
rt, err := cmd.Flags().GetString("runtime")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -60,5 +61,5 @@ func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) runtimes.Runtime {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
return runtime
|
return runtime, &k3d.Cluster{Name: args[0]} // TODO: validate first?
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -41,3 +41,5 @@ require (
|
|||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
replace github.com/rancher/k3d => /home/thklein/Go/src/github.com/rancher/k3d
|
||||||
|
Loading…
Reference in New Issue
Block a user