Documentation ¶
Overview ¶
Package genericclioptions contains flags which can be added to you command, bound, completed, and produce useful helper functions. Nothing in this package can depend on kube/kube
Index ¶
- Constants
- type ChangeCauseRecorder
- type ConfigFlags
- func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
- func (f *ConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)
- func (f *ConfigFlags) ToRESTMapper() (meta.RESTMapper, error)
- func (f *ConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig
- func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags
- type IOStreams
- type NoopRecorder
- type RecordFlags
- type Recorder
- type TestConfigFlags
- func (f *TestConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (f *TestConfigFlags) ToRESTConfig() (*rest.Config, error)
- func (f *TestConfigFlags) ToRESTMapper() (meta.RESTMapper, error)
- func (f *TestConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig
- func (f *TestConfigFlags) WithClientConfig(clientConfig clientcmd.ClientConfig) *TestConfigFlags
- func (f *TestConfigFlags) WithDiscoveryClient(c discovery.CachedDiscoveryInterface) *TestConfigFlags
- func (f *TestConfigFlags) WithRESTMapper(mapper meta.RESTMapper) *TestConfigFlags
Constants ¶
const ChangeCauseAnnotation = "kubernetes.io/change-cause"
ChangeCauseAnnotation is the annotation indicating a guess at "why" something was changed
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeCauseRecorder ¶
type ChangeCauseRecorder struct {
// contains filtered or unexported fields
}
ChangeCauseRecorder annotates a "change-cause" to an input runtime object
func (*ChangeCauseRecorder) MakeRecordMergePatch ¶
func (r *ChangeCauseRecorder) MakeRecordMergePatch(obj runtime.Object) ([]byte, error)
MakeRecordMergePatch produces a merge patch for updating the recording annotation.
type ConfigFlags ¶
type ConfigFlags struct { CacheDir *string KubeConfig *string // config flags ClusterName *string AuthInfoName *string Context *string Namespace *string APIServer *string Insecure *bool CertFile *string KeyFile *string CAFile *string BearerToken *string Impersonate *string ImpersonateGroup *[]string Username *string Password *string Timeout *string }
ConfigFlags composes the set of values necessary for obtaining a REST client config
func NewConfigFlags ¶
func NewConfigFlags() *ConfigFlags
NewConfigFlags returns ConfigFlags with default values set
func (*ConfigFlags) AddFlags ¶
func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
AddFlags binds client configuration flags to a given flagset
func (*ConfigFlags) ToDiscoveryClient ¶
func (f *ConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
ToDiscoveryClient implements RESTClientGetter. Expects the AddFlags method to have been called. Returns a CachedDiscoveryInterface using a computed RESTConfig.
func (*ConfigFlags) ToRESTConfig ¶
func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)
ToRESTConfig implements RESTClientGetter. Returns a REST client configuration based on a provided path to a .kubeconfig file, loading rules, and config flag overrides. Expects the AddFlags method to have been called.
func (*ConfigFlags) ToRESTMapper ¶
func (f *ConfigFlags) ToRESTMapper() (meta.RESTMapper, error)
ToRESTMapper returns a mapper.
func (*ConfigFlags) ToRawKubeConfigLoader ¶
func (f *ConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig
ToRawKubeConfigLoader binds config flag values to config overrides Returns an interactive clientConfig if the password flag is enabled, or a non-interactive clientConfig otherwise.
func (*ConfigFlags) WithDeprecatedPasswordFlag ¶
func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags
WithDeprecatedPasswordFlag enables the username and password config flags
type IOStreams ¶
type IOStreams struct { // In think, os.Stdin In io.Reader // Out think, os.Stdout Out io.Writer // ErrOut think, os.Stderr ErrOut io.Writer }
IOStreams provides the standard names for iostreams. This is useful for embedding and for unit testing. Inconsistent and different names make it hard to read and review code
func NewTestIOStreams ¶
NewTestIOStreams returns a valid IOStreams and in, out, errout buffers for unit tests
func NewTestIOStreamsDiscard ¶
func NewTestIOStreamsDiscard() IOStreams
NewTestIOStreamsDiscard returns a valid IOStreams that just discards
type NoopRecorder ¶
type NoopRecorder struct{}
NoopRecorder does nothing. It is a "do nothing" that can be returned so code doesn't switch on it.
func (NoopRecorder) MakeRecordMergePatch ¶
func (r NoopRecorder) MakeRecordMergePatch(obj runtime.Object) ([]byte, error)
MakeRecordMergePatch implements Recorder
type RecordFlags ¶
type RecordFlags struct { // Record indicates the state of the recording flag. It is a pointer so a caller can opt out or rebind Record *bool // contains filtered or unexported fields }
RecordFlags contains all flags associated with the "--record" operation
func NewRecordFlags ¶
func NewRecordFlags() *RecordFlags
NewRecordFlags provides a RecordFlags with reasonable default values set for use
func (*RecordFlags) AddFlags ¶
func (f *RecordFlags) AddFlags(cmd *cobra.Command)
AddFlags binds the requested flags to the provided flagset TODO have this only take a flagset
func (*RecordFlags) Complete ¶
func (f *RecordFlags) Complete(changeCause string) error
Complete is called before the command is run, but after it is invoked to finish the state of the struct before use.
func (*RecordFlags) ToRecorder ¶
func (f *RecordFlags) ToRecorder() (Recorder, error)
ToRecorder returns a ChangeCause recorder if --record=false was not explicitly given by the user
type Recorder ¶
type Recorder interface { // Record records why a runtime.Object was changed in an annotation. Record(runtime.Object) error MakeRecordMergePatch(runtime.Object) ([]byte, error) }
Recorder is used to record why a runtime.Object was changed in an annotation.
type TestConfigFlags ¶
type TestConfigFlags struct {
// contains filtered or unexported fields
}
func NewTestConfigFlags ¶
func NewTestConfigFlags() *TestConfigFlags
func (*TestConfigFlags) ToDiscoveryClient ¶
func (f *TestConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
func (*TestConfigFlags) ToRESTConfig ¶
func (f *TestConfigFlags) ToRESTConfig() (*rest.Config, error)
func (*TestConfigFlags) ToRESTMapper ¶
func (f *TestConfigFlags) ToRESTMapper() (meta.RESTMapper, error)
func (*TestConfigFlags) ToRawKubeConfigLoader ¶
func (f *TestConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig
func (*TestConfigFlags) WithClientConfig ¶
func (f *TestConfigFlags) WithClientConfig(clientConfig clientcmd.ClientConfig) *TestConfigFlags
func (*TestConfigFlags) WithDiscoveryClient ¶
func (f *TestConfigFlags) WithDiscoveryClient(c discovery.CachedDiscoveryInterface) *TestConfigFlags
func (*TestConfigFlags) WithRESTMapper ¶
func (f *TestConfigFlags) WithRESTMapper(mapper meta.RESTMapper) *TestConfigFlags