infra

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package infra provides functions for orchestrating a Micro platform

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteApply

func ExecuteApply(steps []Step) error

ExecuteApply carries out an apply on steps

func ExecuteDestroy

func ExecuteDestroy(steps []Step) error

ExecuteDestroy destroys steps

func ExecutePlan

func ExecutePlan(steps []Step) error

ExecutePlan carries out a plan on steps

Types

type Kubernetes

type Kubernetes struct {
	Name     string
	Region   string
	Provider string
}

Kubernetes represents a Kube Cluster

func (*Kubernetes) Config

func (k *Kubernetes) Config(runID int32, path string) ([]Step, error)

Config returns steps to save a Kubernetes config

func (*Kubernetes) Steps

func (k *Kubernetes) Steps(runID int32) ([]Step, error)

Steps generates steps that provision a Kubernetes cluster

type Noop

type Noop struct {
	ID   string
	Name string
}

Noop is a task that prints the stage it is on, but otherwise does nothing

func (*Noop) Apply

func (n *Noop) Apply() error

Apply prints Applying

func (*Noop) Destroy

func (n *Noop) Destroy() error

Destroy prints Destroying

func (*Noop) Finalise

func (n *Noop) Finalise() error

Finalise prints Finalising

func (*Noop) Plan

func (n *Noop) Plan() error

Plan prints Planning

func (*Noop) Validate

func (n *Noop) Validate() error

Validate prints Validating

type Platform

type Platform struct {
	Name    string
	Domain  string
	Gslb    string
	Kv      string
	Regions []struct {
		Provider string
		Region   string
		Control  []string
		Resource []string
		Network  []string
	}
}

Platform defines a complete platform

func (*Platform) Steps

func (p *Platform) Steps() ([]Step, error)

Steps generates an action plan from a Platform description

type RemoteState

type RemoteState struct {
	ID   string
	Name string
}

RemoteState is an action that verifies remote state is available

func (*RemoteState) Apply

func (r *RemoteState) Apply() error

Apply does nothing

func (*RemoteState) Destroy

func (r *RemoteState) Destroy() error

Destroy does nothing

func (*RemoteState) Finalise

func (r *RemoteState) Finalise() error

Finalise does nothing

func (*RemoteState) Plan

func (r *RemoteState) Plan() error

Plan does nothing

func (*RemoteState) Validate

func (r *RemoteState) Validate() error

Validate checks the remote state buckets and table exist

type Step

type Step []Task

Step is a list of parallisable tasks

type Task

type Task interface {
	Validate() error
	Plan() error
	Apply() error
	Finalise() error
	Destroy() error
}

Task describes an individual task

type TerraformModule

type TerraformModule struct {
	// ID is a persistent unique ID for the name of the stored state
	ID string
	// Name is the name of the module - for logging purposes
	Name string
	// Path is the path to the module. It's set to working directory for terraform
	Path string
	// Source is a net.URL to the module
	Source string
	// Any environment variables to pass to terraform
	Env map[string]string
	// Any terraform variables
	Variables map[string]string
	// Any remote states to import key = state name, value = remote state ID
	RemoteStates map[string]string
	// Dry-run
	DryRun bool
}

TerraformModule is a task that fetches and applies a terraform module

func (*TerraformModule) Apply

func (t *TerraformModule) Apply() error

Apply runs terraform apply

func (*TerraformModule) Destroy

func (t *TerraformModule) Destroy() error

Destroy runs terraform apply

func (*TerraformModule) Finalise

func (t *TerraformModule) Finalise() error

Finalise removes the directory

func (*TerraformModule) Plan

func (t *TerraformModule) Plan() error

Plan runs terraform plan

func (*TerraformModule) Validate

func (t *TerraformModule) Validate() error

Validate attempts to fetch terraform code then runs terraform init and terraform validate

Jump to

Keyboard shortcuts

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