Documentation ¶
Overview ¶
Example (View) ¶
expectedConfig := newRedFederalCowHammerConfig() test := configCommandTest{ args: []string{"view"}, startingConfig: newRedFederalCowHammerConfig(), expectedConfig: expectedConfig, } output := test.run(nil) fmt.Printf("%v", output)
Output: apiVersion: v1 clusters: - cluster: server: http://cow.org:8080 name: cow-cluster contexts: - context: cluster: cow-cluster user: red-user name: federal-context current-context: federal-context kind: Config preferences: {} users: - name: red-user user: token: red-token
Index ¶
- Constants
- func ModifyConfig(curr reflect.Value, steps *navigationSteps, propertyValue string, unset bool, ...) error
- func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, ...) *cobra.Command
- func NewCmdConfigCurrentContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigGetClusters(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigGetContexts(streams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigSet(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigSetAuthInfo(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigSetCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigSetContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
- func NewCmdConfigView(f cmdutil.Factory, streams genericclioptions.IOStreams, ...) *cobra.Command
- func RunCurrentContext(out io.Writer, options *CurrentContextOptions) error
- func RunDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess, cmd *cobra.Command) error
- func RunDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess, cmd *cobra.Command) error
- type CreateAuthInfoOptions
- type CreateClusterOptions
- type CreateContextOptions
- type CurrentContextOptions
- type GetContextsOptions
- type RenameContextOptions
- type SetOptions
- type UseContextOptions
- type ViewOptions
Examples ¶
Constants ¶
const ( FlagAuthProvider = "auth-provider" FlagAuthProviderArg = "auth-provider-arg" FlagExecCommand = "exec-command" FlagExecAPIVersion = "exec-api-version" FlagExecArg = "exec-arg" FlagExecEnv = "exec-env" )
Variables ¶
This section is empty.
Functions ¶
func ModifyConfig ¶
func NewCmdConfig ¶
func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, streams genericclioptions.IOStreams) *cobra.Command
NewCmdConfig creates a command object for the "config" action, and adds all child commands to it.
func NewCmdConfigCurrentContext ¶
NewCmdConfigCurrentContext returns a Command instance for 'config current-context' sub command
func NewCmdConfigDeleteCluster ¶
NewCmdConfigDeleteCluster returns a Command instance for 'config delete-cluster' sub command
func NewCmdConfigDeleteContext ¶
func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command
NewCmdConfigDeleteContext returns a Command instance for 'config delete-context' sub command
func NewCmdConfigGetClusters ¶
NewCmdConfigGetClusters creates a command object for the "get-clusters" action, which lists all clusters defined in the kubeconfig.
func NewCmdConfigGetContexts ¶
func NewCmdConfigGetContexts(streams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *cobra.Command
NewCmdConfigGetContexts creates a command object for the "get-contexts" action, which retrieves one or more contexts from a kubeconfig.
func NewCmdConfigRenameContext ¶
NewCmdConfigRenameContext creates a command object for the "rename-context" action
func NewCmdConfigSet ¶
NewCmdConfigSet returns a Command instance for 'config set' sub command
func NewCmdConfigSetAuthInfo ¶
NewCmdConfigSetAuthInfo returns an Command option instance for 'config set-credentials' sub command
func NewCmdConfigSetCluster ¶
NewCmdConfigSetCluster returns a Command instance for 'config set-cluster' sub command
func NewCmdConfigSetContext ¶
NewCmdConfigSetContext returns a Command instance for 'config set-context' sub command
func NewCmdConfigUnset ¶
NewCmdConfigUnset returns a Command instance for 'config unset' sub command
func NewCmdConfigUseContext ¶
NewCmdConfigUseContext returns a Command instance for 'config use-context' sub command
func NewCmdConfigView ¶
func NewCmdConfigView(f cmdutil.Factory, streams genericclioptions.IOStreams, ConfigAccess clientcmd.ConfigAccess) *cobra.Command
NewCmdConfigView returns a Command instance for 'config view' sub command
func RunCurrentContext ¶
func RunCurrentContext(out io.Writer, options *CurrentContextOptions) error
RunCurrentContext performs the execution of 'config current-context' sub command
func RunDeleteCluster ¶
func RunDeleteContext ¶
Types ¶
type CreateAuthInfoOptions ¶
type CreateAuthInfoOptions struct { ConfigAccess clientcmd.ConfigAccess Name string AuthPath cliflag.StringFlag ClientCertificate cliflag.StringFlag ClientKey cliflag.StringFlag Token cliflag.StringFlag Username cliflag.StringFlag Password cliflag.StringFlag EmbedCertData cliflag.Tristate AuthProvider cliflag.StringFlag AuthProviderArgs map[string]string AuthProviderArgsToRemove []string ExecCommand cliflag.StringFlag ExecAPIVersion cliflag.StringFlag ExecArgs []string ExecEnv map[string]string ExecEnvToRemove []string }
func (CreateAuthInfoOptions) Run ¶
func (o CreateAuthInfoOptions) Run() error
type CreateClusterOptions ¶
type CreateClusterOptions struct { ConfigAccess clientcmd.ConfigAccess Name string Server cliflag.StringFlag InsecureSkipTLSVerify cliflag.Tristate CertificateAuthority cliflag.StringFlag EmbedCAData cliflag.Tristate }
func (*CreateClusterOptions) Complete ¶
func (o *CreateClusterOptions) Complete(cmd *cobra.Command) error
func (CreateClusterOptions) Run ¶
func (o CreateClusterOptions) Run() error
type CreateContextOptions ¶
type CreateContextOptions struct { ConfigAccess clientcmd.ConfigAccess Name string CurrContext bool Cluster cliflag.StringFlag AuthInfo cliflag.StringFlag Namespace cliflag.StringFlag }
type CurrentContextOptions ¶
type CurrentContextOptions struct {
ConfigAccess clientcmd.ConfigAccess
}
CurrentContextOptions holds the command-line options for 'config current-context' sub command
type GetContextsOptions ¶
type GetContextsOptions struct { genericclioptions.IOStreams // contains filtered or unexported fields }
GetContextsOptions contains the assignable options from the args.
func (*GetContextsOptions) Complete ¶
func (o *GetContextsOptions) Complete(cmd *cobra.Command, args []string) error
Complete assigns GetContextsOptions from the args.
func (GetContextsOptions) RunGetContexts ¶
func (o GetContextsOptions) RunGetContexts() error
RunGetContexts implements all the necessary functionality for context retrieval.
type RenameContextOptions ¶
type RenameContextOptions struct { ConfigAccess clientcmd.ConfigAccess ContextName string NewName string }
RenameContextOptions contains the options for running the rename-context cli command.
func (RenameContextOptions) RunRenameContext ¶
func (o RenameContextOptions) RunRenameContext(out io.Writer) error
RunRenameContext performs the execution for 'config rename-context' sub command
func (RenameContextOptions) Validate ¶
func (o RenameContextOptions) Validate() error
Validate makes sure that provided values for command-line options are valid
type SetOptions ¶
type SetOptions struct { ConfigAccess clientcmd.ConfigAccess PropertyName string PropertyValue string SetRawBytes cliflag.Tristate }
func (SetOptions) Run ¶
func (o SetOptions) Run() error
func (SetOptions) Validate ¶
func (o SetOptions) Validate() error
type UseContextOptions ¶
type UseContextOptions struct { ConfigAccess clientcmd.ConfigAccess ContextName string }
func (UseContextOptions) Run ¶
func (o UseContextOptions) Run() error
type ViewOptions ¶
type ViewOptions struct { PrintFlags *genericclioptions.PrintFlags PrintObject printers.ResourcePrinterFunc ConfigAccess clientcmd.ConfigAccess Merge cliflag.Tristate Flatten bool Minify bool RawByteData bool Context string OutputFormat string genericclioptions.IOStreams }
ViewOptions holds the command-line options for 'config view' sub command
func (*ViewOptions) Complete ¶
func (o *ViewOptions) Complete(cmd *cobra.Command, args []string) error
Complete completes the required command-line options
func (ViewOptions) Run ¶
func (o ViewOptions) Run() error
Run performs the execution of 'config view' sub command
func (ViewOptions) Validate ¶
func (o ViewOptions) Validate() error
Validate makes sure that provided values for command-line options are valid