apply

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 30 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equals added in v0.1.1

Equals returns true if the GVK's have equal fields.

func IsLessThan added in v0.1.1

IsLessThan compares two GVK's as per orderFirst and orderLast, returns boolean result.

Types

type Applier

type Applier struct {
	ApplyOptions  *apply.ApplyOptions
	StatusOptions *StatusOptions
	PruneOptions  *prune.PruneOptions

	NoPrune bool
	DryRun  bool
	// 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. The applier performs its function by executing a list queue of tasks, each of which is one of the steps in the process of applying a set of resources to the cluster. The actual execution of these tasks are handled by a StatusRunner. So the taskqueue is effectively a specification that is executed by the StatusRunner. Based on input parameters and/or the set of resources that needs to be applied to the cluster, different sets of tasks might be needed.

func NewApplier

func NewApplier(factory util.Factory, ioStreams genericclioptions.IOStreams) *Applier

newApplier returns a new Applier. It will set up the ApplyOptions and StatusOptions which are responsible for capturing any command line flags. It currently requires IOStreams, but this is a legacy from when the ApplyOptions were responsible for printing progress. This is now handled by a separate printer with the KubectlPrinterAdapter bridging between the two.

func (*Applier) Initialize

func (a *Applier) Initialize(cmd *cobra.Command, paths []string) error

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

func (a *Applier) Run(ctx context.Context, options Options) <-chan event.Event

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.

func (*Applier) SetFlags

func (a *Applier) SetFlags(cmd *cobra.Command) error

SetFlags configures the command line flags needed for apply and status. This is a temporary solution as we should separate the configuration of cobra flags from the Applier.

type BasicPrinter

type BasicPrinter struct {
	IOStreams genericclioptions.IOStreams
}

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

func (b *BasicPrinter) Print(ch <-chan event.Event, preview bool)

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 Destroyer

type Destroyer struct {
	ApplyOptions *apply.ApplyOptions
	PruneOptions *prune.PruneOptions

	DryRun bool
	// contains filtered or unexported fields
}

Destroyer performs the step of grabbing all the previous inventory objects and prune them. This also deletes all the previous inventory objects

func NewDestroyer

func NewDestroyer(factory util.Factory, ioStreams genericclioptions.IOStreams) *Destroyer

NewDestroyer returns a new destroyer. It will set up the ApplyOptions and PruneOptions which are responsible for capturing any command line flags. It currently requires IOStreams, but this is a legacy from when the ApplyOptions were responsible for printing progress. This is now handled by a separate printer with the KubectlPrinterAdapter bridging between the two.

func (*Destroyer) Initialize

func (d *Destroyer) Initialize(cmd *cobra.Command, paths []string) error

Initialize sets up the Destroyer for actually doing an destroy against a cluster. This involves validating command line inputs and configuring clients for communicating with the cluster.

func (*Destroyer) Run

func (d *Destroyer) Run() <-chan event.Event

Run performs the destroy step. This happens asynchronously on progress and any errors are reported back on the event channel.

func (*Destroyer) SetFlags

func (d *Destroyer) SetFlags(cmd *cobra.Command) error

SetFlags configures the command line flags needed for destroy This is a temporary solution as we should separate the configuration of cobra flags from the Destroyer.

type KubectlPrinterAdapter

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 Options added in v0.7.0

type Options struct {
	EmitStatusEvents bool
}

type ResourceInfos added in v0.1.1

type ResourceInfos []*resource.Info

func (ResourceInfos) Len added in v0.1.1

func (a ResourceInfos) Len() int

func (ResourceInfos) Less added in v0.1.1

func (a ResourceInfos) Less(i, j int) bool

func (ResourceInfos) Swap added in v0.1.1

func (a ResourceInfos) Swap(i, j int)

type StatusOptions

type StatusOptions struct {
	Wait bool

	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewStatusOptions

func NewStatusOptions() *StatusOptions

func (*StatusOptions) AddFlags

func (s *StatusOptions) AddFlags(c *cobra.Command)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL