cmdutils

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const IncompatibleFlags = "cannot be used at the same time"

IncompatibleFlags is a common substring of an error message

Variables

This section is empty.

Functions

func AddClusterFlag

func AddClusterFlag(fs *pflag.FlagSet, clusterConfig *api.ClusterConfig)

AddClusterFlag adds a common --cluster flag for cluster name. Use this for commands whose principal resource is *not* a cluster.

func AddCommonFlagsForFlux

func AddCommonFlagsForFlux(fs *pflag.FlagSet, opts *InstallOpts)

AddCommonFlagsForFlux configures the flags required to install Flux on a cluster and have it point to the specified Git repository.

func AddCommonFlagsForGit

func AddCommonFlagsForGit(fs *pflag.FlagSet, opts *git.Options)

AddCommonFlagsForGit configures the flags required to interact with a Git repository.

func AddCommonFlagsForKubeconfig

func AddCommonFlagsForKubeconfig(fs *pflag.FlagSet, outputPath, authenticatorRoleARN *string, setContext, autoPath *bool, exampleName string)

AddCommonFlagsForKubeconfig adds common flags for controlling how output kubeconfig is written

func AddCommonFlagsForKubernetes

func AddCommonFlagsForKubernetes(fs *pflag.FlagSet, opts *KubernetesOpts, defaultNamespace string)

AddCommonFlagsForKubernetes configures the flags required to interact with Kubernetes cluster

func AddCommonFlagsForProfile

func AddCommonFlagsForProfile(fs *pflag.FlagSet, opts *profile.Options)

AddCommonFlagsForProfile configures the flags required to enable a profile.

func AddConfigFileFlag

func AddConfigFileFlag(fs *pflag.FlagSet, path *string)

AddConfigFileFlag adds common --config-file flag

func AddLoadBalancerIPFlag

func AddLoadBalancerIPFlag(fs *pflag.FlagSet, clusterConfig *api.ClusterConfig)

AddLoadBalancerIPFlag adds a common --load-balancer-ip flag for load balancer ip.

func AddLoadBalancerResourceGroupFlag

func AddLoadBalancerResourceGroupFlag(fs *pflag.FlagSet, clusterConfig *api.ClusterConfig)

AddLoadBalancerResourceGroupFlag adds a common --load-balancer-ip-rg flag for load balancer ip resource group.

func AddLocationFlag

func AddLocationFlag(fs *pflag.FlagSet, p *api.ClusterConfig)

AddLocationFlag adds common --location flag

func AddResourceCmd

func AddResourceCmd(flagGrouping *FlagGrouping, parentVerbCmd *cobra.Command, newCmd func(*Cmd))

AddResourceCmd create a registers a new command under the given verb command

func AddVersionFlag

func AddVersionFlag(fs *pflag.FlagSet, meta *api.ClusterConfig, extraUsageInfo string)

AddVersionFlag adds common --version flag

func AddWaitFlag

func AddWaitFlag(fs *pflag.FlagSet, wait *bool, description string)

AddWaitFlag adds common --wait flag

func AddWaitFlagWithFullDescription

func AddWaitFlagWithFullDescription(fs *pflag.FlagSet, wait *bool, description string)

AddWaitFlagWithFullDescription adds common --wait flag

func ClusterNameFlag

func ClusterNameFlag(cmd *Cmd) string

ClusterNameFlag returns the flag to use for the cluster name taking the principal resource into account.

func ErrCannotUseWithConfigFile

func ErrCannotUseWithConfigFile(what string) error

ErrCannotUseWithConfigFile is a common error message

func ErrClusterFlagAndArg

func ErrClusterFlagAndArg(cmd *Cmd, nameFlag, nameArg string) error

ErrClusterFlagAndArg wraps ErrFlagAndArg() by passing in the proper flag name.

func ErrFlagAndArg

func ErrFlagAndArg(kind, flag, arg string) error

ErrFlagAndArg may be used to err for options that can be given as flags /and/ arg but only one is allowed to be used.

func ErrMustBeSet

func ErrMustBeSet(pathOrFlag string) error

ErrMustBeSet is a common error message

func ErrUnsupportedNameArg

func ErrUnsupportedNameArg() error

ErrUnsupportedNameArg reports unsupported usage of `name` argument

func GetNameArg

func GetNameArg(args []string) string

GetNameArg tests to ensure there is only 1 name argument

func LoadConfigFromFile

func LoadConfigFromFile(configFile string) (*api.ClusterConfig, error)

LoadConfigFromFile loads ClusterConfig from configFile

func ValidateGitOptions

func ValidateGitOptions(opts *git.Options) error

ValidateGitOptions validates the provided Git options.

Types

type ClusterConfigLoader

type ClusterConfigLoader interface {
	Load() error
}

ClusterConfigLoader is an interface that loaders should implement

func NewGitOpsConfigLoader

func NewGitOpsConfigLoader(cmd *Cmd) ClusterConfigLoader

NewGitOpsConfigLoader creates a new ClusterConfigLoader which handles loading of ClusterConfigFile v.s. using CLI flags for GitOps-related commands.

func NewMetadataLoader

func NewMetadataLoader(cmd *Cmd) ClusterConfigLoader

NewMetadataLoader handles loading of clusterConfigFile vs using flags for all commands that require only metadata fields, e.g. `eksctl delete cluster` or `eksctl utils update-kube-proxy` and other similar commands that do simple operations against existing clusters

type Cmd

type Cmd struct {
	CobraCommand *cobra.Command
	FlagSetGroup *NamedFlagSetGroup

	Validate bool

	NameArg           string
	ClusterConfigFile string

	ClusterConfig *api.ClusterConfig
}

Cmd hold common attributes between commands

func (*Cmd) NewCtl

func (c *Cmd) NewCtl() error

NewCtl validates

type FlagGrouping

type FlagGrouping struct {
	// contains filtered or unexported fields
}

FlagGrouping holds a superset of all flagsets for all commands

func NewGrouping

func NewGrouping() *FlagGrouping

NewGrouping creates an instance of Grouping

func (*FlagGrouping) New

New creates a new group of flagsets for use with a subcommand

func (*FlagGrouping) Usage

func (g *FlagGrouping) Usage(cmd *cobra.Command) error

Usage is for use with (*cobra.Command).SetUsageFunc

type InstallOpts

type InstallOpts struct {
	GitOptions               git.Options
	GitPaths                 []string
	GitLabel                 string
	GitFluxPath              string
	WithHelm                 bool
	HelmVersions             []string
	ManifestGeneration       bool
	GarbageCollection        bool
	AcrRegistry              bool
	OverrideValues           bool
	FluxChartVersion         string
	HelmOperatorChartVersion string
	SkipInstall              bool
	KubernetesOpts           KubernetesOpts
}

InstallOpts are the installation options for Flux

type KubernetesOpts

type KubernetesOpts struct {
	KubeConfig  string
	KubeContext string
	Namespace   string
}

KubernetesOpts common kubernetes opts

type NamedFlagSetGroup

type NamedFlagSetGroup struct {
	// contains filtered or unexported fields
}

NamedFlagSetGroup holds a single group of flagsets

func (*NamedFlagSetGroup) AddTo

func (n *NamedFlagSetGroup) AddTo(cmd *cobra.Command)

AddTo mixes all flagsets in the given group into another flagset

func (*NamedFlagSetGroup) InFlagSet

func (n *NamedFlagSetGroup) InFlagSet(name string, cb func(*pflag.FlagSet))

InFlagSet returns new or existing named FlagSet in a group

Jump to

Keyboard shortcuts

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