model

package
v0.0.0-...-5a1c513 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 17 Imported by: 8

Documentation

Index

Constants

View Source
const (
	RoleTypeBoshTask = RoleType("bosh-task") // A role that is a BOSH task
	RoleTypeBosh     = RoleType("bosh")      // A role that is a BOSH job
	RoleTypeDocker   = RoleType("docker")    // A role that is a raw Docker image
)

These are the types of roles available

View Source
const (
	FlightStagePreFlight  = FlightStage("pre-flight")  // A role that runs before the main jobs start
	FlightStageFlight     = FlightStage("flight")      // A role that is a main job
	FlightStagePostFlight = FlightStage("post-flight") // A role that runs after the main jobs are up
	FlightStageManual     = FlightStage("manual")      // A role that only runs via user intervention
)

These are the flight stages available

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Templates map[string]string          `yaml:"templates"`
	Variables ConfigurationVariableSlice `yaml:"variables"`
}

Configuration contains information about how to configure the resulting images

type ConfigurationVariable

type ConfigurationVariable struct {
	Name        string                          `yaml:"name"`
	Default     interface{}                     `yaml:"default"`
	Description string                          `yaml:"description"`
	Generator   *ConfigurationVariableGenerator `yaml:"generator"`
}

ConfigurationVariable is a configuration to be exposed to the IaaS

type ConfigurationVariableGenerator

type ConfigurationVariableGenerator struct {
	ID        string `yaml:"id"`
	Type      string `yaml:"type"`
	ValueType string `yaml:"value_type"`
}

ConfigurationVariableGenerator describes how to automatically generate values for a configuration variable

type ConfigurationVariableSlice

type ConfigurationVariableSlice []*ConfigurationVariable

ConfigurationVariableSlice is a sortable slice of ConfigurationVariables

func (ConfigurationVariableSlice) Len

func (confVars ConfigurationVariableSlice) Len() int

Len is the number of ConfigurationVariables in the slice

func (ConfigurationVariableSlice) Less

func (confVars ConfigurationVariableSlice) Less(i, j int) bool

Less reports whether config variable at index i sort before the one at index j

func (ConfigurationVariableSlice) Swap

func (confVars ConfigurationVariableSlice) Swap(i, j int)

Swap exchanges configuration variables at index i and index j

type FlightStage

type FlightStage string

FlightStage describes when a role should be executed

type HealthCheck

type HealthCheck struct {
	URL     string            `yaml:"url"`     // URL for a HTTP GET to return 200~399. Cannot be used with other checks.
	Headers map[string]string `yaml:"headers"` // Custom headers; only used for URL.
	Command []string          `yaml:"command"` // Custom command. Cannot be used with other checks.
	Port    int32             `yaml:"port"`    // Port for a TCP probe. Cannot be used with other checks.
}

HealthCheck describes a non-standard health check endpoint

type Job

type Job struct {
	Name        string
	Description string
	Templates   []*JobTemplate
	Packages    Packages
	Path        string
	Fingerprint string
	SHA1        string
	Properties  []*JobProperty
	Version     string
	Release     *Release
	// contains filtered or unexported fields
}

Job represents a BOSH job

func (*Job) Extract

func (j *Job) Extract(destination string) (string, error)

Extract will extract the contents of the job archive to destination It creates a directory with the name of the job Returns the full path of the extracted archive

func (*Job) MergeSpec

func (j *Job) MergeSpec(otherJob *Job)

MergeSpec is used to merge temporary spec patches into each job. otherJob should only be the hcf/patch-properties job. The code assumes package and property objects are immutable, as they're now being shared across jobs. Also, when specified packages or properties are specified in the "other" job, that one takes precedence.

func (*Job) ValidateSHA1

func (j *Job) ValidateSHA1() error

ValidateSHA1 validates that the SHA1 of the actual job archive is the same as the one from the release manifest

func (*Job) WriteConfigs

func (j *Job) WriteConfigs(role *Role, outputPath, lightOpinionsPath, darkOpinionsPath string) (err error)

WriteConfigs merges the job's spec with the opinions and writes out the result as JSON to the specified path.

type JobProperty

type JobProperty struct {
	Name        string
	Description string
	Default     interface{}
	Job         *Job
}

JobProperty is a generic key-value property referenced by a job

type JobTemplate

type JobTemplate struct {
	SourcePath      string
	DestinationPath string
	Job             *Job
	Content         string
}

JobTemplate represents a BOSH job template

type Jobs

type Jobs []*Job

Jobs is an array of Job*

func (Jobs) Len

func (slice Jobs) Len() int

Len implements the Len function to satisfy sort.Interface

func (Jobs) Less

func (slice Jobs) Less(i, j int) bool

Less implements the Less function to satisfy sort.Interface

func (Jobs) Swap

func (slice Jobs) Swap(i, j int)

Swap implements the Swap function to satisfy sort.Interface

type Package

type Package struct {
	Name         string
	Version      string
	Fingerprint  string
	SHA1         string
	Release      *Release
	Path         string
	Dependencies Packages
	// contains filtered or unexported fields
}

Package represents a BOSH package

func (*Package) Extract

func (p *Package) Extract(destination string) (string, error)

Extract will extract the contents of the package archive to destination It creates a directory with the name of the package Returns the full path of the extracted archive

func (*Package) GetPackageCompiledDir

func (p *Package) GetPackageCompiledDir(workDir string) string

GetPackageCompiledDir returns the path to the build result directory of the package, underneath the main cache directory

func (*Package) GetPackageCompiledTempDir

func (p *Package) GetPackageCompiledTempDir(workDir string) string

GetPackageCompiledTempDir returns the path to the build temp directory for the package, underneath the main cache directory

func (*Package) GetTargetPackageSourcesDir

func (p *Package) GetTargetPackageSourcesDir(workDir string) string

GetTargetPackageSourcesDir returns the path to the sources of the package, underneath the main cache directory

func (*Package) ValidateSHA1

func (p *Package) ValidateSHA1() error

ValidateSHA1 validates that the SHA1 of the actual package archive is the same as the one from the release manifest

type Packages

type Packages []*Package

Packages is an array of *Package

func (Packages) Len

func (slice Packages) Len() int

Len implements the Len function to satisfy sort.Interface

func (Packages) Less

func (slice Packages) Less(i, j int) bool

Less implements the Less function to satisfy sort.Interface

func (Packages) Swap

func (slice Packages) Swap(i, j int)

Swap implements the Swap function to satisfy sort.Interface

type Release

type Release struct {
	Jobs               Jobs
	Packages           Packages
	License            ReleaseLicense
	Name               string
	UncommittedChanges bool
	CommitHash         string
	Version            string
	Path               string
	DevBOSHCacheDir    string
	// contains filtered or unexported fields
}

Release represents a BOSH release

func NewDevRelease

func NewDevRelease(path, releaseName, version, boshCacheDir string) (*Release, error)

NewDevRelease will create an instance of a BOSH development release

func (*Release) GetUniqueConfigs

func (r *Release) GetUniqueConfigs() map[string]*ReleaseConfig

GetUniqueConfigs returns all unique configs available in a release

func (*Release) LookupJob

func (r *Release) LookupJob(jobName string) (*Job, error)

LookupJob will find a job within a BOSH release

func (*Release) LookupPackage

func (r *Release) LookupPackage(packageName string) (*Package, error)

LookupPackage will find a package within a BOSH release

type ReleaseConfig

type ReleaseConfig struct {
	Name        string
	Description string
	Jobs        Jobs
	UsageCount  int
}

ReleaseConfig is a global deployment configuration key

type ReleaseLicense

type ReleaseLicense struct {
	// Files is a mapping of license file names to contents
	Files map[string][]byte
	// Release this license belongs to
	Release *Release
}

ReleaseLicense represents the license of a BOSH release

type Role

type Role struct {
	Name              string         `yaml:"name"`
	Jobs              Jobs           `yaml:"_,omitempty"`
	EnvironScripts    []string       `yaml:"environment_scripts"`
	Scripts           []string       `yaml:"scripts"`
	PostConfigScripts []string       `yaml:"post_config_scripts"`
	Type              RoleType       `yaml:"type,omitempty"`
	JobNameList       []*roleJob     `yaml:"jobs"`
	Configuration     *Configuration `yaml:"configuration"`
	Run               *RoleRun       `yaml:"run"`
	Tags              []string       `yaml:"tags"`
	// contains filtered or unexported fields
}

Role represents a collection of jobs that are colocated on a container

func (*Role) GetRoleDevVersion

func (r *Role) GetRoleDevVersion() string

GetRoleDevVersion gets the aggregate signature of all jobs and packages

func (*Role) GetScriptPaths

func (r *Role) GetScriptPaths() map[string]string

GetScriptPaths returns the paths to the startup / post configgin scripts for a role

func (*Role) GetVariablesForRole

func (r *Role) GetVariablesForRole() (ConfigurationVariableSlice, error)

GetVariablesForRole returns all the environment variables required for calculating all the templates for the role

func (*Role) HasTag

func (r *Role) HasTag(tag string) bool

HasTag returns true if the role has a specific tag

type RoleManifest

type RoleManifest struct {
	Roles         Roles          `yaml:"roles"`
	Configuration *Configuration `yaml:"configuration"`
	// contains filtered or unexported fields
}

RoleManifest represents a collection of roles

func LoadRoleManifest

func LoadRoleManifest(manifestFilePath string, releases []*Release, skipDev bool) (*RoleManifest, error)

LoadRoleManifest loads a yaml manifest that details how jobs get grouped into roles

func (*RoleManifest) GetRoleManifestDevPackageVersion

func (m *RoleManifest) GetRoleManifestDevPackageVersion(extra string) string

GetRoleManifestDevPackageVersion gets the aggregate signature of all the packages

func (*RoleManifest) LookupRole

func (m *RoleManifest) LookupRole(roleName string) *Role

LookupRole will find the given role in the role manifest

type RoleRun

type RoleRun struct {
	Scaling           *RoleRunScaling       `yaml:"scaling"`
	Capabilities      []string              `yaml:"capabilities"`
	PersistentVolumes []*RoleRunVolume      `yaml:"persistent-volumes"`
	SharedVolumes     []*RoleRunVolume      `yaml:"shared-volumes"`
	Memory            int                   `yaml:"memory"`
	VirtualCPUs       int                   `yaml:"virtual-cpus"`
	ExposedPorts      []*RoleRunExposedPort `yaml:"exposed-ports"`
	FlightStage       FlightStage           `yaml:"flight-stage"`
	HealthCheck       *HealthCheck          `yaml:"healthcheck,omitempty"`
}

RoleRun describes how a role should behave at runtime

type RoleRunExposedPort

type RoleRunExposedPort struct {
	Name     string `yaml:"name"`
	Protocol string `yaml:"protocol"`
	External string `yaml:"external"`
	Internal string `yaml:"internal"`
	Public   bool   `yaml:"public"`
}

RoleRunExposedPort describes a port to be available to other roles, or the outside world

type RoleRunScaling

type RoleRunScaling struct {
	Min int32 `yaml:"min"`
	Max int32 `yaml:"max"`
}

RoleRunScaling describes how a role should scale out at runtime

type RoleRunVolume

type RoleRunVolume struct {
	Path string `yaml:"path"`
	Tag  string `yaml:"tag"`
	Size int    `yaml:"size"`
}

RoleRunVolume describes a volume to be attached at runtime

type RoleType

type RoleType string

RoleType is the type of the role; see the constants below

type Roles

type Roles []*Role

Roles is an array of Role*

func (Roles) Len

func (roles Roles) Len() int

Len is the number of roles in the slice

func (Roles) Less

func (roles Roles) Less(i, j int) bool

Less reports whether role at index i sort before role at index j

func (Roles) Swap

func (roles Roles) Swap(i, j int)

Swap exchanges roles at index i and index j

Jump to

Keyboard shortcuts

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