utils

package
v0.0.0-...-b359386 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppNamePattern = regexp.MustCompile(`^[a-z\d]+(-[a-z\d]+)*$`)

Functions

func ClusterClientWrapper

func ClusterClientWrapper(c *cluster.Client) clusterClientWrapper

func ExpandFormation

func ExpandFormation(c ControllerClient, f *ct.Formation) (*ct.ExpandedFormation, error)

func FormationTagsEqual

func FormationTagsEqual(a, b map[string]map[string]string) bool

func GetEntrypoint

func GetEntrypoint(artifacts []*ct.Artifact, typ string) *ct.ImageEntrypoint

GetEntrypoint returns an image entrypoint for a process type from a list of artifacts, first iterating through them and returning any entrypoint having the exact type, then iterating through them and returning the artifact's default entrypoint if it has one.

The artifacts are traversed in reverse order so that entrypoints in the image being overlayed at the top are considered first.

func JobConfig

func JobConfig(f *ct.ExpandedFormation, name, hostID string, uuid string) *host.Job

func JobMetaFromMetadata

func JobMetaFromMetadata(metadata map[string]string) map[string]string

func ProvisionVolume

func ProvisionVolume(req *ct.VolumeReq, h VolumeCreator, job *host.Job) (*volume.Info, error)

func SetupMountspecs

func SetupMountspecs(job *host.Job, artifacts []*ct.Artifact)

SetupMountspecs populates job.Mountspecs using the layers from a list of Owo image artifacts, expecting each artifact to have a single rootfs entry containing squashfs layers

Types

type ClusterClient

type ClusterClient interface {
	Host(string) (HostClient, error)
	Hosts() ([]HostClient, error)
	StreamHostEvents(chan *discoverd.Event) (stream.Stream, error)
}

type ControllerClient

type ControllerClient interface {
	GetApp(appID string) (*ct.App, error)
	GetRelease(releaseID string) (*ct.Release, error)
	GetArtifact(artifactID string) (*ct.Artifact, error)
	GetExpandedFormation(appID, releaseID string) (*ct.ExpandedFormation, error)
	CreateApp(app *ct.App) error
	CreateRelease(appID string, release *ct.Release) error
	CreateArtifact(artifact *ct.Artifact) error
	PutFormation(formation *ct.Formation) error
	PutScaleRequest(req *ct.ScaleRequest) error
	StreamFormations(since *time.Time, ch chan<- *ct.ExpandedFormation) (stream.Stream, error)
	AppList() ([]*ct.App, error)
	FormationListActive() ([]*ct.ExpandedFormation, error)
	PutJob(*ct.Job) error
	JobListActive() ([]*ct.Job, error)
	StreamSinks(since *time.Time, ch chan *ct.Sink) (stream.Stream, error)
	ListSinks() ([]*ct.Sink, error)
	VolumeList() ([]*ct.Volume, error)
	PutVolume(*ct.Volume) error
	StreamVolumes(since *time.Time, ch chan *ct.Volume) (stream.Stream, error)
}

type FormationKey

type FormationKey struct {
	AppID, ReleaseID string
}

func NewFormationKey

func NewFormationKey(appID, releaseID string) FormationKey

func (FormationKey) String

func (f FormationKey) String() string

type HostClient

type HostClient interface {
	VolumeCreator
	ID() string
	Tags() map[string]string
	AddJob(*host.Job) error
	GetJob(id string) (*host.ActiveJob, error)
	Attach(*host.AttachReq, bool) (cluster.AttachClient, error)
	StopJob(string) error
	DiscoverdDeregisterJob(string) error
	ListJobs() (map[string]host.ActiveJob, error)
	ListActiveJobs() (map[string]host.ActiveJob, error)
	StreamEvents(id string, ch chan *host.Event) (stream.Stream, error)
	ListVolumes() ([]*volume.Info, error)
	StreamVolumes(ch chan *volume.Event) (stream.Stream, error)
	GetStatus() (*host.HostStatus, error)
	GetSinks() ([]*ct.Sink, error)
	AddSink(*ct.Sink) error
	RemoveSink(string) error
}

type VolumeCreator

type VolumeCreator interface {
	CreateVolume(string, *volume.Info) error
}

Jump to

Keyboard shortcuts

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