apply

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

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

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

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,
)

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

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

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

NewApplyFlags returns a default ApplyFlags

func (*ApplyFlags) AddFlags

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

AddFlags registers flags for a cli.

func (*ApplyFlags) ToOptions

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

ToOptions converts from CLI inputs to runtime inputs.

type ApplyOptions

type ApplyOptions struct {
	*preview.PreviewOptions

	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