Documentation ¶
Overview ¶
Package runtime contains code of all infrastructure runtimes supported by Kusion.
Index ¶
Constants ¶
View Source
const ( Kubernetes apiv1.Type = "Kubernetes" Terraform apiv1.Type = "Terraform" )
View Source
const ( // TFApplying means the TF resource is still being applied. TFApplying = TFEvent("Applying") // TFSucceeded means the TF resource operation has succeeded. TFSucceeded = TFEvent("Succeeded") // TFFailed means the TF resource operation has failed. TFFailed = TFEvent("Failed") )
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 *apiv1.Resource // PlanResource is the resource we want to apply in this request PlanResource *apiv1.Resource // Stack contains info about where this command is invoked Stack *apiv1.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 DeleteRequest ¶ added in v0.5.1
type DeleteResponse ¶ added in v0.5.1
type ImportRequest ¶ added in v0.7.4
type ImportResponse ¶ added in v0.7.4
type ReadRequest ¶ added in v0.5.1
type ReadResponse ¶ added in v0.5.1
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. Fixme: update the runtime interface definition of requests and responses.
type SequentialWatchers ¶ added in v0.7.4
type SequentialWatchers struct { IDs []string Watchers []<-chan watch.Event // TFWatcher is for watching the operation event of the Terraform resources. TFWatcher <-chan TFEvent }
func NewWatchers ¶ added in v0.7.4
func NewWatchers() *SequentialWatchers
type TFEvent ¶ added in v0.12.0
type TFEvent string
TFEvent represents the status of the Terraform resource operation event.
type WatchRequest ¶ added in v0.5.1
type WatchResponse ¶ added in v0.5.1
type WatchResponse struct { Watchers *SequentialWatchers // Status contains messages will show to users Status v1.Status }
Click to show internal directories.
Click to hide internal directories.