Documentation ¶
Index ¶
- func ModifyConfig(configAccess ConfigAccess, newConfig clientcmdapi.Config) error
- func NewCmdConfig(pathOptions *PathOptions, out io.Writer) *cobra.Command
- func NewCmdConfigSet(out io.Writer, configAccess ConfigAccess) *cobra.Command
- func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Command
- func NewCmdConfigSetCluster(out io.Writer, configAccess ConfigAccess) *cobra.Command
- func NewCmdConfigSetContext(out io.Writer, configAccess ConfigAccess) *cobra.Command
- func NewCmdConfigUnset(out io.Writer, configAccess ConfigAccess) *cobra.Command
- func NewCmdConfigUseContext(out io.Writer, configAccess ConfigAccess) *cobra.Command
- func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command
- type ConfigAccess
- type PathOptions
- func (o *PathOptions) GetDefaultFilename() string
- func (o *PathOptions) GetEnvVarFiles() []string
- func (o *PathOptions) GetExplicitFile() string
- func (o *PathOptions) GetLoadingPrecedence() []string
- func (o *PathOptions) GetStartingConfig() (*clientcmdapi.Config, error)
- func (o *PathOptions) IsExplicitFile() bool
- type ViewOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModifyConfig ¶ added in v0.17.1
func ModifyConfig(configAccess ConfigAccess, newConfig clientcmdapi.Config) error
ModifyConfig takes a Config object, iterates through Clusters, AuthInfos, and Contexts, uses the LocationOfOrigin if specified or uses the default destination file to write the results into. This results in multiple file reads, but it's very easy to follow. Preferences and CurrentContext should always be set in the default destination file. Since we can't distinguish between empty and missing values (no nil strings), we're forced have separate handling for them. In the kubeconfig cases, newConfig should have at most one difference, that means that this code will only write into a single file.
func NewCmdConfig ¶
func NewCmdConfig(pathOptions *PathOptions, out io.Writer) *cobra.Command
func NewCmdConfigSet ¶
func NewCmdConfigSet(out io.Writer, configAccess ConfigAccess) *cobra.Command
func NewCmdConfigSetAuthInfo ¶
func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Command
func NewCmdConfigSetCluster ¶
func NewCmdConfigSetCluster(out io.Writer, configAccess ConfigAccess) *cobra.Command
func NewCmdConfigSetContext ¶
func NewCmdConfigSetContext(out io.Writer, configAccess ConfigAccess) *cobra.Command
func NewCmdConfigUnset ¶
func NewCmdConfigUnset(out io.Writer, configAccess ConfigAccess) *cobra.Command
func NewCmdConfigUseContext ¶
func NewCmdConfigUseContext(out io.Writer, configAccess ConfigAccess) *cobra.Command
func NewCmdConfigView ¶
func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command
Types ¶
type ConfigAccess ¶ added in v0.17.1
type ConfigAccess interface { // GetLoadingPrecedence returns the slice of files that should be used for loading and inspecting the config GetLoadingPrecedence() []string // GetStartingConfig returns the config that subcommands should being operating against. It may or may not be merged depending on loading rules GetStartingConfig() (*clientcmdapi.Config, error) // GetDefaultFilename returns the name of the file you should write into (create if necessary), if you're trying to create a new stanza as opposed to updating an existing one. GetDefaultFilename() string // IsExplicitFile indicates whether or not this command is interested in exactly one file. This implementation only ever does that via a flag, but implementations that handle local, global, and flags may have more IsExplicitFile() bool // GetExplicitFile returns the particular file this command is operating against. This implementation only ever has one, but implementations that handle local, global, and flags may have more GetExplicitFile() string }
ConfigAccess is used by subcommands and methods in this package to load and modify the appropriate config files
type PathOptions ¶ added in v0.15.0
type PathOptions struct { // GlobalFile is the full path to the file to load as the global (final) option GlobalFile string // EnvVar is the env var name that points to the list of kubeconfig files to load EnvVar string // ExplicitFileFlag is the name of the flag to use for prompting for the kubeconfig file ExplicitFileFlag string // GlobalFileSubpath is an optional value used for displaying help GlobalFileSubpath string LoadingRules *clientcmd.ClientConfigLoadingRules }
func NewDefaultPathOptions ¶ added in v0.15.0
func NewDefaultPathOptions() *PathOptions
func (*PathOptions) GetDefaultFilename ¶ added in v0.15.0
func (o *PathOptions) GetDefaultFilename() string
func (*PathOptions) GetEnvVarFiles ¶ added in v0.17.1
func (o *PathOptions) GetEnvVarFiles() []string
func (*PathOptions) GetExplicitFile ¶ added in v0.15.0
func (o *PathOptions) GetExplicitFile() string
func (*PathOptions) GetLoadingPrecedence ¶ added in v0.17.1
func (o *PathOptions) GetLoadingPrecedence() []string
func (*PathOptions) GetStartingConfig ¶ added in v0.17.1
func (o *PathOptions) GetStartingConfig() (*clientcmdapi.Config, error)
func (*PathOptions) IsExplicitFile ¶ added in v0.15.0
func (o *PathOptions) IsExplicitFile() bool
type ViewOptions ¶ added in v0.17.1
type ViewOptions struct { ConfigAccess ConfigAccess Merge util.BoolFlag Flatten bool Minify bool RawByteData bool }
func (*ViewOptions) Complete ¶ added in v0.17.1
func (o *ViewOptions) Complete() bool
func (ViewOptions) Run ¶ added in v0.17.1
func (o ViewOptions) Run(out io.Writer, printer kubectl.ResourcePrinter) error
func (ViewOptions) Validate ¶ added in v0.17.1
func (o ViewOptions) Validate() error