README
¶
Flux
Flux is a tool for deploying container images to Kubernetes clusters.
Please start by browsing through the documentation below.
Developer information
Contribution
Flux follows a typical PR workflow. All contributions should be made as PRs that satisfy the guidelines below.
Guidelines
- All code must abide Go Code Review Comments
- Names should abide What's in a name
- Code must build on both Linux and Darwin, via plain
go build
- Code should have appropriate test coverage, invoked via plain
go test
In addition, several mechanical checks are enforced. See the lint script for details.
Getting Help
If you have any questions about Flux and continuous delivery:
- Invite yourself to the #weave-community slack channel.
- Ask a question on the #weave-community slack channel.
- Join the Weave User Group and get invited to online talks, hands-on training and meetups in your area.
- Send an email to weave-users@weave.works
- File an issue.
Your feedback is always welcome!
Documentation
¶
Index ¶
- Constants
- Variables
- func UnderlyingError(err error) error
- type Auth
- type BaseError
- type ConfigPatch
- type Container
- type ContainerUpdate
- type Event
- type EventID
- type FluxdStatus
- type FluxsvcStatus
- type GitConfig
- type GitStatus
- type HelpfulError
- type HistoryEntry
- type Image
- type ImageDescription
- type ImageID
- func (i ImageID) Components() (host, repo, tag string)
- func (i ImageID) FullID() string
- func (i ImageID) HostNamespaceImage() string
- func (i ImageID) MarshalJSON() ([]byte, error)
- func (i ImageID) NamespaceImage() string
- func (i ImageID) Repository() string
- func (i ImageID) String() string
- func (i *ImageID) UnmarshalJSON(data []byte) (err error)
- type ImageSpec
- type ImageStatus
- type InstanceConfig
- type InstanceID
- type Missing
- type NotifierConfig
- type Policy
- type RegistryConfig
- type Release
- type ReleaseCause
- type ReleaseEventMetadata
- type ReleaseID
- type ReleaseKind
- type ReleaseResult
- type ReleaseSpec
- type SafeInstanceConfig
- type ServerException
- type ServiceID
- type ServiceIDSet
- func (s ServiceIDSet) Add(ids []ServiceID)
- func (s ServiceIDSet) Contains(id ServiceID) bool
- func (s ServiceIDSet) Intersection(others ServiceIDSet) ServiceIDSet
- func (s ServiceIDSet) String() string
- func (s ServiceIDSet) ToSlice() ServiceIDs
- func (s ServiceIDSet) Without(others ServiceIDSet) ServiceIDSet
- type ServiceIDs
- func (ids ServiceIDs) Contains(id ServiceID) bool
- func (ids ServiceIDs) Intersection(others ServiceIDSet) ServiceIDSet
- func (p ServiceIDs) Len() int
- func (p ServiceIDs) Less(i, j int) bool
- func (p ServiceIDs) Sort()
- func (p ServiceIDs) Swap(i, j int)
- func (ids ServiceIDs) Without(others ServiceIDSet) (res ServiceIDs)
- type ServiceReleaseStatus
- type ServiceResult
- type ServiceSpec
- type ServiceStatus
- type Status
- type Token
- type UnsafeInstanceConfig
- type UserConfigProblem
Constants ¶
const ( EventRelease = "release" EventAutomate = "automate" EventDeautomate = "deautomate" EventLock = "lock" EventUnlock = "unlock" LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelWarn = "warn" LogLevelError = "error" )
These are all the types of events.
const ( ServiceSpecAll = ServiceSpec("<all>") ImageSpecLatest = ImageSpec("<all latest>") ImageSpecNone = ImageSpec("<no updates>") PolicyNone = Policy("") PolicyLocked = Policy("locked") PolicyAutomated = Policy("automated") )
const DefaultInstanceID = "<default-instance-id>"
const InstanceIDHeaderKey = "X-Scope-OrgID"
const UserAutomated = "<automated>"
Variables ¶
var ( ErrInvalidImageID = errors.New("invalid image ID") ErrBlankImageID = errors.Wrap(ErrInvalidImageID, "blank image name") ErrMalformedImageID = errors.Wrap(ErrInvalidImageID, `expected image name as either <image>:<tag> or just <image>`) )
var ( ErrInvalidServiceID = errors.New("invalid service ID") ErrInvalidReleaseKind = errors.New("invalid release kind") )
Functions ¶
func UnderlyingError ¶
Types ¶
type BaseError ¶
type BaseError struct { // a message that can be printed out for the user Help string `json:"help"` // the underlying error that can be e.g., logged for developers to look at Err error }
func CoverAllError ¶
func (*BaseError) MarshalJSON ¶
func (*BaseError) UnmarshalJSON ¶
type ConfigPatch ¶
type ConfigPatch map[string]interface{}
type Container ¶
type Container struct { Name string Current ImageDescription Available []ImageDescription }
type ContainerUpdate ¶
type Event ¶
type Event struct { // ID is a UUID for this event. Will be auto-set when saving if blank. ID EventID `json:"id"` // ServiceIDs affected by this event. ServiceIDs []ServiceID `json:"serviceIDs"` // Type is the type of event, usually "release" for now, but could be other // things later Type string `json:"type"` // StartedAt is the time the event began. StartedAt time.Time `json:"startedAt"` // EndedAt is the time the event ended. For instantaneous events, this will // be the same as StartedAt. EndedAt time.Time `json:"endedAt"` // LogLevel for this event. Used to indicate how important it is. // `debug|info|warn|error` LogLevel string `json:"logLevel"` // Message is a pre-formatted string for errors and other stuff. Included for // backwards-compatibility, and is now somewhat unnecessary. Should only be // used if metadata is empty. Message string `json:"message,omitempty"` // Metadata is Event.Type-specific metadata. If an event has no metadata, // this will be nil. Metadata interface{} `json:"metadata,omitempty"` }
func (Event) ServiceIDStrings ¶
type FluxdStatus ¶
type FluxsvcStatus ¶
type FluxsvcStatus struct {
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}
type GitConfig ¶
type HelpfulError ¶
type HelpfulError interface {
Base() *BaseError
}
type HistoryEntry ¶
type HistoryEntry struct { Stamp *time.Time `json:",omitempty"` Type string Data string Event *Event `json:",omitempty"` }
Ask me for more details.
type Image ¶
Image can't really be a primitive string only, because we need to also record information about its creation time. (maybe more in the future)
type ImageDescription ¶
type ImageID ¶
type ImageID struct {
Host, Namespace, Image, Tag string
}
ImageID is a fully qualified name that refers to a particular Image. It is in the format: host[:port]/Namespace/Image[:tag] Here, we refer to the "name" == Namespace/Image
func ParseImageID ¶
func (ImageID) Components ¶
func (ImageID) HostNamespaceImage ¶
HostNamespaceImage includes all parts of the image, even if it is from dockerhub.
func (ImageID) MarshalJSON ¶
ImageID is serialized/deserialized as a string
func (ImageID) NamespaceImage ¶
func (ImageID) Repository ¶
Repository returns the short version of an image's repository (trimming if dockerhub)
func (*ImageID) UnmarshalJSON ¶
ImageID is serialized/deserialized as a string
type ImageSpec ¶
type ImageSpec string
ImageSpec is an ImageID, or "<all latest>" (update all containers to the latest available), or "<no updates>" (do not update any images)
func ImageSpecFromID ¶
func ParseImageSpec ¶
type ImageStatus ¶
type InstanceConfig ¶
type InstanceConfig struct { Git GitConfig `json:"git" yaml:"git"` Slack NotifierConfig `json:"slack" yaml:"slack"` Registry RegistryConfig `json:"registry" yaml:"registry"` }
func (InstanceConfig) HideSecrets ¶
func (c InstanceConfig) HideSecrets() SafeInstanceConfig
func (InstanceConfig) MarshalJSON ¶
func (c InstanceConfig) MarshalJSON() ([]byte, error)
type InstanceID ¶
type InstanceID string
type Missing ¶
type Missing struct {
*BaseError
}
The thing you asked for just doesn't exist. Sorry!
type NotifierConfig ¶
type NotifierConfig struct { HookURL string `json:"hookURL" yaml:"hookURL"` Username string `json:"username" yaml:"username"` ReleaseTemplate string `json:"releaseTemplate" yaml:"releaseTemplate"` }
NotifierConfig is the config used to set up a notifier.
type Policy ¶
type Policy string
Policy is an string, denoting the current deployment policy of a service, e.g. automated, or locked.
func ParsePolicy ¶
type RegistryConfig ¶
type Release ¶
type Release struct { ID ReleaseID `json:"id"` CreatedAt time.Time `json:"createdAt"` StartedAt time.Time `json:"startedAt"` EndedAt time.Time `json:"endedAt"` Done bool `json:"done"` Priority int `json:"priority"` Status ServiceReleaseStatus `json:"status"` Log []string `json:"log"` Cause ReleaseCause `json:"cause"` Spec ReleaseSpec `json:"spec"` Result ReleaseResult `json:"result"` }
Release describes a release
type ReleaseCause ¶
How did this release get triggered?
type ReleaseEventMetadata ¶
type ReleaseEventMetadata struct { // Release points to this release Release Release `json:"release"` // Message of the error if there was one. Error string `json:"error,omitempty"` }
ReleaseEventMetadata is the metadata for when service(s) are released
type ReleaseKind ¶
type ReleaseKind string
ReleaseKind says whether a release is to be planned only, or planned then executed
const ( ReleaseKindPlan ReleaseKind = "plan" ReleaseKindExecute = "execute" )
func ParseReleaseKind ¶
func ParseReleaseKind(s string) (ReleaseKind, error)
type ReleaseResult ¶
type ReleaseResult map[ServiceID]ServiceResult
func (ReleaseResult) Error ¶
func (r ReleaseResult) Error() string
Error returns the error for this release (if any) TODO: should we concat them here? or what if there are multiple?
func (ReleaseResult) ImageIDs ¶
func (r ReleaseResult) ImageIDs() []string
func (ReleaseResult) ServiceIDs ¶
func (r ReleaseResult) ServiceIDs() []string
type ReleaseSpec ¶
type ReleaseSpec struct { ServiceSpecs []ServiceSpec ImageSpec ImageSpec Kind ReleaseKind Excludes []ServiceID }
NB: these get sent from fluxctl, so we have to maintain the json format of this. Eugh.
func (ReleaseSpec) ReleaseType ¶
func (s ReleaseSpec) ReleaseType() string
ReleaseType gives a one-word description of the release, mainly useful for labelling metrics or log messages.
type SafeInstanceConfig ¶
type SafeInstanceConfig InstanceConfig
type ServerException ¶
type ServerException struct {
*BaseError
}
Something unexpected and bad happened and we're not sure why, but if you retry it may have come right again.
type ServiceID ¶
type ServiceID string // "default/helloworld"
func MakeServiceID ¶
func ParseServiceID ¶
func (ServiceID) Components ¶
type ServiceIDSet ¶
type ServiceIDSet map[ServiceID]struct{}
func (ServiceIDSet) Add ¶
func (s ServiceIDSet) Add(ids []ServiceID)
func (ServiceIDSet) Contains ¶
func (s ServiceIDSet) Contains(id ServiceID) bool
func (ServiceIDSet) Intersection ¶
func (s ServiceIDSet) Intersection(others ServiceIDSet) ServiceIDSet
func (ServiceIDSet) String ¶
func (s ServiceIDSet) String() string
func (ServiceIDSet) ToSlice ¶
func (s ServiceIDSet) ToSlice() ServiceIDs
func (ServiceIDSet) Without ¶
func (s ServiceIDSet) Without(others ServiceIDSet) ServiceIDSet
type ServiceIDs ¶
type ServiceIDs []ServiceID
func (ServiceIDs) Contains ¶
func (ids ServiceIDs) Contains(id ServiceID) bool
func (ServiceIDs) Intersection ¶
func (ids ServiceIDs) Intersection(others ServiceIDSet) ServiceIDSet
func (ServiceIDs) Len ¶
func (p ServiceIDs) Len() int
func (ServiceIDs) Less ¶
func (p ServiceIDs) Less(i, j int) bool
func (ServiceIDs) Sort ¶
func (p ServiceIDs) Sort()
func (ServiceIDs) Swap ¶
func (p ServiceIDs) Swap(i, j int)
func (ServiceIDs) Without ¶
func (ids ServiceIDs) Without(others ServiceIDSet) (res ServiceIDs)
type ServiceReleaseStatus ¶
type ServiceReleaseStatus string
const ( ReleaseStatusPending ServiceReleaseStatus = "pending" ReleaseStatusSuccess ServiceReleaseStatus = "success" ReleaseStatusFailed ServiceReleaseStatus = "failed" ReleaseStatusSkipped ServiceReleaseStatus = "skipped" ReleaseStatusIgnored ServiceReleaseStatus = "ignored" ReleaseStatusUnknown ServiceReleaseStatus = "unknown" )
type ServiceResult ¶
type ServiceResult struct { Status ServiceReleaseStatus // summary of what happened, e.g., "incomplete", "ignored", "success" Error string `json:",omitempty"` // error if there was one finding the service (e.g., it doesn't exist in repo) PerContainer []ContainerUpdate // what happened with each container }
func (ServiceResult) Msg ¶
func (fr ServiceResult) Msg(id ServiceID) string
type ServiceSpec ¶
type ServiceSpec string // ServiceID or "<all>"
func ParseServiceSpec ¶
func ParseServiceSpec(s string) (ServiceSpec, error)
func (ServiceSpec) AsID ¶
func (s ServiceSpec) AsID() (ServiceID, error)
func (ServiceSpec) String ¶
func (s ServiceSpec) String() string
type ServiceStatus ¶
type ServiceStatus struct { ID ServiceID Containers []Container Status string Automated bool Locked bool }
func (ServiceStatus) Policies ¶
func (s ServiceStatus) Policies() string
type Status ¶
type Status struct { Fluxsvc FluxsvcStatus `json:"fluxsvc" yaml:"fluxsvc"` Fluxd FluxdStatus `json:"fluxd" yaml:"fluxd"` Git GitStatus `json:"git" yaml:"git"` }
TODO: How similar should this be to the `get-config` result?
type UnsafeInstanceConfig ¶
type UnsafeInstanceConfig InstanceConfig
func (UnsafeInstanceConfig) Patch ¶
func (uic UnsafeInstanceConfig) Patch(cp ConfigPatch) (UnsafeInstanceConfig, error)
type UserConfigProblem ¶
type UserConfigProblem struct {
*BaseError
}
A problem that is most likely caused by the user's configuration being incomplete or incorrect. For example, not having supplied a git repo.
Directories
¶
Path | Synopsis |
---|---|
Package automator implements continuous deployment.
|
Package automator implements continuous deployment. |
cmd
|
|
integrations
|
|
Package platform will hold abstractions and data types common to supported platforms.
|
Package platform will hold abstractions and data types common to supported platforms. |
kubernetes
Package kubernetes provides abstractions for the Kubernetes platform.
|
Package kubernetes provides abstractions for the Kubernetes platform. |
Monitoring middlewares for registry interfaces Package registry provides domain abstractions over container registries.
|
Monitoring middlewares for registry interfaces Package registry provides domain abstractions over container registries. |