cmd

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: Apache-2.0 Imports: 11 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: "Add named ports on GCP node pools",
		Long:  "Add named ports given by services annotations on GCP node pools",

		RunE: func(cmd *cobra.Command, args []string) error {
			conf := &config.KnpConfig{
				DryRun:     viper.GetBool("dry-run"),
				Logger:     klog.New(viper.GetString("log.level"), viper.GetString("log.server"), viper.GetString("log.output")),
				HealthPort: viper.GetInt("healthcheck-port"),
				ResyncIntv: time.Duration(viper.GetInt("resync-interval")) * time.Second,
				Cluster:    viper.GetString("cluster"),
				Zone:       viper.GetString("zone"),
				Project:    viper.GetString("project"),
			}
			if FakeCS {
				conf.ClientSet = config.FakeClientSet()
			}
			err := conf.Init(viper.GetString("api-server"), viper.GetString("kube-config"))
			if err != nil {
				return fmt.Errorf("Failed to initialize the configuration: %+v", err)
			}

			if conf.Cluster == "" {
				return fmt.Errorf("Cluster name must be specified")
			}

			run.Run(conf)
			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