Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cli.Command{ Name: "import", Usage: "import given kubeconfig on stdin to your configuration", Flags: []cli.Flag{ &cli.StringFlag{ Name: "kubeconfig", Usage: "path to the dest. kubeconfig where context is imported", }, &cli.StringFlag{ Name: "as", Usage: "import context, user and cluster AS. this option rename the imported context (only if it's one)", }, &cli.BoolFlag{ Name: "base64", Usage: "if your input is base64 decoded kubeconfig", }, }, Action: func(cCtx *cli.Context) error { kc, err := kconf.Open(cCtx.String("kubeconfig")) if err != nil { return err } data, err := io.ReadAll(os.Stdin) if err != nil { return err } var sourceCfg *kconf.KubeConfig if cCtx.Bool("base64") { sourceCfg, err = kconf.OpenBase64(data) } else { sourceCfg, err = kconf.OpenData(data) } if err != nil { return err } opts := kconf.ImportOptions{As: cCtx.String("as")} kc.Import(sourceCfg, &opts) err = kc.Save() if err != nil { return err } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.