cmd

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// FakeCS uses the client-go testing clientset
	FakeCS bool

	// RootCmd represents the base command when called without any subcommands
	RootCmd = &cobra.Command{
		Use:   appName,
		Short: "Notify deployments",
		Long:  "Notify deployments",

		RunE: func(cmd *cobra.Command, args []string) error {
			conf := &config.KdnConfig{
				DryRun:     viper.GetBool("dry-run"),
				Logger:     klog.New(viper.GetString("log.level"), viper.GetString("log.server"), viper.GetString("log.output")),
				Endpoint:   viper.GetString("endpoint"),
				TokenHdr:   viper.GetString("token-header"),
				TokenVal:   viper.GetString("token-value"),
				Filter:     viper.GetString("filter"),
				HealthPort: viper.GetInt("healthcheck-port"),
				ResyncIntv: time.Duration(viper.GetInt("resync-interval")) * time.Second,
			}
			if FakeCS {
				conf.ClientSet = config.FakeClientSet()
			}
			err := conf.Init(
				viper.GetString("api-server"),
				viper.GetString("context"),
				viper.GetString("kube-config"),
			)
			if err != nil {
				return fmt.Errorf("Failed to initialize the configuration: %+v", err)
			}
			run.Run(conf, notifiers.Init(notifiers.Backends))
			return nil
		},
	}
)

Functions

func Execute

func Execute() error

Execute adds all child commands to the root command and sets their flags.

Types

This section is empty.

Jump to

Keyboard shortcuts

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