runtime

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 21 Imported by: 8

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubernetesRuntime

type KubernetesRuntime struct {
	// contains filtered or unexported fields
}

func (*KubernetesRuntime) Apply

func (k *KubernetesRuntime) Apply(ctx context.Context, priorState, planState *models.Resource) (*models.Resource, status.Status)

Apply kubernetes resource by client-go

func (*KubernetesRuntime) Delete

func (k *KubernetesRuntime) Delete(ctx context.Context, resourceState *models.Resource) status.Status

Delete kubernetes resource by client-go

func (*KubernetesRuntime) Read

func (k *KubernetesRuntime) Read(ctx context.Context, resourceState *models.Resource) (*models.Resource, status.Status)

Read kubernetes resource by client-go

func (*KubernetesRuntime) Watch

func (k *KubernetesRuntime) Watch(ctx context.Context, resourceState *models.Resource) (*models.Resource, status.Status)

Watch kubernetes resource by client-go

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.
	// PlanState 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, priorState, planState *models.Resource) (*models.Resource, status.Status)

	// Read the latest state of this resource
	Read(ctx context.Context, resourceState *models.Resource) (*models.Resource, status.Status)

	// Delete this resource in the actual infrastructure and return success if this resource is not exist
	Delete(ctx context.Context, resourceState *models.Resource) status.Status

	// 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, resourceState *models.Resource) (*models.Resource, status.Status)
}

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.

func NewKubernetesRuntime

func NewKubernetesRuntime() (Runtime, error)

NewKubernetesRuntime create a new KubernetesRuntime

Jump to

Keyboard shortcuts

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