cli

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 35 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AcceptedLicenseVersions = "license.acceptedVersions"
	IncognitoMode           = "incognito.enabled"
)
View Source
const (
	// TODO Deprecated after 1.1.1, to be removed in v1.3.0(?) or v2.0.0
	NamespaceDeprecated = "backyards.namespaceDeprecated"

	Namespace        = "backyards.namespace"
	URL              = "backyards.url"
	CACert           = "backyards.cacert"
	Token            = "backyards.token"
	TrackingClientID = "backyards.trackingClientId"
	LicenseAccepted  = "backyards.licenseAccepted"
	UsePortForward   = "backyards.usePortForward"
	LocalPort        = "backyards.localPort"
)
View Source
const (
	PersistentConfigKey = "persistentConfig"
)

Variables

View Source
var (
	IGWPort                = 80
	IGWPortWithPortforward = 8080
	IGWMatchLabels         = map[string]string{
		"app.kubernetes.io/component": "ingressgateway",
		"app.kubernetes.io/instance":  "backyards",
	}
	BackyardsServiceAccountName = "backyards"
	BackyardsIngressServiceName = "backyards-ingressgateway"
)
View Source
var Log = log.Log
View Source
var PersistentGlobalSettings = Settings{
	AcceptedLicenseVersions: {
		Kind: reflect.Slice,
	},
	IncognitoMode: {
		Kind:    reflect.Bool,
		Default: "false",
	},
}
View Source
var PersistentSettings = Settings{
	NamespaceDeprecated: {
		Flag:                "namespace",
		Default:             "backyards-system",
		Description:         "Namespace in which Backyards is installed [$BACKYARDS_NAMESPACE]",
		Shorthand:           "n",
		Kind:                reflect.String,
		Env:                 "BACKYARDS_NAMESPACE",
		Deprecated:          "please use --backyards-namespace instead",
		ShorthandDeprecated: "please use --backyards-namespace instead",
	},
	Namespace: {
		Flag:        "backyards-namespace",
		Default:     "backyards-system",
		Description: "Namespace in which Backyards is installed [$BACKYARDS_NAMESPACE]",
		Kind:        reflect.String,
		Env:         "BACKYARDS_NAMESPACE",
	},
	URL: {
		Flag:        "base-url",
		Description: "Custom Backyards base URL (uses port forwarding or proxying if empty)",
		Kind:        reflect.String,
	},
	CACert: {
		Flag:        "cacert",
		Description: "The CA to use for verifying Backyards' server certificate",
		Kind:        reflect.String,
	},
	Token: {
		Flag:        "token",
		Description: "Authentication token to use to communicate with Backyards",
		Kind:        reflect.String,
	},
	TrackingClientID: {
		Description: "Google Analytics tracking client ID",
		Kind:        reflect.String,
	},
	LicenseAccepted: {
		Description: "Accept the Backyards proprietary license",
		Kind:        reflect.Bool,
	},
	UsePortForward: {
		Description: "Use port forwarding instead of proxying to reach Backyards",
		Flag:        "use-portforward",
		Default:     "false",
		Kind:        reflect.Bool,
	},
	LocalPort: {
		Description: "Use this local port for port forwarding / proxying to Backyards (when set to 0, a random port will be used)",
		Shorthand:   "p",
		Flag:        "local-port",
		Default:     "-1",
		Kind:        reflect.Int,
	},
}

Functions

This section is empty.

Types

type CLI

type CLI interface {
	Out() io.Writer
	OutputFormat() string
	Color() bool
	Interactive() bool
	InteractiveTerminal() bool
	GetRootCommand() *cobra.Command
	GetK8sClient() (k8sclient.Client, error)
	GetK8sConfig() (*rest.Config, error)
	GetK8sManager() (k8sclient.Manager, error)
	GetK8sManagerForConfig(*rest.Config) (k8sclient.Manager, error)

	GetPersistentConfig() PersistentConfig
	GetPersistentGlobalConfig() PersistentGlobalConfig
	GetToken() string

	LabelManager() k8s.LabelManager

	Logger() log.Logger
	DumpK8sResources(objects []runtime.Object) error

	// An endpoint can be currently:
	// - external HTTP(s) endpoint
	// - local port-forward to an HTTP(s) endpoint (deprecated)
	// - local HTTP(s) proxy
	InitializedEndpoint() (endpoint.Endpoint, error)
	PersistentEndpoint() (endpoint.Endpoint, error)

	Initialize() error

	IfConfirmed(string, bool, func() error) error
}

func NewCli

func NewCli(out io.Writer, log log.Logger, rootCmd *cobra.Command) CLI

type PersistentConfig

type PersistentConfig interface {
	Namespace() string
	BaseURL() string
	CACert() string
	LocalPort() int
	UsePortForward() bool
	TrackingClientID() string
	Token() string

	SetTrackingClientID(string)
	SetToken(string)

	PersistConfig() error

	GetConfigFileUsed() string
}

type PersistentGlobalConfig

type PersistentGlobalConfig interface {
	LicenseAcceptedForVersion(string) bool
	SetLicenseAcceptedForVersion(string)
	IncognitoMode() bool
	PersistConfig() error
}

type Setting

type Setting struct {
	Flag                string
	Default             string
	Description         string
	Shorthand           string
	Kind                reflect.Kind
	Env                 string
	Deprecated          string
	ShorthandDeprecated string
}

type Settings

type Settings map[string]Setting

func (Settings) Bind

func (i Settings) Bind(viper *viper.Viper, flags *flag.FlagSet)

func (Settings) Configure

func (i Settings) Configure(flags *flag.FlagSet)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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