Documentation ¶
Overview ¶
package kubectlcobra contains cobra commands from kubectl
package kubectlcobra contains cobra commands from kubectl
package kubectlcobra contains cobra commands from kubectl
package kubectlcobra contains cobra commands from kubectl
Index ¶
- Constants
- func GetCommand(parent *cobra.Command) *cobra.Command
- func NewCmdApply(baseName string, f util.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command
- func PrependGroupingObject(o *apply.ApplyOptions) func() error
- type Applier
- type ApplyEvent
- type BasicPrinter
- type ErrorEvent
- type Event
- type EventType
- type Inventory
- type InventorySet
- func (is *InventorySet) AddItems(items []*Inventory)
- func (is *InventorySet) DeleteItem(item *Inventory) bool
- func (is *InventorySet) Equals(other *InventorySet) bool
- func (is *InventorySet) GetItems() []*Inventory
- func (is *InventorySet) Merge(other *InventorySet) (*InventorySet, error)
- func (is *InventorySet) Size() int
- func (is *InventorySet) String() string
- func (is *InventorySet) Subtract(other *InventorySet) (*InventorySet, error)
- type KubectlPrinterAdapter
- type PruneOptions
- type StatusOptions
Constants ¶
const ( GroupingLabel = "kustomize.config.k8s.io/inventory-id" GroupingHash = "kustomize.config.k8s.io/inventory-hash" )
Variables ¶
This section is empty.
Functions ¶
func GetCommand ¶
GetCommand returns a command from kubectl to install
func NewCmdApply ¶
func NewCmdApply(baseName string, f util.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command
NewCmdApply creates the `apply` command
func PrependGroupingObject ¶ added in v0.1.0
func PrependGroupingObject(o *apply.ApplyOptions) func() error
PrependGroupingObject orders the objects to apply so the "grouping" object stores the inventory, and it is first to be applied.
Types ¶
type Applier ¶ added in v0.1.0
type Applier struct {
// contains filtered or unexported fields
}
Applier performs the step of applying a set of resources into a cluster, conditionally waits for all of them to be fully reconciled and finally performs prune to clean up any resources that has been deleted.
func (*Applier) Initialize ¶ added in v0.1.0
Initialize sets up the Applier for actually doing an apply against a cluster. This involves validating command line inputs and configuring clients for communicating with the cluster.
func (*Applier) Run ¶ added in v0.1.0
Run performs the Apply step. This happens asynchronously with updates on progress and any errors are reported back on the event channel. Cancelling the operation or setting timeout on how long to wait for it complete can be done with the passed in context. Note: There sn't currently any way to interrupt the operation before all the given resources have been applied to the cluster. Any cancellation or timeout will only affect how long we wait for the resources to become current.
type ApplyEvent ¶ added in v0.1.0
type BasicPrinter ¶ added in v0.1.0
type BasicPrinter struct {
// contains filtered or unexported fields
}
BasicPrinter is a simple implementation that just prints the events from the channel in the default format for kubectl. We need to support different printers for different output formats.
func (*BasicPrinter) Print ¶ added in v0.1.0
func (b *BasicPrinter) Print(ch <-chan Event)
Print outputs the events from the provided channel in a simple format on StdOut. As we support other printer implementations this should probably be an interface. This function will block until the channel is closed.
type ErrorEvent ¶ added in v0.1.0
type ErrorEvent struct {
Err error
}
type Event ¶ added in v0.1.0
type Event struct { // EventType is the type of event. EventType EventType // ErrorEvent contains information about any errors encountered. ErrorEvent ErrorEvent // ApplyEvent contains information about progress pertaining to // applying a resource to the cluster. ApplyEvent ApplyEvent // StatusEvents contains information about the status of one of // the applied resources. StatusEvent wait.Event }
Event is the type of the objects that will be returned through the channel that is returned from a call to Run. It contains information about progress and errors encountered during the process of doing apply, waiting for status and doing a prune.
type EventType ¶ added in v0.1.0
type EventType string
EventType determines the type of events that are available.
type Inventory ¶ added in v0.0.3
Inventory organizes and stores the indentifying information for an object. This struct (as a string) is stored in a grouping object to keep track of sets of applied objects.
type InventorySet ¶ added in v0.1.0
type InventorySet struct {
// contains filtered or unexported fields
}
InventorySet encapsulates a grouping of unique Inventory structs. Organizes the Inventory structs with a map, which ensures there are no duplicates. Allows set operations such as merging sets and subtracting sets.
func NewInventorySet ¶ added in v0.1.0
func NewInventorySet(items []*Inventory) *InventorySet
NewInventorySet returns a pointer to an InventorySet struct grouping the passed Inventory items.
func (*InventorySet) AddItems ¶ added in v0.1.0
func (is *InventorySet) AddItems(items []*Inventory)
AddItems adds Inventory structs to the set which are not already in the set.
func (*InventorySet) DeleteItem ¶ added in v0.1.0
func (is *InventorySet) DeleteItem(item *Inventory) bool
DeleteItem removes an Inventory struct from the set if it exists in the set. Returns true if the Inventory item was deleted, false if it did not exist in the set.
func (*InventorySet) Equals ¶ added in v0.1.0
func (is *InventorySet) Equals(other *InventorySet) bool
Equals returns true if the "other" inventory set is the same as this current inventory set. Relies on the fact that the inventory items are sorted for the String() function.
func (*InventorySet) GetItems ¶ added in v0.1.0
func (is *InventorySet) GetItems() []*Inventory
GetItems returns the set of pointers to Inventory structs.
func (*InventorySet) Merge ¶ added in v0.1.0
func (is *InventorySet) Merge(other *InventorySet) (*InventorySet, error)
Merge combines the unique set of Inventory items from the current set with the passed "other" set, returning a new set or error. Returns an error if the passed set to merge is nil.
func (*InventorySet) Size ¶ added in v0.1.0
func (is *InventorySet) Size() int
Size returns the number of Inventory structs in the set.
func (*InventorySet) String ¶ added in v0.1.0
func (is *InventorySet) String() string
String returns a string describing set of Inventory structs.
func (*InventorySet) Subtract ¶ added in v0.1.0
func (is *InventorySet) Subtract(other *InventorySet) (*InventorySet, error)
Subtract removes the Inventory items in the "other" set from the current set, returning a new set. This does not modify the current set. Returns an error if the passed set to subtract is nil.
type KubectlPrinterAdapter ¶ added in v0.1.0
type KubectlPrinterAdapter struct {
// contains filtered or unexported fields
}
KubectlPrinterAdapter is a workaround for capturing progress from ApplyOptions. ApplyOptions were originally meant to print progress directly using a configurable printer. The KubectlPrinterAdapter plugs into ApplyOptions as a ToPrinter function, but instead of printing the info, it emits it as an event on the provided channel.
type PruneOptions ¶ added in v0.1.0
type PruneOptions struct {
// contains filtered or unexported fields
}
PruneOptions encapsulates the necessary information to implement the prune functionality.
func NewPruneOptions ¶ added in v0.1.0
func NewPruneOptions(f util.Factory, ao *apply.ApplyOptions) (*PruneOptions, error)
NewPruneOptions returns a struct (PruneOptions) encapsulating the necessary information to run the prune. Returns an error if an error occurs gathering this information. TODO: Add dry-run options.
func (*PruneOptions) Prune ¶ added in v0.1.0
func (po *PruneOptions) Prune() error
Prune deletes the set of resources which were previously applied (retrieved from previous grouping objects) but omitted in the current apply. Prune also delete all previous grouping objects. Returns an error if there was a problem.
type StatusOptions ¶ added in v0.1.0
type StatusOptions struct {
// contains filtered or unexported fields
}
func NewStatusOptions ¶ added in v0.1.0
func NewStatusOptions() *StatusOptions
func (*StatusOptions) AddFlags ¶ added in v0.1.0
func (s *StatusOptions) AddFlags(c *cobra.Command)