cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "releasemanager",
	Short: "Release Manager is a tool for importing and exporting Helm release state",
	Long: `
Release Manager provides functionality for exporting and importing the
state of Helm releases currently deployed to a Kubernetes cluster. The state
of the installed releases is saved to a configurable backend for easy
restoration of previously-deployed releases or for simplified re-deployment of
those releases to a new Kubernetes cluster.

Release Manager operations can be run locally or within the Kubernetes cluster.
The application also supports a daemon mode that will periodically update the
saved state.

To export releases, Release Manager queries  the target Kubernetes cluster to collect metadata for all
releases currently deployed in the source cluster and writes this metadata to
the configured backend data store. If the Release Manager is deployed in
daemon mode via its own Helm chart, it will also store metadata about itself.
This metadata is used to prevent import operations from creating a new Release
Manager with the same configuration as the previous managed, causing both
instances to write conflicting state to the backend.

To import releases, Release Manager retrieves the state stored in the backend,
connects to the target Kubernetes cluster, and deploys the saved
releases to the cluster.

Release Manager will use --kubeconfig/--kubecontext, $KUBECONFIG, or
~/.kube/config to establish a connection to the Kubernetes cluster. If none of
these configuration are set, an in-cluster connection will be attempted. All
actions will be performed against the current cluster and a given command will
only perform actions against a single cluster, i.e. 'export' will
export releases from the configured cluster while 'import' will deploy releases
to the configured cluster and 'clear' requires no custer connection whatsoever.
`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		rlsmgrconfig.DebugMode = viper.GetBool("debug")
		rlsmgrconfig.DryRun = viper.GetBool("dryRun")
		rlsmgrconfig.VerboseMode = viper.GetBool("verbose")
		rlsmgrconfig.Backend = &config.BackendConfig{
			StoragePath: viper.GetString("path"),
		}

		kubeConfig = viper.GetString("kubeconfig")
		if kubeConfig == "" && os.Getenv(constants.EnvKubeConfig) != "" {
			kubeConfig = os.Getenv(constants.EnvKubeConfig)
		}

		rlsmgrconfig.ClusterConfig = &config.ClusterConfig{
			KubeConfig:  kubeConfig,
			KubeContext: viper.GetString("kubecontext"),
		}
		if rlsmgrconfig.DebugMode {
			log.SetLevel(log.DebugLevel)
		} else {
			log.SetLevel(log.WarnLevel)
		}
		if rlsmgrconfig.DryRun {
			fmt.Println("Dry run. No changes will be made.")
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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