deployment

package
v0.373.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractResources

func ExtractResources(sch *schema.Module) ([]*provisioner.Resource, error)

ExtractResources from a module schema

Types

type Deployment

type Deployment struct {
	Module string
	Tasks  []*Task
}

Deployment is a single deployment of resources for a single module

func (*Deployment) Progress

func (d *Deployment) Progress(ctx context.Context) (bool, error)

Progress the deployment. Returns true if there are still tasks running or pending.

func (*Deployment) State

func (d *Deployment) State() *DeploymentState

type DeploymentState

type DeploymentState struct {
	Pending []*Task
	Running *Task
	Failed  *Task
	Done    []*Task
}

type PluginProvisioner

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

PluginProvisioner delegates provisioning to an external plugin

func NewPluginProvisioner

func NewPluginProvisioner(ctx context.Context, name, dir, exe string) (*PluginProvisioner, error)

func (*PluginProvisioner) Provision

func (p *PluginProvisioner) Provision(ctx context.Context, module string, desired []*provisioner.ResourceContext, existing []*provisioner.Resource) (string, error)

func (*PluginProvisioner) State

type Provisioner

type Provisioner interface {
	Provision(ctx context.Context, module string, desired []*provisioner.ResourceContext, existing []*provisioner.Resource) (string, error)
	State(ctx context.Context, token string, desired []*provisioner.Resource) (TaskState, []*provisioner.Resource, error)
}

Provisioner is a runnable process to provision resources

type ProvisionerRegistry

type ProvisionerRegistry struct {
	Provisioners []*provisionerConfig
}

ProvisionerRegistry contains all known resource handlers in the order they should be executed

func (*ProvisionerRegistry) CreateDeployment

func (reg *ProvisionerRegistry) CreateDeployment(module string, desiredResources, existingResources []*provisioner.Resource) *Deployment

CreateDeployment to take the system to the desired state

func (*ProvisionerRegistry) Register

func (reg *ProvisionerRegistry) Register(handler Provisioner, types ...ResourceType)

Register to the registry, to be executed after all the previously added handlers

type ResourceType

type ResourceType string

ResourceType is a type of resource used to configure provisioners

const (
	ResourceTypeUnknown  ResourceType = "unknown"
	ResourceTypePostgres ResourceType = "postgres"
	ResourceTypeMysql    ResourceType = "mysql"
)

type Task

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

Task is a unit of work for a deployment

func (*Task) Progress

func (t *Task) Progress(ctx context.Context) error

func (*Task) Start

func (t *Task) Start(ctx context.Context) error

type TaskState

type TaskState string
const (
	TaskStatePending TaskState = ""
	TaskStateRunning TaskState = "running"
	TaskStateDone    TaskState = "done"
	TaskStateFailed  TaskState = "failed"
)

Jump to

Keyboard shortcuts

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