apply

package
v0.9.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(
	o *Options,
	storage states.StateStorage,
	planResources *models.Spec,
	changes *opsmodels.Changes,
	out io.Writer,
) error

The Apply function will apply the resources changes through the execution Kusion Engine, and will save the state to specified storage.

You can customize the runtime of engine and the state storage through `runtime` and `storage` parameters.

Example:

o := NewApplyOptions()
stateStorage := &states.FileSystemState{
    Path: filepath.Join(o.WorkDir, states.KusionState)
}
kubernetesRuntime, err := runtime.NewKubernetesRuntime()
if err != nil {
    return err
}

err = Apply(o, kubernetesRuntime, stateStorage, planResources, changes, os.Stdout)
if err != nil {
    return err
}

func NewCmdApply

func NewCmdApply() *cobra.Command

func Watch

func Watch(
	o *Options,
	planResources *models.Spec,
	changes *opsmodels.Changes,
) error

Watch function will observe the changes of each resource by the execution engine.

Example:

o := NewApplyOptions()
kubernetesRuntime, err := runtime.NewKubernetesRuntime()
if err != nil {
    return err
}

Watch(o, kubernetesRuntime, planResources, changes, os.Stdout)
if err != nil {
    return err
}

Types

type Flag added in v0.9.0

type Flag struct {
	Yes    bool
	DryRun bool
	Watch  bool
}

type Options added in v0.9.0

type Options struct {
	previewcmd.Options
	Flag
}

Options defines flags for the `apply` command

func NewApplyOptions

func NewApplyOptions() *Options

NewApplyOptions returns a new ApplyOptions instance

func (*Options) Complete added in v0.9.0

func (o *Options) Complete(args []string)

func (*Options) Run added in v0.9.0

func (o *Options) Run() error

func (*Options) Validate added in v0.9.0

func (o *Options) Validate() error

Jump to

Keyboard shortcuts

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