runtime

package
v0.9.1-rc Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 8

Documentation

Overview

Package runtime contains code of all infrastructure runtimes supported by Kusion.

Index

Constants

View Source
const (
	Kubernetes intent.Type = "Kubernetes"
	Terraform  intent.Type = "Terraform"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyRequest added in v0.5.1

type ApplyRequest struct {
	// PriorResource is the last applied resource saved in state storage
	PriorResource *intent.Resource

	// PlanResource is the resource we want to apply in this request
	PlanResource *intent.Resource

	// Stack contains info about where this command is invoked
	Stack *stack.Stack

	// DryRun means this a dry-run request and will not make any changes in actual infra
	DryRun bool
}

type ApplyResponse added in v0.5.1

type ApplyResponse struct {
	// Resource is the result returned by Runtime
	Resource *intent.Resource

	// Status contains messages will show to users
	Status status.Status
}

type DeleteRequest added in v0.5.1

type DeleteRequest struct {
	// Resource represents the resource we want to delete from the actual infra
	Resource *intent.Resource

	// Stack contains info about where this command is invoked
	Stack *stack.Stack
}

type DeleteResponse added in v0.5.1

type DeleteResponse struct {
	// Status contains messages will show to users
	Status status.Status
}

type ImportRequest added in v0.7.4

type ImportRequest struct {
	// PlanResource is the resource we want to apply in this request
	PlanResource *intent.Resource

	// Stack contains info about where this command is invoked
	Stack *stack.Stack
}

type ImportResponse added in v0.7.4

type ImportResponse struct {
	// Resource is the result returned by Runtime
	Resource *intent.Resource

	// Status contains messages will show to users
	Status status.Status
}

type ReadRequest added in v0.5.1

type ReadRequest struct {
	// PriorResource is the last applied resource saved in state storage
	PriorResource *intent.Resource

	// PlanResource is the resource we want to apply in this request
	PlanResource *intent.Resource

	// Stack contains info about where this command is invoked
	Stack *stack.Stack
}

type ReadResponse added in v0.5.1

type ReadResponse struct {
	// Resource is the result read from the actual infra
	Resource *intent.Resource

	// Status contains messages will show to users
	Status status.Status
}

type Runtime

type Runtime interface {
	// Apply means modify this Resource to the desired state described in the request,
	// and it will turn into creating or updating a Resource in most scenarios.
	// If the infrastructure runtime already provides an Apply method that conform to this method's semantics meaning,
	// like the Kubernetes Runtime, you can directly invoke this method without any conversion.
	// PlanResource and priorState are given in this method for the runtime which would make a
	// three-way-merge (planState,priorState and live state) when implementing this interface
	Apply(ctx context.Context, request *ApplyRequest) *ApplyResponse

	// Read the latest state of this Resource
	Read(ctx context.Context, request *ReadRequest) *ReadResponse

	// Import Resource that already existed in the actual infrastructure
	Import(ctx context.Context, request *ImportRequest) *ImportResponse

	// Delete this Resource in the actual infrastructure and return success if this Resource is not exist
	Delete(ctx context.Context, request *DeleteRequest) *DeleteResponse

	// Watch the latest state or event of this Resource.
	// This is an optional method for the Runtime to implement,
	// but it will be very helpful for us to know what is happening when applying this Resource
	Watch(ctx context.Context, request *WatchRequest) *WatchResponse
}

Runtime represents an actual infrastructure runtime managed by Kusion and every runtime implements this interface can be orchestrated by Kusion like normal K8s resources. All methods in this interface are designed for manipulating one Resource at a time and will be invoked in operations like Apply, Preview, Destroy, etc.

type SequentialWatchers added in v0.7.4

type SequentialWatchers struct {
	IDs      []string
	Watchers []<-chan watch.Event
}

func NewWatchers added in v0.7.4

func NewWatchers() *SequentialWatchers

func (*SequentialWatchers) Insert added in v0.7.4

func (w *SequentialWatchers) Insert(id string, watcher <-chan watch.Event)

type WatchRequest added in v0.5.1

type WatchRequest struct {
	// Resource represents the resource we want to watch from the actual infra
	Resource *intent.Resource
}

type WatchResponse added in v0.5.1

type WatchResponse struct {
	Watchers *SequentialWatchers

	// Status contains messages will show to users
	Status status.Status
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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