deployment

package
v0.0.0-...-2fcdea6 Latest Latest
Warning

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

Go to latest
Published: May 30, 2016 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllPlaybooks map[string]*Playbook

AllPlaybooks is a map of playbook id's to playbooks

View Source
var ManifestExtension = ".yml"

ManifestExtension is added to each task manifest item to make a filename

Functions

func Config

func Config() (*restclient.Config, error)

Config returns a kubernetes configuration

func IsKubernetesEnv

func IsKubernetesEnv() bool

IsKubernetesEnv returns true if necessary Kubernetes environment variables and files are available

func KubernetesConfig

func KubernetesConfig() (*restclient.Config, error)

KubernetesConfig returns Kubernetes configuration for native Kubernetes environment

func LoadPlaybookFolder

func LoadPlaybookFolder(dir string) (map[string]*Playbook, error)

LoadPlaybookFolder takes a directory and attempts to parse every file in that directory into a Playbook struct

func LocalConfig

func LocalConfig() *restclient.Config

LocalConfig returns a configuration for local development

func ReadPlaybookFromDisk

func ReadPlaybookFromDisk(fd string) ([]byte, error)

ReadPlaybookFromDisk takes a filename and returns a byte array. Alias for ioutil.ReadFile

Types

type Deployer

type Deployer interface {
	Deploy() error
	Destroy() error
}

Deployer declares something that can Deploy Deployments

type KubernetesDeployment

type KubernetesDeployment struct {
	Playbook  *Playbook
	Variables map[string]string
	Manifests map[string]*Manifest
}

KubernetesDeployment represents a deployment of an instance

func NewKubernetesDeployment

func NewKubernetesDeployment(config *restclient.Config, playbook *Playbook, variables map[string]string, manifests map[string]*Manifest) (*KubernetesDeployment, error)

NewKubernetesDeployment creates a new kuberentes deployment

func (*KubernetesDeployment) Deploy

func (d *KubernetesDeployment) Deploy() error

Deploy executes the deployment

func (*KubernetesDeployment) Destroy

func (d *KubernetesDeployment) Destroy() error

Destroy deletes Kubernetes resourses

type Manifest

type Manifest struct {
	ID       string
	Template *template.Template
}

Manifest represents a kubernetes manifest file Filename is used as identifier in the current implementation.

func NewManifest

func NewManifest(id, content string) (*Manifest, error)

NewManifest creates a new Manifest object and parses (but does not execute) the template

func (*Manifest) Execute

func (m *Manifest) Execute(vars map[string]string) string

Execute executes template with variables

type ManifestStep

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

ManifestStep implements a deployment step

func (*ManifestStep) Deploy

func (s *ManifestStep) Deploy() error

Deploy executes the deployment of a step

func (*ManifestStep) Destroy

func (s *ManifestStep) Destroy() error

Destroy deletes kubernetes resource

type Meta

type Meta struct {
	Team  string `yaml:"team"`
	Email string `yaml:"email"`
	Slack string `yaml:"slack"`
}

Meta contains optional metadata keys associated with this playbook

type Playbook

type Playbook struct {
	ID       string            `yaml:"id"`
	Name     string            `yaml:"name"`
	Meta     Meta              `yaml:"meta"`
	Vars     []string          `yaml:"vars"`
	Tasks    []Task            `yaml:"tasks"`
	Messages map[string]string `yaml:"messages"`
}

Playbook configures a set of tasks to be automated

func ParsePlaybook

func ParsePlaybook(playbook []byte) (*Playbook, error)

ParsePlaybook unmarshalls a YAML byte sequence into a Playbook struct

func (*Playbook) Validate

func (p *Playbook) Validate() error

Validate checks for ID, Name, and Tasks on a playbook

func (*Playbook) ValidateTasks

func (p *Playbook) ValidateTasks() error

ValidateTasks checks a task for fields Name, and one or both of Manifests and PodManifests

type PodManifestStep

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

PodManifestStep implements a deployment step with pod manifest

func (*PodManifestStep) Deploy

func (s *PodManifestStep) Deploy() error

Deploy executes the deployment step

func (*PodManifestStep) Destroy

func (s *PodManifestStep) Destroy() error

Destroy deletes pod

type Step

type Step interface {
	Deploy() error
	Destroy() error
}

Step represents a deployment step

func NewManifestStep

func NewManifestStep(object runtime.Object) Step

NewManifestStep creates a default step

func NewPodManifestStep

func NewPodManifestStep(object runtime.Object) Step

NewPodManifestStep creates a PodManifestStep and returns a Step

type Task

type Task struct {
	Name        string   `yaml:"name"`
	Manifests   []string `yaml:"manifests,omitempty"`
	PodManifest string   `yaml:"pod_manifest,omitempty"`
	WaitFor     []string `yaml:"wait_for,omitempty"`
	When        string   `yaml:"when,omitempty"`
}

Task represents a step in the playbook, for example, running migrations or deploying services.

func (Task) ManifestsPresent

func (t Task) ManifestsPresent() error

ManifestsPresent iterates through the Manifests and PodManifest items on a task, and checks that each represents a file on disk

type TaskStep

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

TaskStep combines a task and a step

Jump to

Keyboard shortcuts

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