flux

package module
v0.3.0-prep Latest Latest
Warning

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

Go to latest
Published: May 4, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

README

Flux

Flux is a tool for deploying container images to Kubernetes clusters.

Flux Example

Please start by browsing through the documentation below.

Introduction to Flux

Installing Flux

Using Flux

FAQ

Troubleshooting

Developer information

Build documentation

Release documentation

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:

Your feedback is always welcome!

Documentation

Index

Constants

View Source
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.

View Source
const (
	ServiceSpecAll  = ServiceSpec("<all>")
	ImageSpecLatest = ImageSpec("<all latest>")
	ImageSpecNone   = ImageSpec("<no updates>")
	PolicyNone      = Policy("")
	PolicyLocked    = Policy("locked")
	PolicyAutomated = Policy("automated")
)
View Source
const DefaultInstanceID = "<default-instance-id>"
View Source
const InstanceIDHeaderKey = "X-Scope-OrgID"
View Source
const UserAutomated = "<automated>"

Variables

View Source
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>`)
)
View Source
var (
	ErrInvalidServiceID   = errors.New("invalid service ID")
	ErrInvalidReleaseKind = errors.New("invalid release kind")
)

Functions

func UnderlyingError

func UnderlyingError(err error) error

Types

type Auth

type Auth struct {
	Auth string `json:"auth" yaml:"auth"`
}

func (Auth) HidePassword

func (a Auth) HidePassword() Auth

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 CoverAllError(err error) *BaseError

func (*BaseError) Base

func (e *BaseError) Base() *BaseError

func (*BaseError) Error

func (e *BaseError) Error() string

func (*BaseError) MarshalJSON

func (e *BaseError) MarshalJSON() ([]byte, error)

func (*BaseError) UnmarshalJSON

func (e *BaseError) UnmarshalJSON(data []byte) error

type ConfigPatch

type ConfigPatch map[string]interface{}

type Container

type Container struct {
	Name      string
	Current   ImageDescription
	Available []ImageDescription
}

type ContainerUpdate

type ContainerUpdate struct {
	Container string
	Current   ImageID
	Target    ImageID
}

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

func (e Event) ServiceIDStrings() []string

func (Event) String

func (e Event) String() string

type EventID

type EventID int64

type FluxdStatus

type FluxdStatus struct {
	Connected bool   `json:"connected" yaml:"connected"`
	Version   string `json:"version,omitempty" yaml:"version,omitempty"`
}

type FluxsvcStatus

type FluxsvcStatus struct {
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

type GitConfig

type GitConfig struct {
	URL    string `json:"URL" yaml:"URL"`
	Path   string `json:"path" yaml:"path"`
	Branch string `json:"branch" yaml:"branch"`
	Key    string `json:"key" yaml:"key"`
}

func (GitConfig) HideKey

func (g GitConfig) HideKey() GitConfig

type GitStatus

type GitStatus struct {
	Configured bool   `json:"configured" yaml:"configured"`
	Error      string `json:"error,omitempty" yaml:"error,omitempty"`
}

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

type Image struct {
	ImageID
	CreatedAt *time.Time `json:",omitempty"`
}

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)

func ParseImage

func ParseImage(s string, createdAt *time.Time) (Image, error)

type ImageDescription

type ImageDescription struct {
	ID        ImageID
	CreatedAt *time.Time `json:",omitempty"`
}

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 ParseImageID(s string) (ImageID, error)

func (ImageID) Components

func (i ImageID) Components() (host, repo, tag string)

func (ImageID) FullID

func (i ImageID) FullID() string

func (ImageID) HostNamespaceImage

func (i ImageID) HostNamespaceImage() string

HostNamespaceImage includes all parts of the image, even if it is from dockerhub.

func (ImageID) MarshalJSON

func (i ImageID) MarshalJSON() ([]byte, error)

ImageID is serialized/deserialized as a string

func (ImageID) NamespaceImage

func (i ImageID) NamespaceImage() string

func (ImageID) Repository

func (i ImageID) Repository() string

Repository returns the short version of an image's repository (trimming if dockerhub)

func (ImageID) String

func (i ImageID) String() string

Fully qualified name

func (*ImageID) UnmarshalJSON

func (i *ImageID) UnmarshalJSON(data []byte) (err error)

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 ImageSpecFromID(id ImageID) ImageSpec

func ParseImageSpec

func ParseImageSpec(s string) (ImageSpec, error)

func (ImageSpec) AsID

func (s ImageSpec) AsID() (ImageID, error)

func (ImageSpec) String

func (s ImageSpec) String() string

type ImageStatus

type ImageStatus struct {
	ID         ServiceID
	Containers []Container
}

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

func ParsePolicy(s string) Policy

type RegistryConfig

type RegistryConfig struct {
	// Map of index host to Basic auth string (base64 encoded
	// username:password), to make it easy to copypasta from docker
	// config.
	Auths map[string]Auth `json:"auths" yaml:"auths"`
}

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

type ReleaseCause struct {
	Message string
	User    string
}

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 ReleaseID

type ReleaseID string

func NewReleaseID

func NewReleaseID() ReleaseID

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 MakeServiceID(namespace, service string) ServiceID

func ParseServiceID

func ParseServiceID(s string) (ServiceID, error)

func (ServiceID) Components

func (id ServiceID) Components() (namespace, service string)

func (ServiceID) String

func (id ServiceID) String() string

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 Token

type Token string

func (Token) Set

func (t Token) Set(req *http.Request)

type UnsafeInstanceConfig

type UnsafeInstanceConfig InstanceConfig

func (UnsafeInstanceConfig) Patch

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
db
ql
sql
sql
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.
rpc
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.

Jump to

Keyboard shortcuts

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