flux

package module
v0.0.0-...-6c7e5b9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

README

fluxy

Work with your code, from laptop to prod.

User stories

I want to update a specific image in a specific service, and deploy it.

fluxctl release --service=S --update-image=I

I want to deploy specific service/image pairs from some other source of truth, e.g. a dev environment to a prod environment.

# Some script wrapping this command:
fluxctl release --service=S --update-image=I

I want to deploy the latest images for a given service.

fluxctl release --service=S --update-all-images

I want to release a specific image to all services that are using that image, except some services that I have manually excluded somehow.

fluxctl release --all --update-image=I

I want to deploy the latest images for all services on the platform, except some services that I have manually excluded somehow.

fluxctl release --all --update-all-images

I want to deploy a service with no change of image, just taking the latest resource definition file. This may be known as a config change deployment.

fluxctl release --service=S

I want to automatically deploy the latest images for a set of opt-in services.

fluxctl automate --service=S

I want to show all recognized services and their status.

fluxctl list-services

I want to find out what images are available for a service.

fluxctl list-images --service=S

I want to inspect the history of actions taken with Fluxy, both per-service and overall.

fluxctl history [--service=S]

Installing

For the minute you will have to build or use the container image quay.io/weaveworks/fluxy.

Developing

Build

Ensure the repository is checked out into $GOPATH/src/github.com/weaveworks/fluxy. Then, from the root,

$ gvt restore
# .. time passes ..
$ make

This makes Docker images, and installs binaries to $GOPATH/bin.

Test
$ go test ./...
Dependency management

We use gvt to manage vendored dependencies. Note that we do not check in the vendor folder.

To get all the dependencies put in the vendor/ folder, use

$ go get -u github.com/FiloSottile/gvt # install gvt if you don't have it
$ gvt restore

To add dependencies, use

$ gvt fetch <dependency>

gvt does not discover dependencies for you, but it will add them recursively; so, it should be sufficient to just add packages you import.

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.

Documentation

Index

Constants

View Source
const (
	ServiceSpecAll  = ServiceSpec("<all>")
	ImageSpecLatest = ImageSpec("<latest>")
)

Variables

View Source
var (
	ErrInvalidServiceID   = errors.New("invalid service ID")
	ErrInvalidImageID     = errors.New("invalid image ID")
	ErrInvalidReleaseKind = errors.New("invalid release kind")
)

Functions

func NewHandler

func NewHandler(s Service, r *mux.Router) http.Handler

func NewRouter

func NewRouter() *mux.Router

Types

type Automator

type Automator interface {
	Automate(namespace, service string) error
	Deautomate(namespace, service string) error
	IsAutomated(namespace, service string) bool
}

type Container

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

type Helper

type Helper struct {
	Platform *kubernetes.Cluster
	Registry *registry.Client
	Logger   log.Logger
}

func (*Helper) AllImagesFor

func (s *Helper) AllImagesFor(serviceIDs []ServiceID) (map[ServiceID][]platform.Container, error)

func (*Helper) AllServices

func (s *Helper) AllServices() ([]ServiceID, error)

func (*Helper) Log

func (s *Helper) Log(args ...interface{})

type HistoryEntry

type HistoryEntry struct {
	Stamp time.Time
	Type  string
	Data  string
}

Ask me for more details.

type ImageDescription

type ImageDescription struct {
	ID        ImageID
	CreatedAt time.Time
}

type ImageID

type ImageID string // "quay.io/weaveworks/helloworld:v1"

func ParseImageID

func ParseImageID(s string) ImageID

func (ImageID) Components

func (id ImageID) Components() (registry, name, tag string)

func (ImageID) Repository

func (id ImageID) Repository() string

type ImageSpec

type ImageSpec string // ImageID or "<latest>"

func ParseImageSpec

func ParseImageSpec(s string) ImageSpec

type ImageStatus

type ImageStatus struct {
	ID         ServiceID
	Containers []Container
}

type ReleaseAction

type ReleaseAction struct {
	Description string                      `json:"description"`
	Do          func(*ReleaseContext) error `json:"-"`
}

type ReleaseContext

type ReleaseContext struct {
	RepoPath       string
	RepoKey        string
	PodControllers map[ServiceID][]byte
}

func NewReleaseContext

func NewReleaseContext() *ReleaseContext

func (*ReleaseContext) Clean

func (rc *ReleaseContext) Clean()

type ReleaseKind

type ReleaseKind string
const (
	ReleaseKindPlan    ReleaseKind = "plan"
	ReleaseKindExecute             = "execute"
)

func ParseReleaseKind

func ParseReleaseKind(s string) (ReleaseKind, error)

type Releaser

type Releaser interface {
	Release(ServiceSpec, ImageSpec, ReleaseKind) ([]ReleaseAction, error)
}

type Service

type Service interface {
	ListServices() ([]ServiceStatus, error)
	ListImages(ServiceSpec) ([]ImageStatus, error)
	Release(ServiceSpec, ImageSpec, ReleaseKind) ([]ReleaseAction, error)
	Automate(ServiceID) error
	Deautomate(ServiceID) error
	History(ServiceSpec) ([]HistoryEntry, error)
}

func NewClient

func NewClient(c *http.Client, router *mux.Router, endpoint string) Service

func NewServer

func NewServer(platform *kubernetes.Cluster, registry *registry.Client, releaser Releaser, automator Automator, history history.DB, logger log.Logger) Service

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)

type ServiceSpec

type ServiceSpec string // ServiceID or "<all>"

func ParseServiceSpec

func ParseServiceSpec(s string) (ServiceSpec, error)

type ServiceStatus

type ServiceStatus struct {
	ID         ServiceID
	Containers []Container
	Status     string
	Automated  bool
}

Directories

Path Synopsis
Package automator implements continuous deployment.
Package automator implements continuous deployment.
cmd
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.
Package registry provides domain abstractions over container registries.
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