export

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:      "export",
	Usage:     "export context with user and cluster from your configuration",
	ArgsUsage: "[contextName]",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "kubeconfig",
			Usage: "path to the kubeconfig file from where context is exported",
		},
		&cli.StringFlag{
			Name:  "as",
			Usage: "export context, user and cluster AS. this option rename the imported context (only if it's one)",
		},
	},

	Action: func(cCtx *cli.Context) error {
		contextName := cCtx.Args().First()

		kc, err := kconf.Open(cCtx.String("kubeconfig"))
		if err != nil {
			return err
		}

		opts := kconf.ExportOptions{
			As: cCtx.String("as"),
		}

		exportedCfg, err := kc.Export(contextName, &opts)
		if err != nil {
			return err
		}

		exportedCfg.WriteTo(os.Stdout)
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL