execute

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Execute

type Execute struct {
	// DryRun prevents making changes to the target cluster.
	DryRun bool

	// Environ are the environment variables on Tool invocation.
	Environ []string

	// Kubectl knows how to invoke 'kubectl'
	Kubectl Kubectler

	// Out is the stream to send steps to in a format that is 'kubectl apply -f -' consumable.
	// Setting Out prevents any other processing (like 'wait') to take place.
	Out io.Writer

	Log logr.Logger
}

Execute executes Action, Apply, Wait steps.

func (*Execute) Action

func (x *Execute) Action(id int, name string, doc []byte, portForward string, passedValues *yamlx.Values) error

Action performs an action on the target cluster.

func (*Execute) Apply

func (x *Execute) Apply(id int, name string, labels map[string]string, b []byte) ([]KindNamespaceName, error)

Apply applies the resource in b to the target cluster.

func (*Execute) Prune added in v0.4.0

func (x *Execute) Prune(id int, deployed []KindNamespaceName, labels map[string]string, namespaces []string) error

Prune diff deployed with the resources in namespaces selected by labels. The resources that are in cluster but not in deployed are deleted. NB. an empty string in namespaces selects non-namespaced resources.

func (*Execute) Wait

func (x *Execute) Wait(id int, flags string) error

Wait waits for target cluster conditions specified by flags to become true.

type KindNamespaceName added in v0.4.0

type KindNamespaceName struct {
	GVK       v1.GroupVersionKind
	Namespace string
	Name      string
}

KindNamespaceName TODO call it K8sResourceRef? K8sObjectRef

func NewKindNamespaceName added in v0.4.0

func NewKindNamespaceName(obj *unstructured.Unstructured) KindNamespaceName

func (KindNamespaceName) Resource

func (k KindNamespaceName) Resource() string

Resource returns the name of the resource like; pod, configmap, xyz.constraints.gatekeeper.sh TODO use APIResources to do mapping.

func (KindNamespaceName) String added in v0.4.0

func (k KindNamespaceName) String() string

String makes the receiver implement Stringer.

type Kubectl

type Kubectl struct {
	// Environ are the environment variables on kubectl invocation.
	Environ []string
	// Kubectl binary name and global arguments.
	KubeCtl, KubeConfig, KubeContext string

	Log logr.Logger
}

Kubectl can run kubectl cli.

func (Kubectl) Run

func (k Kubectl) Run(ctx context.Context, stdin string, args ...string) (string, string, error)

Run kubectl.

type Kubectler

type Kubectler interface {
	Run(ctx context.Context, stdin string, args ...string) (string, string, error)
}

Kubectler provides methods to invoke kubectl.

Jump to

Keyboard shortcuts

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