operation

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package operation contains code for basic operations like Apply, Preview and Destroy

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptySpec               = errors.New("empty resources in spec")
	ErrEmptyService            = errors.New("empty k8s service")
	ErrNotOneSvcWithTargetPort = errors.New("only support one k8s service to forward with target port")
)

Functions

func DiffWithRequestResourceAndState

func DiffWithRequestResourceAndState(plan *v1.Spec, priorState *v1.DeprecatedState) (string, error)

func ForwardPort added in v0.11.1

func ForwardPort(
	ctx context.Context,
	restConfig *rest.Config,
	clientset *kubernetes.Clientset,
	namespace, serviceName string,
	servicePort, localPort int,
) error

func NewApplyGraph

func NewApplyGraph(m *apiv1.Spec, priorState *apiv1.DeprecatedState) (*dag.AcyclicGraph, v1.Status)

func NewDestroyGraph

func NewDestroyGraph(resource apiv1.Resources) (*dag.AcyclicGraph, v1.Status)

Types

type ApplyOperation

type ApplyOperation struct {
	models.Operation
}

func (*ApplyOperation) Apply added in v0.4.4

func (ao *ApplyOperation) Apply(request *ApplyRequest) (rsp *ApplyResponse, st v1.Status)

Apply means turn all actual infra resources into the desired state described in the request by invoking a specified Runtime. Like other operations, Apply has 3 main steps during the whole process.

  1. parse resources and their relationship to build a DAG and should take care of those resources that will be deleted
  2. walk this DAG and execute all graph nodes concurrently, besides the entire process should follow dependencies in this DAG
  3. during the execution of each node, it will invoke different runtime according to the resource type

type ApplyRequest

type ApplyRequest struct {
	models.Request `json:",inline" yaml:",inline"`
}

type ApplyResponse

type ApplyResponse struct {
	State *apiv1.DeprecatedState
}

type DestroyOperation

type DestroyOperation struct {
	models.Operation
}

func (*DestroyOperation) Destroy added in v0.4.4

func (do *DestroyOperation) Destroy(request *DestroyRequest) (st v1.Status)

Destroy will delete all resources in this request. The whole process is similar to the operation Apply, but every node's execution is deleting the resource.

type DestroyRequest

type DestroyRequest struct {
	models.Request `json:",inline" yaml:",inline"`
}

type Diff

type Diff struct {
	StateStorage state.Storage
}

func (*Diff) Diff

func (d *Diff) Diff(request *DiffRequest) (string, error)

type DiffRequest

type DiffRequest struct {
	models.Request
}

type PortForwardOperation added in v0.11.1

type PortForwardOperation struct {
	models.Operation
}

func (*PortForwardOperation) PortForward added in v0.11.1

func (bpo *PortForwardOperation) PortForward(req *PortForwardRequest) error

type PortForwardRequest added in v0.11.1

type PortForwardRequest struct {
	models.Request `json:",inline" yaml:",inline"`
	Port           int
}

type PreviewOperation

type PreviewOperation struct {
	models.Operation
}

func (*PreviewOperation) Preview added in v0.4.4

func (po *PreviewOperation) Preview(request *PreviewRequest) (rsp *PreviewResponse, s v1.Status)

Preview compute all changes between resources in request and the actual infrastructure. The whole process is similar to the operation Apply, but the execution of each node is mocked and will not actually invoke the Runtime

type PreviewRequest

type PreviewRequest struct {
	models.Request `json:",inline" yaml:",inline"`
}

type PreviewResponse

type PreviewResponse struct {
	Order *models.ChangeOrder
}

type WatchOperation added in v0.7.0

type WatchOperation struct {
	models.Operation
}

func (*WatchOperation) Watch added in v0.7.0

func (wo *WatchOperation) Watch(req *WatchRequest) error

type WatchRequest added in v0.7.0

type WatchRequest struct {
	models.Request `json:",inline" yaml:",inline"`
}

Directories

Path Synopsis
Package models contains internal structs of operations todo CLI imports this package directly.
Package models contains internal structs of operations todo CLI imports this package directly.

Jump to

Keyboard shortcuts

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