apply

package
v0.13.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(
	o *ApplyOptions,
	storage release.Storage,
	rel *apiv1.Release,
	changes *models.Changes,
) (*apiv1.Release, error)

The Apply function will apply the resources changes through the execution kusion engine. You can customize the runtime of engine and the release storage through `runtime` and `storage` parameters.

func NewCmdApply

func NewCmdApply(ui *terminal.UI, ioStreams genericiooptions.IOStreams) *cobra.Command

NewCmdApply creates the `apply` command.

func PortForward added in v0.11.1

func PortForward(
	o *ApplyOptions,
	spec *apiv1.Spec,
) error

PortForward function will forward the specified port from local to the project Kubernetes Service.

Example:

o := newApplyOptions() spec, err := generate.GenerateSpecWithSpinner(o.RefProject, o.RefStack, o.RefWorkspace, nil, o.NoStyle)

if err != nil {
	 return err
}

err = PortForward(o, spec)

if err != nil {
  return err
}

Fixme: gracefully exit when interrupted by SIGINT or SIGTERM.

func PrintApplyDetails added in v0.12.0

func PrintApplyDetails(
	ac *operation.ApplyOperation,
	err *error,
	errWriter *io.Writer,
	wg *sync.WaitGroup,
	changes *models.Changes,
	changesWriterMap map[string]*pterm.SpinnerPrinter,
	progressbar *pterm.ProgressbarPrinter,
	ls *lineSummary,
	dryRun bool,
	watch bool,
)

PrintApplyDetails function will receive the messages of the apply operation and print the details. Fixme: abstract the input variables into a struct.

func Watch

func Watch(
	ac *operation.ApplyOperation,
	changes *models.Changes,
	err *error,
	dryRun bool,
	watchErrCh chan error,
	multi *pterm.MultiPrinter,
	changesWriterMap map[string]*pterm.SpinnerPrinter,
)

Watch function will watch the changed Kubernetes and Terraform resources. Fixme: abstract the input variables into a struct.

Types

type ApplyFlags added in v0.11.1

type ApplyFlags struct {
	*preview.PreviewFlags

	Yes         bool
	DryRun      bool
	Watch       bool
	Timeout     int
	PortForward int

	genericiooptions.IOStreams
}

ApplyFlags directly reflect the information that CLI is gathering via flags. They will be converted to ApplyOptions, which reflect the runtime requirements for the command.

This structure reduces the transformation to wiring and makes the logic itself easy to unit test.

func NewApplyFlags added in v0.11.1

func NewApplyFlags(ui *terminal.UI, streams genericiooptions.IOStreams) *ApplyFlags

NewApplyFlags returns a default ApplyFlags

func (*ApplyFlags) AddFlags added in v0.11.1

func (f *ApplyFlags) AddFlags(cmd *cobra.Command)

AddFlags registers flags for a cli.

func (*ApplyFlags) ToOptions added in v0.11.1

func (f *ApplyFlags) ToOptions() (*ApplyOptions, error)

ToOptions converts from CLI inputs to runtime inputs.

type ApplyOptions

type ApplyOptions struct {
	*preview.PreviewOptions

	SpecFile    string
	Yes         bool
	DryRun      bool
	Watch       bool
	Timeout     int
	PortForward int

	genericiooptions.IOStreams
}

ApplyOptions defines flags and other configuration parameters for the `apply` command.

func (*ApplyOptions) Run

func (o *ApplyOptions) Run() (err error)

Run executes the `apply` command.

func (*ApplyOptions) Validate

func (o *ApplyOptions) Validate(cmd *cobra.Command, args []string) error

Validate verifies if ApplyOptions are valid and without conflicts.

Jump to

Keyboard shortcuts

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