provisioners

package
v0.0.0-...-a07f48f Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvisionResources

func ProvisionResources(ctx context.Context, state *project.State, provisioners []Provisioner) (*project.State, error)

Types

type Input

type Input struct {

	// Guid is a random uuid generated the first time this resource is added to the project.
	ResourceGuid     string                 `json:"resource_guid"`
	ResourceUid      string                 `json:"resource_uid"`
	ResourceType     string                 `json:"resource_type"`
	ResourceClass    string                 `json:"resource_class"`
	ResourceId       string                 `json:"resource_id"`
	ResourceParams   map[string]interface{} `json:"resource_params"`
	ResourceMetadata map[string]interface{} `json:"resource_metadata"`

	// SourceWorkload is the name of the workload that first defined this resource or carries the params definition.
	SourceWorkload string `json:"source_workload"`
	// WorkloadServices is a map from workload name to the network NetworkService of another workload which defines
	// the hostname and the set of ports it exposes.
	WorkloadServices map[string]NetworkService `json:"workload_services"`

	ResourceState map[string]interface{} `json:"resource_state"`
	SharedState   map[string]interface{} `json:"shared_state"`
}

Input is the set of thins passed to the provisioner implementation. It provides context, previous state, and shared state used by all resources.

type NetworkService

type NetworkService struct {
	ServiceName string                 `yaml:"service_name"`
	Ports       map[string]ServicePort `json:"ports"`
}

NetworkService describes how to contact ports exposed by another workload

type ProvisionOutput

type ProvisionOutput struct {
	ProvisionerUri  string                   `json:"-"`
	ResourceState   map[string]interface{}   `json:"resource_state"`
	ResourceOutputs map[string]interface{}   `json:"resource_outputs"`
	SharedState     map[string]interface{}   `json:"shared_state"`
	Manifests       []map[string]interface{} `json:"manifests"`

	// For testing and legacy reasons, built in provisioners can set a direct lookup function
	OutputLookupFunc framework.OutputLookupFunc `json:"-"`
}

ProvisionOutput is the output returned from a provisioner implementation.

func (*ProvisionOutput) ApplyToStateAndProject

func (po *ProvisionOutput) ApplyToStateAndProject(state *project.State, resUid framework.ResourceUid) (*project.State, error)

ApplyToStateAndProject takes the outputs of a provisioning request and applies to the state, file tree, and docker compose project.

type Provisioner

type Provisioner interface {
	Uri() string
	Match(resUid framework.ResourceUid) bool
	Provision(ctx context.Context, input *Input) (*ProvisionOutput, error)
}

func NewEphemeralProvisioner

func NewEphemeralProvisioner(uri string, matchUid framework.ResourceUid, inner func(ctx context.Context, input *Input) (*ProvisionOutput, error)) Provisioner

NewEphemeralProvisioner is mostly used for internal testing and uses the given provisioner function to provision an exact resource.

type ServicePort

type ServicePort struct {
	// Name is the name of the port from the workload specification
	Name string `json:"name"`
	// Port is the numeric port intended to be published
	Port int `json:"port"`
	// TargetPort is the port on the workload that hosts the actual traffic
	TargetPort int `json:"target_port"`
	// Protocol is TCP or UDP.
	Protocol score.ServicePortProtocol `json:"protocol"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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