cmd

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AnnotationGcTag annotation that triggers
	// garbage collection. Objects with value equal to
	// command-line flag that are *not* in config will be deleted.
	AnnotationGcTag = "kubecfg.ksonnet.io/garbage-collect-tag"

	// AnnotationGcStrategy controls gc logic.  Current values:
	// `auto` (default if absent) - do garbage collection
	// `ignore` - never garbage collect this object
	AnnotationGcStrategy = "kubecfg.ksonnet.io/garbage-collect-strategy"

	// GcStrategyAuto is the default automatic gc logic
	GcStrategyAuto = "auto"
	// GcStrategyIgnore means this object should be ignored by garbage collection
	GcStrategyIgnore = "ignore"
)

Variables

View Source
var APImachineryVersion = ""
View Source
var RootCmd = &cobra.Command{
	Use:   "ks",
	Short: `Configure your application to deploy to a Kubernetes cluster`,
	Long: `
You can use the ` + "`ks`" + ` commands to write, share, and deploy your Kubernetes
application configuration to remote clusters.

----
`,
	SilenceErrors: true,
	SilenceUsage:  true,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		goflag.CommandLine.Parse([]string{})
		flags := cmd.Flags()
		out := cmd.OutOrStderr()
		log.SetOutput(out)

		logFmt := NewLogFormatter(out)
		log.SetFormatter(logFmt)

		verbosity, err := flags.GetCount(flagVerbose)
		if err != nil {
			return err
		}
		log.SetLevel(logLevel(verbosity))

		return nil
	},
	Args: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {
			return cobra.NoArgs(cmd, args)
		}

		pluginName := args[0]
		_, err := plugin.Find(appFs, pluginName)
		if err != nil {
			return cobra.NoArgs(cmd, args)
		}

		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {
			return cmd.Help()
		}
		pluginName, args := args[0], args[1:]
		p, err := plugin.Find(appFs, pluginName)
		if err != nil {
			return err
		}

		return runPlugin(p, args)
	},
}

RootCmd is the root of cobra subcommand tree

View Source
var Version = "(dev build)"

Version is overridden by main

Functions

func NewLogFormatter

func NewLogFormatter(out io.Writer) log.Formatter

NewLogFormatter creates a new log.Formatter customised for writer

Types

This section is empty.

Jump to

Keyboard shortcuts

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