Documentation
¶
Index ¶
- Constants
- Variables
- func DumpDeployments(io io.Writer, ds Deployments)
- func SetupLogging(il ILogger)
- func TabbedDeploymentHeaders() string
- type Advisories
- type AdvisoryName
- type Annotation
- type BuildArtifact
- type BuildConfig
- type BuildContext
- type BuildManager
- type BuildResult
- type Buildpack
- type ChangeError
- type Changes
- type Cluster
- type Clusters
- type CreateError
- type Debug
- type Defs
- type DeleteError
- type DeployConfig
- type DeployID
- type DeploySpec
- type DeploySpecs
- type Deployer
- type Deployment
- type DeploymentPair
- type DeploymentPairs
- type DeploymentPredicate
- type Deployments
- func (m Deployments) Add(v *Deployment) (ok bool)
- func (m Deployments) AddAll(from Deployments) (conflicting DeployID, success bool)
- func (m Deployments) Any(predicate func(*Deployment) bool) (*Deployment, bool)
- func (m Deployments) Clone() Deployments
- func (d Deployments) Diff(other Deployments) DiffChans
- func (m Deployments) Filter(predicate func(*Deployment) bool) Deployments
- func (m Deployments) FilteredSnapshot(predicate func(*Deployment) bool) map[DeployID](*Deployment)
- func (m Deployments) Get(key DeployID) (v *Deployment, ok bool)
- func (m Deployments) GetAll() map[DeployID](*Deployment)
- func (m Deployments) Keys() []DeployID
- func (m Deployments) Len() int
- func (ds Deployments) Manifests(defs Defs) (Manifests, error)
- func (m Deployments) Merge(other Deployments) Deployments
- func (m Deployments) MustAdd(v *Deployment)
- func (m Deployments) Remove(key DeployID)
- func (m Deployments) Set(key DeployID, value *Deployment)
- func (m *Deployments) SetAll(v map[DeployID](*Deployment))
- func (m Deployments) Single(predicate func(*Deployment) bool) (*Deployment, bool)
- func (m Deployments) Snapshot() map[DeployID](*Deployment)
- type DetectResult
- type DiffChans
- type DummyRegistry
- func (dc *DummyRegistry) FeedArtifact(ba *BuildArtifact, e error)
- func (dc *DummyRegistry) FeedSourceID(sid SourceID, e error)
- func (dc *DummyRegistry) FeedSourceIDList(sids []SourceID, e error)
- func (dc *DummyRegistry) GetArtifact(sid SourceID) (*BuildArtifact, error)
- func (dc *DummyRegistry) GetSourceID(*BuildArtifact) (SourceID, error)
- func (dc *DummyRegistry) ListSourceIDs() ([]SourceID, error)
- func (dc *DummyRegistry) Warmup(string) error
- type DumperEntry
- type EchoSelector
- type Env
- type EnvDef
- type EnvDefaults
- type EnvDefs
- type Error
- type GenericHost
- type ILogger
- type IncludesVersion
- type Info
- type Labeller
- type LogSet
- type Machine
- type Manifest
- type ManifestID
- type ManifestKind
- type Manifests
- func (m Manifests) Add(v *Manifest) (ok bool)
- func (m Manifests) AddAll(from Manifests) (conflicting ManifestID, success bool)
- func (m Manifests) Any(predicate func(*Manifest) bool) (*Manifest, bool)
- func (m Manifests) Clone() Manifests
- func (m Manifests) Filter(predicate func(*Manifest) bool) Manifests
- func (m Manifests) FilteredSnapshot(predicate func(*Manifest) bool) map[ManifestID](*Manifest)
- func (m Manifests) Get(key ManifestID) (v *Manifest, ok bool)
- func (m Manifests) GetAll() map[ManifestID](*Manifest)
- func (m Manifests) Keys() []ManifestID
- func (m Manifests) Len() int
- func (m Manifests) Merge(other Manifests) Manifests
- func (m Manifests) MustAdd(v *Manifest)
- func (m Manifests) Remove(key ManifestID)
- func (m Manifests) Set(key ManifestID, value *Manifest)
- func (m *Manifests) SetAll(v map[ManifestID](*Manifest))
- func (m Manifests) Single(predicate func(*Manifest) bool) (*Manifest, bool)
- func (m Manifests) Snapshot() map[ManifestID](*Manifest)
- type Message
- type Messenger
- type MissingImageNameError
- type MissingPath
- type MissingRepo
- type MissingVersion
- type OwnerSet
- type Quality
- type RectificationError
- type Registrar
- type Registry
- type RegistryDumper
- type ResDef
- type ResDefs
- type ResolveErrors
- type Resolver
- type Resources
- type ScratchContext
- type Selector
- type Source
- type SourceContext
- type SourceHost
- type SourceHostChooser
- type SourceID
- type SourceLocation
- func (sl SourceLocation) MarshalText() ([]byte, error)
- func (sl SourceLocation) MarshalYAML() (interface{}, error)
- func (sl SourceLocation) SourceID(version semv.Version) SourceID
- func (sl SourceLocation) String() string
- func (sl *SourceLocation) UnmarshalText(b []byte) error
- func (sl *SourceLocation) UnmarshalYAML(unmarshal func(interface{}) error) error
- type State
- type Tag
- type UnacceptableAdvisory
- type Var
- type VarType
- type Volume
- type VolumeMode
- type Volumes
- type Warning
Constants ¶
const ( UnknownRepo = AdvisoryName(`source workspace lacked repo`) NoRepoAdv = AdvisoryName(`no repository`) NotRequestedRevision = AdvisoryName(`requested revision not built`) Unversioned = AdvisoryName(`no versioned tag`) TagMismatch = AdvisoryName(`tag mismatch`) TagNotHead = AdvisoryName(`tag not on built revision`) EphemeralTag = AdvisoryName(`ephemeral tag`) UnpushedRev = AdvisoryName(`unpushed revision`) BogusRev = AdvisoryName(`bogus revision`) DirtyWS = AdvisoryName(`dirty workspace`) )
const DefaultDelim = ","
DefaultDelim is the default delimiter between parts of the string representation of a SourceID or a SourceLocation.
const FlavorSeparator = "~"
FlavorSeparator separates the flavor part of a ManifestID from the SourceLocation part.
Variables ¶
var ( // Log collects various loggers to use for different levels of logging Log = func() LogSet { warnLogger := log.New(os.Stderr, "warn: ", 0) return LogSet{ Vomit: log.New(ioutil.Discard, "vomit: ", log.Lshortfile), Debug: log.New(ioutil.Discard, "debug: ", log.Lshortfile), Info: warnLogger, Notice: warnLogger, Warn: warnLogger, } }() )
Functions ¶
func DumpDeployments ¶
func DumpDeployments(io io.Writer, ds Deployments)
func SetupLogging ¶
func SetupLogging(il ILogger)
SetupLogging sets up an ILogger to log into the Sous logging regime
func TabbedDeploymentHeaders ¶
func TabbedDeploymentHeaders() string
TabbedDeploymentHeaders returns the names of the fields for Tabbed, suitable for use with text/tabwriter.
Types ¶
type Advisories ¶
type Advisories []AdvisoryName
type Annotation ¶
type Annotation struct {
// RequestID stores the Singularity Request ID that was used for this
// deployment.
RequestID string
}
An Annotation stores notes about data available from the source of of a Deployment. For instance, the Id field from the source SingularityRequest for a Deployment can be stored to refer to the source post-diff. They don't participate in equality checks on the deployment.
type BuildArtifact ¶
BuildArtifact describes the actual built binary Sous will deploy
type BuildConfig ¶
type BuildConfig struct {
Repo, Offset, Tag, Revision string
Strict, ForceClone bool
Context *BuildContext
}
BuildConfig captures the user's intent as they build a repo
func (*BuildConfig) Advisories ¶
func (c *BuildConfig) Advisories(ctx *BuildContext) (advs []string)
Advisories does this:
func (*BuildConfig) GuardRegister ¶
func (c *BuildConfig) GuardRegister(bc *BuildContext) error
GuardRegister returns an error if any development-only advisories exist
func (*BuildConfig) GuardStrict ¶
func (c *BuildConfig) GuardStrict(bc *BuildContext) error
GuardStrict returns an error if there are imperfections in the proposed build
func (*BuildConfig) NewContext ¶
func (c *BuildConfig) NewContext() *BuildContext
NewContext returns a new BuildContext updated based on the user's intent as expressed in the Config
func (*BuildConfig) Validate ¶
func (c *BuildConfig) Validate() error
Validate checks that the Config is well formed
type BuildContext ¶
type BuildContext struct {
Sh shell.Shell
Source SourceContext
Scratch ScratchContext
Machine Machine
User user.User
Changes Changes
Advisories []string
}
BuildContext contains all the data required to perform a build.
func (*BuildContext) Version ¶
func (bc *BuildContext) Version() SourceID
Version returns the SourceID for this build
type BuildManager ¶
type BuildManager struct {
BuildConfig *BuildConfig
Selector
Labeller
Registrar
}
BuildManager collects and orchestrates the various components that are involved with making a build happen
func (*BuildManager) Build ¶
func (m *BuildManager) Build() (*BuildResult, error)
Build implements sous.Builder.Build
type BuildResult ¶
type BuildResult struct {
ImageID string
VersionName, RevisionName string
Advisories []string
Elapsed time.Duration
}
BuildResult represents the result of a build made with a Buildpack.
func (*BuildResult) String ¶
func (br *BuildResult) String() string
type Buildpack ¶
type Buildpack interface {
Detect(*BuildContext) (*DetectResult, error)
Build(*BuildContext) (*BuildResult, error)
}
Buildpack is a set of instructions used to build a particular kind of project.
type ChangeError ¶
type ChangeError struct {
Deployments *DeploymentPair
Err error
}
ChangeError describes an error that occurred while trying to change one deployment into another
func (*ChangeError) Error ¶
func (e *ChangeError) Error() string
func (*ChangeError) ExistingDeployment ¶
func (e *ChangeError) ExistingDeployment() *Deployment
ExistingDeployment returns the deployment that was already existent in a change error
func (*ChangeError) IntendedDeployment ¶
func (e *ChangeError) IntendedDeployment() *Deployment
IntendedDeployment returns the deployment that was intended in a ChangeError
type Changes ¶
type Changes struct {
SousUpdated, NewCommit, NewTag, NewFiles, ChangedFiles []string
}
Changes represents a set of changes that have happened since this project was last built on the current machine by the current user.
type Cluster ¶
type Cluster struct {
// Name is the unique name of this cluster.
Name string
// Kind is the kind of cluster. Currently the only legal value is
// "singularity"
Kind string
// BaseURL is the main entrypoint URL for interacting with this cluster.
BaseURL string
// Env is the default environment for all deployments in this region.
Env EnvDefaults
// AllowedAdvisories lists the artifact advisories which are permissible in
// this cluster
AllowedAdvisories []string
}
Cluster is a logical deployment target, often named for its region, purpose, etc.
type CreateError ¶
type CreateError struct {
Deployment *Deployment
Err error
}
CreateError is returned when there's an error trying to create a deployment
func (*CreateError) Error ¶
func (e *CreateError) Error() string
func (*CreateError) ExistingDeployment ¶
func (e *CreateError) ExistingDeployment() *Deployment
ExistingDeployment returns the deployment that was already existent in a change error
func (*CreateError) IntendedDeployment ¶
func (e *CreateError) IntendedDeployment() *Deployment
IntendedDeployment returns the deployment that was intended in a ChangeError
type Defs ¶
type Defs struct {
// DockerRepo is the host:port (no schema) to connect to the Docker repository
DockerRepo string
// Clusters is a collection of logical deployment environments.
Clusters Clusters
// EnvVars contains definitions for global environment variables.
EnvVars EnvDefs
// Resources contains definitions for resource types available to
// deployment manifests.
Resources ResDefs
}
Defs holds definitions for organisation-level objects.
type DeleteError ¶
type DeleteError struct {
Deployment *Deployment
Err error
}
DeleteError is returned when there's an error while trying to delete a deployment
func (*DeleteError) Error ¶
func (e *DeleteError) Error() string
func (*DeleteError) ExistingDeployment ¶
func (e *DeleteError) ExistingDeployment() *Deployment
ExistingDeployment returns the deployment that was already existent in a change error
func (*DeleteError) IntendedDeployment ¶
func (e *DeleteError) IntendedDeployment() *Deployment
IntendedDeployment returns the deployment that was intended in a ChangeError
type DeployConfig ¶
type DeployConfig struct {
// Resources represents the resources each instance of this software
// will be given by the execution environment.
Resources Resources `yaml:",omitempty" validate:"keys=nonempty,values=nonempty"`
// Env is a list of environment variables to set for each instance of
// of this deployment. It will be checked for conflict with the
// definitions found in State.Defs.EnvVars, and if not in conflict
// assumes the greatest priority.
Args []string `yaml:",omitempty" validate:"values=nonempty"`
Env `yaml:",omitempty" validate:"keys=nonempty,values=nonempty"`
// NumInstances is a guide to the number of instances that should be
// deployed in this cluster, note that the actual number may differ due
// to decisions made by Sous. If set to zero, Sous will decide how many
// instances to launch.
NumInstances int
// Volumes lists the volume mappings for this deploy
Volumes Volumes
}
DeployConfig represents the configuration of a deployment's tasks, in a specific cluster. i.e. their resources, environment, and the number of instances.
func (*DeployConfig) Equal ¶
func (dc *DeployConfig) Equal(o DeployConfig) bool
Equal is used to compare DeployConfigs
func (*DeployConfig) String ¶
func (dc *DeployConfig) String() string
type DeployID ¶
type DeployID struct {
ManifestID ManifestID
Cluster string
}
A DeployID identifies a deployment.
type DeploySpec ¶
type DeploySpec struct {
// DeployConfig contains config information for this deployment, see
// DeployConfig.
DeployConfig `yaml:",inline"`
// Version is a semantic version with the following properties:
//
// 1. The major/minor/patch/pre-release fields exist as a tag in
// the source code repository containing this application.
// 2. The metadata field is the full revision ID of the commit
// which the tag in 1. points to.
Version semv.Version `validate:"nonzero"`
// contains filtered or unexported fields
}
DeploySpec is the interface to describe a cluster-wide deployment of an application described by a Manifest. Together with the manifest, one can assemble full Deployments.
Unexported fields in DeploymentSpec are not intended to be serialised to/from yaml, but are useful when set internally.
func (DeploySpec) Equal ¶
func (spec DeploySpec) Equal(other DeploySpec) bool
Equal returns true if other equals spec.
type DeploySpecs ¶
type DeploySpecs map[string]DeploySpec
DeploySpecs is a collection of Deployments associated with a manifest.
type Deployer ¶
type Deployer interface {
RunningDeployments(from Clusters) (Deployments, error)
RectifyCreates(<-chan *Deployment, chan<- RectificationError)
RectifyDeletes(<-chan *Deployment, chan<- RectificationError)
RectifyModifies(<-chan *DeploymentPair, chan<- RectificationError)
}
Deployer describes a complete deployment system, which is able to create, read, update, and delete deployments.
type Deployment ¶
type Deployment struct {
// DeployConfig contains configuration info for this deployment,
// including environment variables, resources, suggested instance count.
DeployConfig `yaml:"inline"`
// ClusterNickname is the human name for a cluster - it's taken from the
// hash key that defines the cluster and is used in manifests to configure
// cluster-local deployment config.
ClusterName string
// Cluster is the name of the cluster this deployment belongs to. Upon
// parsing the Manifest, this will be set to the key in
// Manifests.Deployments which points at this Deployment.
Cluster *Cluster
// SourceID is the precise version of the software to be deployed.
SourceID SourceID
// Flavor is the flavor of this deployment. See ManifestID for a fuller
// description.
Flavor string
// Owners is a map of named owners of this repository. The type of this
// field is subject to change.
Owners OwnerSet
// Kind is the kind of software that SourceRepo represents.
Kind ManifestKind
// Volumes enumerates the volume mappings required.
Volumes Volumes
// Notes collected from the deployment's source.
Annotation
}
Deployment is a completely configured deployment of a piece of software. It contains all the data necessary for Sous to create a single deployment, which is a single version of a piece of software, running in a single cluster.
func BuildDeployment ¶
func BuildDeployment(s *State, m *Manifest, nick string, spec DeploySpec, inherit []DeploySpec) (*Deployment, error)
BuildDeployment constructs a deployment out of a Manifest.
func (*Deployment) Equal ¶
func (d *Deployment) Equal(o *Deployment) bool
Equal returns true if two Deployments are equal.
func (*Deployment) ID ¶
func (d *Deployment) ID() DeployID
ID returns the DeployID of this deployment.
func (*Deployment) ManifestID ¶ added in v0.0.2
func (d *Deployment) ManifestID() ManifestID
ManifestID returns the ID of the Manifest describing this deployment.
func (*Deployment) String ¶
func (d *Deployment) String() string
func (*Deployment) Tabbed ¶
func (d *Deployment) Tabbed() string
Tabbed returns the fields of a deployment formatted in a tab delimited list.
type DeploymentPair ¶
type DeploymentPair struct {
Prior, Post *Deployment
// contains filtered or unexported fields
}
DeploymentPair is a pair of deployments that represent a "before and after" style relationship
type DeploymentPairs ¶
type DeploymentPairs []*DeploymentPair
DeploymentPairs is a list of DeploymentPair
type DeploymentPredicate ¶
type DeploymentPredicate func(*Deployment) bool
DeploymentPredicate takes a *Deployment and returns true if the deployment matches the predicate. Used by Filter to select a subset of a Deployments.
type Deployments ¶
type Deployments struct {
// contains filtered or unexported fields
}
Deployments is a wrapper around map[DeployID]*Deployment which is safe for concurrent read and write.
func MakeDeployments ¶
func MakeDeployments(capacity int) Deployments
MakeDeployments creates a new Deployments with capacity set.
func NewDeployments ¶
func NewDeployments(from ...(*Deployment)) Deployments
NewDeployments creates a new Deployments. You may optionally pass any number of *Deployments, which will be added to this map.
func NewDeploymentsFromMap ¶
func NewDeploymentsFromMap(from ...map[DeployID](*Deployment)) Deployments
NewDeploymentsFromMap creates a new Deployments. You may optionally pass any number of map[DeployID]*Deployments, which will be merged key-wise into the new Deployments, with keys from the right-most map taking precedence.
func (Deployments) Add ¶
func (m Deployments) Add(v *Deployment) (ok bool)
Add adds a (k, v) pair into a map if it is not already there. Returns true if the value was added, false if not.
func (Deployments) AddAll ¶
func (m Deployments) AddAll(from Deployments) (conflicting DeployID, success bool)
AddAll returns (zero DeployID, true) if all entries from the passed in Deployments have different keys and all are added to this Deployments. If any of the keys conflict, nothing will be added to this Deployments and AddAll will return the conflicting DeployID and false.
func (Deployments) Any ¶
func (m Deployments) Any(predicate func(*Deployment) bool) (*Deployment, bool)
Any returns (a single *Deployment matching predicate, true), if there are any *Deployments matching predicate in Deployments. Otherwise returns (zero *Deployment, false).
func (Deployments) Clone ¶
func (m Deployments) Clone() Deployments
Clone returns a pairwise copy of Deployments.
func (Deployments) Diff ¶
func (d Deployments) Diff(other Deployments) DiffChans
Diff computes the differences between two sets of Deployments
func (Deployments) Filter ¶
func (m Deployments) Filter(predicate func(*Deployment) bool) Deployments
Filter returns a new Deployments containing only the entries where the predicate returns true for the given value. A nil predicate is equivalent to calling Clone.
func (Deployments) FilteredSnapshot ¶
func (m Deployments) FilteredSnapshot(predicate func(*Deployment) bool) map[DeployID](*Deployment)
FilteredSnapshot returns a moment-in-time filtered copy of the current underlying map[DeployID]*Deployment. (DeployID, *Deployment) pairs are included if they satisfy predicate.
func (Deployments) Get ¶
func (m Deployments) Get(key DeployID) (v *Deployment, ok bool)
Get returns (value, true) if k is in the map, or (zero value, false) otherwise.
func (Deployments) GetAll ¶
func (m Deployments) GetAll() map[DeployID](*Deployment)
GetAll returns SnapShot (it allows hy to marshal Deployments).
func (Deployments) Keys ¶
func (m Deployments) Keys() []DeployID
Keys returns a slice containing all the keys in the map.
func (Deployments) Manifests ¶
func (ds Deployments) Manifests(defs Defs) (Manifests, error)
Manifests creates manifests from deployments.
func (Deployments) Merge ¶
func (m Deployments) Merge(other Deployments) Deployments
Merge returns a new Deployments with all entries from this Deployments and the other. If any keys in other match keys in this *Deployments, keys from other will appear in the returned *Deployments.
func (Deployments) MustAdd ¶
func (m Deployments) MustAdd(v *Deployment)
MustAdd is a wrapper around Add which panics whenever Add returns false.
func (Deployments) Remove ¶
func (m Deployments) Remove(key DeployID)
Remove value for a key k if present, a no-op otherwise.
func (Deployments) Set ¶
func (m Deployments) Set(key DeployID, value *Deployment)
Set sets the value of index k to v.
func (*Deployments) SetAll ¶
func (m *Deployments) SetAll(v map[DeployID](*Deployment))
SetAll sets the internal map (it allows hy to unmarshal Deployments). Note: SetAll is the only method that is not safe for concurrent access.
func (Deployments) Single ¶
func (m Deployments) Single(predicate func(*Deployment) bool) (*Deployment, bool)
Single returns (the single *Deployment satisfying predicate, true), if there is exactly one *Deployment satisfying predicate in Deployments. Otherwise, returns (zero *Deployment, false).
func (Deployments) Snapshot ¶
func (m Deployments) Snapshot() map[DeployID](*Deployment)
Snapshot returns a moment-in-time copy of the current underlying map[DeployID]*Deployment.
type DetectResult ¶
DetectResult represents the result of a detection.
type DiffChans ¶
type DiffChans struct {
Created, Deleted, Retained chan *Deployment
Modified chan *DeploymentPair
}
DiffChans is a set of channels that represent differences between two sets of Deployments as they're discovered
type DummyRegistry ¶
type DummyRegistry struct {
// contains filtered or unexported fields
}
DummyNameCache implements the Builder interface by returning a computed image name for a given source ID.
func NewDummyRegistry ¶
func NewDummyRegistry() *DummyRegistry
NewDummyRegistry builds a new DummyNameCache.
func (*DummyRegistry) FeedArtifact ¶
func (dc *DummyRegistry) FeedArtifact(ba *BuildArtifact, e error)
func (*DummyRegistry) FeedSourceID ¶
func (dc *DummyRegistry) FeedSourceID(sid SourceID, e error)
func (*DummyRegistry) FeedSourceIDList ¶
func (dc *DummyRegistry) FeedSourceIDList(sids []SourceID, e error)
func (*DummyRegistry) GetArtifact ¶
func (dc *DummyRegistry) GetArtifact(sid SourceID) (*BuildArtifact, error)
func (*DummyRegistry) GetSourceID ¶
func (dc *DummyRegistry) GetSourceID(*BuildArtifact) (SourceID, error)
GetSourceID implements part of ImageMapper
func (*DummyRegistry) ListSourceIDs ¶
func (dc *DummyRegistry) ListSourceIDs() ([]SourceID, error)
ListSourceIDs implements Registry
func (*DummyRegistry) Warmup ¶
func (dc *DummyRegistry) Warmup(string) error
Warmup implements Registry
type DumperEntry ¶
type DumperEntry struct {
SourceID
*BuildArtifact
}
DumperEntry is a single entry from the dump
func (*DumperEntry) Tabbed ¶
func (de *DumperEntry) Tabbed() string
Tabbed emits a tab-delimited string representing the entry
type EchoSelector ¶
type EchoSelector struct {
Factory func(*BuildContext) (Buildpack, error)
}
EchoSelector wraps a buildpack Factory. But why?
func (*EchoSelector) SelectBuildpack ¶
func (s *EchoSelector) SelectBuildpack(c *BuildContext) (Buildpack, error)
SelectBuildpack tries to select a buildpack for this BuildContext.
type Env ¶
Env is a mapping of environment variable name to value, used to provision single instances of an application.
type EnvDefaults ¶
EnvDefaults is a list of named environment variables along with their values.
type GenericHost ¶ added in v0.0.2
type GenericHost struct{}
GenericHost implements SourceHost, and is used as a fallback when none of the other SourceHosts are compatible with a SourceID.
func (GenericHost) CanParseSourceLocation ¶ added in v0.0.2
func (h GenericHost) CanParseSourceLocation(string) bool
CanParseSourceLocation always returns true.
func (GenericHost) GetSource ¶ added in v0.0.2
func (h GenericHost) GetSource(id SourceID) (Source, error)
GetSource always returns an error, since there is no generic way to get source code.
func (GenericHost) Owns ¶ added in v0.0.2
func (h GenericHost) Owns(SourceLocation) bool
Owns always returns true.
func (GenericHost) ParseSourceLocation ¶ added in v0.0.2
func (h GenericHost) ParseSourceLocation(s string) (SourceLocation, error)
ParseSourceLocation defers to the global ParseSourceLocation.
type ILogger ¶
type ILogger interface {
SetLogFunc(func(...interface{}))
SetDebugFunc(func(...interface{}))
}
ILogger is like this: XXX This is a complete placeholder for work in the ilog branch I needed some extra logging for config process, and didn't want to double down on a process we knew we were going to abandon XXX Further thought: I really think we should look log15 (or something) as our logging platform. It won't be perfect, but it also won't suck up work
type IncludesVersion ¶
type IncludesVersion struct {
// contains filtered or unexported fields
}
IncludesVersion indicates that Sous couldn't determine what version was intended for this SL
func (*IncludesVersion) Error ¶
func (err *IncludesVersion) Error() string
type Labeller ¶
type Labeller interface {
ApplyMetadata(*BuildResult, *BuildContext) error
}
Labeller defines a container-based build system.
type LogSet ¶
type LogSet struct {
Debug *log.Logger
Info *log.Logger
Warn *log.Logger
Notice *log.Logger
Vomit *log.Logger
}
LogSet is the stopgap for a decent injectable logger
type Machine ¶
type Machine struct {
Host, FullHost string
}
Machine represents a specific computer.
type Manifest ¶
type Manifest struct {
// Source is the location of the source code for this piece of software.
Source SourceLocation `validate:"nonzero"`
// Flavor is an optional string, used to allow a single SourceLocation
// to have multiple deployments defined per cluster. The empty Flavor
// is perfectly valid. The pair (SourceLocation, Flavor) identifies a
// manifest.
Flavor string `yaml:",omitempty"`
// Owners is a list of named owners of this repository. The type of this
// field is subject to change.
Owners []string
// Kind is the kind of software that SourceRepo represents.
Kind ManifestKind `validate:"nonzero"`
// Deployments is a map of cluster names to DeploymentSpecs
Deployments DeploySpecs `validate:"keys=nonempty,values=nonzero"`
}
Manifest is a minimal representation of the global deployment state of a particular named application. It is designed to be written and read by humans as-is, and expanded into full Deployments internally. It is a DTO, which can be stored in YAML files.
Manifest has a direct two-way mapping to/from Deployments.
func (*Manifest) FileLocation ¶
FileLocation returns the path that the manifest should be saved to.
func (*Manifest) SetID ¶ added in v0.0.2
func (m *Manifest) SetID(mid ManifestID)
SetID sets the Source and Flavor fields of this Manifest to those of the supplied ManifestID.
type ManifestID ¶ added in v0.0.2
type ManifestID struct {
// Source is the SourceLocation of deployments described in this Manifest.
Source SourceLocation
// Flavor is an optional string which can be appended if multiple different
// deployments of code from this SourceLocation need to be deployed in the
// same cluster.
Flavor string
}
ManifestID identifies a manifest by its SourceLocation and optional Flavor.
func MustParseManifestID ¶ added in v0.0.2
func MustParseManifestID(s string) ManifestID
MustParseManifestID wraps ParseManifestID and panics if it returns an error.
func ParseManifestID ¶ added in v0.0.2
func ParseManifestID(s string) (ManifestID, error)
ParseManifestID parses a ManifestID from a SourceLocation.
func (ManifestID) MarshalText ¶ added in v0.0.2
func (mid ManifestID) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler. This is important for serialising maps that use ManifestID as a key.
func (ManifestID) MarshalYAML ¶ added in v0.0.2
func (mid ManifestID) MarshalYAML() (interface{}, error)
MarshalYAML serializes this ManifestID to a YAML string. It implements the github.com/go-yaml/yaml.Marshaler interface.
func (ManifestID) String ¶ added in v0.0.2
func (mid ManifestID) String() string
func (*ManifestID) UnmarshalText ¶ added in v0.0.2
func (mid *ManifestID) UnmarshalText(b []byte) error
UnmarshalText implements encoding.TextMarshaler. This is important for deserialising maps that use ManifestID as a key.
func (*ManifestID) UnmarshalYAML ¶ added in v0.0.2
func (mid *ManifestID) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML deserializes a YAML string into this ManifestID. It implements the github.com/go-yaml/yaml.Unmarshaler interface.
type ManifestKind ¶
type ManifestKind string
ManifestKind describes the broad category of a piece of software, such as a long-running HTTP service, or a scheduled task, etc. It is used to determine resource sets and contracts that can be run on this application.
const ( // ManifestKindService represents an HTTP service which is a long-running process, // and listens and responds to HTTP requests. ManifestKindService (ManifestKind) = "http-service" // ManifestKindWorker represents a worker process. ManifestKindWorker (ManifestKind) = "worker" // ManifestKindOnDemand represents an on-demand service. ManifestKindOnDemand (ManifestKind) = "on-demand" // ManifestKindScheduled represents a scheduled task. ManifestKindScheduled (ManifestKind) = "scheduled" // ManifestKindOnce represents a one-off job. ManifestKindOnce (ManifestKind) = "once" // ScheduledJob represents a process which starts on some schedule, and // exits when it completes its task. ScheduledJob = "scheduled-job" )
type Manifests ¶
type Manifests struct {
// contains filtered or unexported fields
}
Manifests is a wrapper around map[ManifestID]*Manifest which is safe for concurrent read and write.
func MakeManifests ¶
MakeManifests creates a new Manifests with capacity set.
func NewManifests ¶
NewManifests creates a new Manifests. You may optionally pass any number of *Manifests, which will be added to this map.
func NewManifestsFromMap ¶
func NewManifestsFromMap(from ...map[ManifestID](*Manifest)) Manifests
NewManifestsFromMap creates a new Manifests. You may optionally pass any number of map[ManifestID]*Manifests, which will be merged key-wise into the new Manifests, with keys from the right-most map taking precedence.
func (Manifests) Add ¶
Add adds a (k, v) pair into a map if it is not already there. Returns true if the value was added, false if not.
func (Manifests) AddAll ¶
func (m Manifests) AddAll(from Manifests) (conflicting ManifestID, success bool)
AddAll returns (zero ManifestID, true) if all entries from the passed in Manifests have different keys and all are added to this Manifests. If any of the keys conflict, nothing will be added to this Manifests and AddAll will return the conflicting ManifestID and false.
func (Manifests) Any ¶
Any returns (a single *Manifest matching predicate, true), if there are any *Manifests matching predicate in Manifests. Otherwise returns (zero *Manifest, false).
func (Manifests) Filter ¶
Filter returns a new Manifests containing only the entries where the predicate returns true for the given value. A nil predicate is equivalent to calling Clone.
func (Manifests) FilteredSnapshot ¶
func (m Manifests) FilteredSnapshot(predicate func(*Manifest) bool) map[ManifestID](*Manifest)
FilteredSnapshot returns a moment-in-time filtered copy of the current underlying map[ManifestID]*Manifest. (ManifestID, *Manifest) pairs are included if they satisfy predicate.
func (Manifests) Get ¶
func (m Manifests) Get(key ManifestID) (v *Manifest, ok bool)
Get returns (value, true) if k is in the map, or (zero value, false) otherwise.
func (Manifests) GetAll ¶
func (m Manifests) GetAll() map[ManifestID](*Manifest)
GetAll returns SnapShot (it allows hy to marshal Manifests).
func (Manifests) Keys ¶
func (m Manifests) Keys() []ManifestID
Keys returns a slice containing all the keys in the map.
func (Manifests) Merge ¶
Merge returns a new Manifests with all entries from this Manifests and the other. If any keys in other match keys in this *Manifests, keys from other will appear in the returned *Manifests.
func (Manifests) Remove ¶
func (m Manifests) Remove(key ManifestID)
Remove value for a key k if present, a no-op otherwise.
func (Manifests) Set ¶
func (m Manifests) Set(key ManifestID, value *Manifest)
Set sets the value of index k to v.
func (*Manifests) SetAll ¶
func (m *Manifests) SetAll(v map[ManifestID](*Manifest))
SetAll sets the internal map (it allows hy to unmarshal Manifests). Note: SetAll is the only method that is not safe for concurrent access.
func (Manifests) Single ¶
Single returns (the single *Manifest satisfying predicate, true), if there is exactly one *Manifest satisfying predicate in Manifests. Otherwise, returns (zero *Manifest, false).
func (Manifests) Snapshot ¶
func (m Manifests) Snapshot() map[ManifestID](*Manifest)
Snapshot returns a moment-in-time copy of the current underlying map[ManifestID]*Manifest.
type Messenger ¶
Messenger creates and sends messages. It has an internal queue, and tries hard not to block.
func NewMessenger ¶
type MissingImageNameError ¶
type MissingImageNameError struct {
Cause error
}
MissingImageNameError reports that we couldn't get names for one or more source IDs.
func (*MissingImageNameError) Error ¶
func (e *MissingImageNameError) Error() string
type MissingPath ¶
type MissingPath struct {
// contains filtered or unexported fields
}
MissingPath indicates that Sous couldn't determine what repo offset was intended for this SL
func (*MissingPath) Error ¶
func (err *MissingPath) Error() string
type MissingRepo ¶
type MissingRepo struct {
// contains filtered or unexported fields
}
MissingRepo indicates that Sous couldn't determine which repo was intended for this SL
func (*MissingRepo) Error ¶
func (err *MissingRepo) Error() string
type MissingVersion ¶
type MissingVersion struct {
// contains filtered or unexported fields
}
MissingVersion indicates that Sous couldn't determine what version was intended for this SL
func (*MissingVersion) Error ¶
func (err *MissingVersion) Error() string
type OwnerSet ¶
type OwnerSet map[string]struct{}
OwnerSet collects the names of the owners of a deployment.
func NewOwnerSet ¶ added in v0.0.2
NewOwnerSet creates a new owner set from the provided list of owners.
type Quality ¶
type Quality struct {
Name string
// Kind is the the kind of this quality
// Known kinds include: advisory
Kind string
}
A Quality represents a characteristic of a BuildArtifact that needs to be recorded.
type RectificationError ¶
type RectificationError interface {
error
ExistingDeployment() *Deployment
IntendedDeployment() *Deployment
}
RectificationError is an interface that extends error with methods to get the deployments the preceeded and were intended when the error occurred
type Registrar ¶
type Registrar interface {
// Register takes a BuildResult and makes it available for the deployment
// target system to find during deployment
Register(*BuildResult, *BuildContext) error
}
Registrar defines the interface to register build results to be deployed later
type Registry ¶
type Registry interface {
// GetArtifact gets the build artifact address for a source ID.
// It does not guarantee that that artifact exists.
GetArtifact(SourceID) (*BuildArtifact, error)
// GetSourceID gets the source ID associated with the
// artifact, regardless of the existence of the artifact.
GetSourceID(*BuildArtifact) (SourceID, error)
// ListSourceIDs returns a list of known SourceIDs
ListSourceIDs() ([]SourceID, error)
// Warmup requests that the registry check specific artifact names for existence
// the details of this behavior will vary by implementation. For Docker, for instance,
// the corresponding repo is enumerated
Warmup(string) error
}
Registry describes a system for mapping SourceIDs to BuildArtifacts and vice versa
type RegistryDumper ¶
type RegistryDumper struct {
Registry
}
RegistryDumper dumps the contents of artifact registries
func NewRegistryDumper ¶
func NewRegistryDumper(r Registry) *RegistryDumper
NewRegistryDumper constructs a RegistryDumper
func (*RegistryDumper) AsTable ¶
func (rd *RegistryDumper) AsTable(to io.Writer) error
AsTable writes a tabular dump of the registry to a Writer
func (*RegistryDumper) Entries ¶
func (rd *RegistryDumper) Entries() (de []DumperEntry, err error)
Entries emits the list of entries for the Resgistry
func (*RegistryDumper) TabbedHeaders ¶
func (rd *RegistryDumper) TabbedHeaders() string
TabbedHeaders outputs the headers for the dump
type ResDef ¶
type ResDef struct {
// Name is the name of the resource, e.g. "Memory", "CPU", "NumPorts"
Name string
// Type is the type of value used to represent quantities or instances
// of this resource, e.g. MemorySize, Float, or Int (not yet implemented).
Type VarType
}
ResDef is a resource type definition.
type ResolveErrors ¶
type ResolveErrors struct {
Causes []error
}
ResolveErrors collect all the errors for a resolve action into a single error to be handled elsewhere
func (*ResolveErrors) Error ¶
func (re *ResolveErrors) Error() string
type Resolver ¶
type Resolver struct {
Deployer Deployer
Registry Registry
Filter DeploymentPredicate
}
Resolver is responsible for resolving intended and actual deployment states.
func NewResolver ¶
func NewResolver(d Deployer, r Registry, fv ...DeploymentPredicate) *Resolver
NewResolver creates a new Resolver.
func (*Resolver) Resolve ¶
func (r *Resolver) Resolve(intended Deployments, clusters Clusters) error
Resolve drives the Sous deployment resolution process. It calls out to the appropriate components to compute the intended deployment set, collect the actual set, compute the diffs and then issue the commands to rectify those differences.
type Resources ¶
Resources is a mapping of resource name to value, used to provision single instances of an application. It is validated against State.Defs.Resources. The keys must match defined resource names, and the values must parse to the defined types.
type ScratchContext ¶
ScratchContext represents an isolated copy of a project's source code somewhere on the host machine running Sous.
type Selector ¶
type Selector interface {
SelectBuildpack(*BuildContext) (Buildpack, error)
}
A Selector selects the buildpack for a given build context
type Source ¶ added in v0.0.2
type Source struct {
// ID is the identity of this source.
ID SourceID
// Context contains info about this repo
Context SourceContext
// LocalRootDir is the absolute path on the local filesystem to the cloned
// repository root.
LocalRootDir string
// LocalOffsetDir is the absolute path on the local filesystem to the offset
// matching ID.Location.Dir.
LocalOffsetDir string
}
Source represents a body of source code.
type SourceContext ¶
type SourceContext struct {
RootDir, OffsetDir, Branch, Revision string
Files, ModifiedFiles, NewFiles []string
Tags []Tag
NearestTagName, NearestTagRevision string
PrimaryRemoteURL string
RemoteURL string
RemoteURLs []string
DirtyWorkingTree bool
RevisionUnpushed bool
}
SourceContext contains contextual information about the source code being built.
func (*SourceContext) AbsDir ¶
func (sc *SourceContext) AbsDir() string
AbsDir returns the absolute path of this source code.
func (*SourceContext) SourceLocation ¶
func (sc *SourceContext) SourceLocation() SourceLocation
SourceLocation returns the source location in this context.
func (*SourceContext) Version ¶
func (sc *SourceContext) Version() SourceID
Version returns the SourceID.
type SourceHost ¶ added in v0.0.2
type SourceHost interface {
// CanParseSourceLocation returns true if this SourceHost should attempt to
// parse the string. If CanParseSourceLocation returns true, Sous will not
// attempt to parse using any other SourceHost.
CanParseSourceLocation(string) bool
// ParseSourceLocation parses a SourceLocation from a string.
ParseSourceLocation(string) (SourceLocation, error)
// Owns returns true if this SourceHost owns the provided SourceLocation.
Owns(SourceLocation) bool
// GetSource returns the source code for this SourceID.
GetSource(SourceID) (Source, error)
}
SourceHost represents a source code repository host.
type SourceHostChooser ¶ added in v0.0.2
type SourceHostChooser struct {
// SourceHosts is an ordered list of SourceHosts. The order is significant,
// earlier SourceHosts beat later ones.
SourceHosts []SourceHost
}
SourceHostChooser wraps a slice of SourceHosts and delegates to the most appropriate one for various tasks.
func (*SourceHostChooser) ParseSourceLocation ¶ added in v0.0.2
func (e *SourceHostChooser) ParseSourceLocation(s string) (SourceLocation, error)
ParseSourceLocation tries to parse a SourceLocation using the first SourceHost that returns true for CanParseSourceLocation(s).
It returns an error if the chosen SouceHost returns an error, or if none of the SourceHosts return true for CanParseSourceLocation(s).
type SourceID ¶
type SourceID struct {
// Location is the repo/dir pair indicating the location of the source
// code. Note that not all locations will be valid with all Versions.
Location SourceLocation
// Version identifies a specific version of the source code at Repo/Dir.
Version semv.Version
}
SourceID identifies a specific snapshot of a body of source code, including its location and version.
func MustNewSourceID ¶ added in v0.0.2
MustNewSourceID wraps NewSourceID and panics if it returns an error.
func MustParseSourceID ¶
MustParseSourceID wraps ParseSourceID and panics if it returns an error.
func NewSourceID ¶ added in v0.0.2
NewSourceID attempts to create a new SourceID from strings representing the separate components.
func ParseSourceID ¶
ParseSourceID parses an entire SourceID.
type SourceLocation ¶
type SourceLocation struct {
// Repo identifies a source code repository.
Repo,
Dir string
}
SourceLocation identifies a directory inside a source code repository. Note that the directory is ambiguous without the addition of a revision ID.
func MustParseSourceLocation ¶
func MustParseSourceLocation(s string) SourceLocation
MustParseSourceLocation wraps ParseSourceLocation but panics instead of returning a non-nil error.
func NewSourceLocation ¶
func NewSourceLocation(repoURL, repoOffset string) SourceLocation
NewSourceLocation creates a new SourceLocation from strings.
func ParseSourceLocation ¶
func ParseSourceLocation(s string) (SourceLocation, error)
ParseSourceLocation parses an entire SourceLocation.
func (SourceLocation) MarshalText ¶
func (sl SourceLocation) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (SourceLocation) MarshalYAML ¶
func (sl SourceLocation) MarshalYAML() (interface{}, error)
MarshalYAML serializes this SourceLocation to a YAML document.
func (SourceLocation) SourceID ¶
func (sl SourceLocation) SourceID(version semv.Version) SourceID
SourceID returns a SourceID built from this location with the addition of a version.
func (SourceLocation) String ¶
func (sl SourceLocation) String() string
func (*SourceLocation) UnmarshalText ¶
func (sl *SourceLocation) UnmarshalText(b []byte) error
UnmarshalText implements encoding.TextMarshaler.
func (*SourceLocation) UnmarshalYAML ¶
func (sl *SourceLocation) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML deserializes a YAML document into this SourceLocation
type State ¶
type State struct {
// Defs contains global definitions for this organisation.
Defs Defs `hy:"defs"`
// Manifests contains a mapping of source code repositories to global
// deployment configurations for artifacts built using that source code.
Manifests Manifests `hy:"manifests/"`
// contains filtered or unexported fields
}
State contains the mutable state of an organisation's deployments. State is also known as the "Global Deploy Manifest" or GDM.
func (*State) BaseURLs ¶
BaseURLs returns the urls for all the clusters referred to in this state XXX - deprecate/remove
func (*State) ClusterMap ¶
ClusterMap returns the nicknames for all the clusters referred to in this state paired with the URL for the named cluster
func (*State) Deployments ¶
func (s *State) Deployments() (Deployments, error)
Deployments returns all deployments described by the state.
func (*State) DeploymentsFromManifest ¶
func (s *State) DeploymentsFromManifest(m *Manifest) (Deployments, error)
DeploymentsFromManifest returns all deployments described by a single manifest, in terms of the wider state (i.e. global and cluster definitions and configuration).
func (*State) OnlyCluster ¶
OnlyCluster sets a contraint on the State such that it will only consider a particular cluster
type UnacceptableAdvisory ¶
An UnacceptableAdvisory reports that there is an advisory on an image which hasn't been whitelisted on the target cluster
func (*UnacceptableAdvisory) Error ¶
func (e *UnacceptableAdvisory) Error() string
type Var ¶
type Var string
Var is a strongly typed string for use in environment variables and YAML files. It will implement sane YAML marshalling and unmarshalling. (Not yet implemented.)
type Volume ¶
type Volume struct {
Host, Container string
Mode VolumeMode
}
Volume describes a deployment's volume mapping
type VolumeMode ¶
type VolumeMode string
VolumeMode is either readwrite or readonly
const ( // ReadOnly specifies that a volume can only be read ReadOnly VolumeMode = "RO" // ReadWrite specifies that the container can write to the volume ReadWrite VolumeMode = "RW" )
Source Files
¶
- build_config.go
- build_context.go
- build_manager.go
- buildpack.go
- deploy_config.go
- deploy_spec.go
- deployer.go
- deployment.go
- deployment_diff.go
- deployment_dumper.go
- deployments_generated.go
- dummy_registry.go
- logging.go
- manifest.go
- manifest_id.go
- manifests_generated.go
- map_state_to_deployments.go
- messages.go
- owner_set.go
- registry.go
- registry_dumper.go
- resolve_errors.go
- resolver.go
- resources.go
- source.go
- source_context.go
- source_host.go
- source_host_chooser.go
- source_id.go
- source_location.go
- state.go
- volumes.go