deployer

package
v0.0.0-...-926346d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NomadPlanIndexMetaKey = "__NomadPlanIndexMetaKey"
	RawResponse           = "__RawResponse"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppFile

type AppFile struct {
	SourcePath  string `yaml:"src"`
	Destination string `yaml:"destination"`
	Environment bool   `yaml:"env"`
}

type AppResource

type AppResource struct {
	MBits  uint `yaml:"mbits"`
	CPU    uint `yaml:"cpu"`
	Memory uint `yaml:"memory"`
}

type Config

type Config struct {
	ServiceName string           `yaml:"service_name"`
	Image       string           `yaml:"image"`
	Count       uint             `yaml:"count"`
	Canary      uint             `yaml:"count"`
	AutoRevert  bool             `yaml:"auto_revert"`
	AutoPromote bool             `yaml:"auto_promote"`
	MaxParallel uint             `yaml:"max_parallel"`
	AppFiles    []AppFile        `yaml:"app_files"`
	Entrypoint  []string         `yaml:"entrypoint"`
	Directory   []Directory      `yaml:"directories"`
	Services    []ConsulService  `yaml:"services"`
	Resources   AppResource      `yaml:"resources"`
	Constraints []MetaConstraint `yaml:"constraints"`
	ExtraHosts  []string         `yaml:"extra_hosts"`
}

func NewSpec

func NewSpec() *Config

func (*Config) GetSpec

func (s *Config) GetSpec() Spec

func (*Config) GetVersion

func (s *Config) GetVersion() string

func (*Config) Merge

func (s *Config) Merge(other Config) error

type ConsulService

type ConsulService struct {
	Name           string   `yaml:"name"`
	Port           string   `yaml:"port"`
	Prometheus     bool     `yaml:"prometheus"`
	PrometheusPort string   `yaml:"prometheus_port"`
	Tags           []string `yaml:"tags"`
}

type Deployer

type Deployer interface {
	// GenerateJobSpec will merge all job into one and return
	// Nomad: HCL/JSON
	// K8S	: YAML/JSON
	GenerateJobSpec(jobTemplateFile string, jobConfigFiles []string, workingDir string) (jobSpec *Spec, err error)
	// Diff show what changes will be made
	// The diff between current state and new desired state
	// Nomad: nomad plan
	// K8S	: kubectl diff
	Diff(jobSpec *Spec) (diff *Spec, meta map[string]interface{}, err error)
	// Deploy Job. Extends var may be good for some system. Eg: Nomad will use update-index to safeguard deployment
	Deploy(jobSpec *Spec, extendVars map[string]interface{}) (deployResult *Spec, err error)

	GenerateJobSpecV1(levantJobFile string, jobCfg Config) (jobSpec *Spec, err error)
}

type Directory

type Directory string

func (Directory) GetBindPath

func (d Directory) GetBindPath() string

func (Directory) GetHostPath

func (d Directory) GetHostPath() string

type Executor

type Executor interface {
	Exec(ctx context.Context,
		deployer Deployer,
		job Job) error
}

type Job

type Job interface {
	GetVersion() string
	GetSpec() Spec
}

type MetaConstraint

type MetaConstraint string

func (MetaConstraint) GetMetaKey

func (m MetaConstraint) GetMetaKey() string

func (MetaConstraint) GetValue

func (m MetaConstraint) GetValue() string

type Spec

type Spec struct {
	Content     string
	ContentType beauter.ContentType
}

func (*Spec) Pretty

func (s *Spec) Pretty() string

func (*Spec) Write

func (s *Spec) Write(writer io.Writer) error

type Storer

type Storer interface {
	Store(projectId string, jobSpec, deployResultSpec *Spec, meta map[string]interface{}) error
	Close() error
}

Directories

Path Synopsis
spec
v1

Jump to

Keyboard shortcuts

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