Documentation ¶
Index ¶
- Variables
- func Config() (*restclient.Config, error)
- func IsKubernetesEnv() bool
- func KubernetesConfig() (*restclient.Config, error)
- func LoadPlaybookFolder(dir string) (map[string]*Playbook, error)
- func LocalConfig() *restclient.Config
- func ReadPlaybookFromDisk(fd string) ([]byte, error)
- type Deployer
- type KubernetesDeployment
- type Manifest
- type ManifestStep
- type Meta
- type Playbook
- type PodManifestStep
- type Step
- type Task
- type TaskStep
Constants ¶
This section is empty.
Variables ¶
var AllPlaybooks map[string]*Playbook
AllPlaybooks is a map of playbook id's to playbooks
var ManifestExtension = ".yml"
ManifestExtension is added to each task manifest item to make a filename
Functions ¶
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 ¶
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 ¶
ReadPlaybookFromDisk takes a filename and returns a byte array. Alias for ioutil.ReadFile
Types ¶
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 ¶
Manifest represents a kubernetes manifest file Filename is used as identifier in the current implementation.
func NewManifest ¶
NewManifest creates a new Manifest object and parses (but does not execute) the template
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 ¶
ParsePlaybook unmarshalls a YAML byte sequence into a Playbook struct
func (*Playbook) ValidateTasks ¶
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
type Step ¶
Step represents a deployment step
func NewManifestStep ¶
NewManifestStep creates a default step
func NewPodManifestStep ¶
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 ¶
ManifestsPresent iterates through the Manifests and PodManifest items on a task, and checks that each represents a file on disk