package genericclioptions
import "k8s.io/kubernetes/pkg/kubectl/genericclioptions"
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 NoopRecorder
- type RecordFlags
- func NewRecordFlags() *RecordFlags
- func (f *RecordFlags) AddFlags(cmd *cobra.Command)
- func (f *RecordFlags) Complete(changeCause string) error
- func (f *RecordFlags) ToRecorder() (Recorder, error)
- type Recorder
Constants ¶
const ChangeCauseAnnotation = "kubernetes.io/change-cause"
ChangeCauseAnnotation is the annotation indicating a guess at "why" something was changed
Types ¶
type ChangeCauseRecorder ¶
type ChangeCauseRecorder struct {
// contains filtered or unexported fields
}
ChangeCauseRecorder annotates a "change-cause" to an input runtime object
func (*ChangeCauseRecorder) Record ¶
func (r *ChangeCauseRecorder) Record(obj runtime.Object) error
Record annotates a "change-cause" to a given info if either "shouldRecord" is true, or the resource info previously contained a "change-cause" annotation.
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) Record ¶
func (r NoopRecorder) Record(obj runtime.Object) error
Record 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 }
Recorder is used to record why a runtime.Object was changed in an annotation.
Source Files ¶
doc.go record_flags.go
- Version
- v1.11.0-alpha.1
- Published
- Apr 19, 2018
- Platform
- js/wasm
- Imports
- 3 packages
- Last checked
- 33 minutes ago –
Tools for package owners.