jobs

package
v0.0.0-...-9d0dce2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaAttributePrefix = "meta."
	AttributeNodeID     = "node.id"
	AttributeTaskGroup  = "taskgroup"

	OperatorEqual    = "=="
	OperatorNotEqual = "!="
)
View Source
const (
	PrivateLoadBalancerPort    = 81
	PrivateTcpLoadBalancerPort = 82
)
View Source
const (
	LinkTypeHTTP = LinkType("http")
	LinkTypeTCP  = LinkType("tcp")
)
View Source
const (
	NetworkTypeDefault = NetworkType("default") // Default for engine
	NetworkTypeHost    = NetworkType("host")    // Host network
	NetworkTypeWeave   = NetworkType("weave")   // Weave network
)
View Source
const (
	// VolumeTypeLocal specifies a volume that is mapped onto file system of container host
	VolumeTypeLocal = VolumeType("local")

	// VolumeTypeInstance specifies a volume, managed by j2, that is specific to the task instance
	VolumeTypeInstance = VolumeType("instance")
)
View Source
const (
	LogDriverNone = LogDriver("none")
)
View Source
const (
	RestartPolicyAll = RestartPolicy("all")
)

Variables

View Source
var (
	TaskNotFoundError       = errgo.New("task not found")
	TaskGroupNotFoundError  = errgo.New("taskgroup not found")
	JobNotFoundError        = errgo.New("job not found")
	InvalidNameError        = errgo.New("invalid name")
	ValidationError         = errgo.New("validation failed")
	OptionNotFoundError     = errgo.New("option not found")
	DependencyNotFoundError = errgo.New("dependency not found")
)
View Source
var (
	// https://github.com/docker/docker/blob/6d6dc2c1a1e36a2c3992186664d4513ce28e84ae/registry/registry.go#L27
	PatternNamespace = regexp.MustCompile(`^([a-z0-9_]{4,30})$`)
	PatternImage     = regexp.MustCompile(`^([a-z0-9-_.]+)$`)
	PatternVersion   = regexp.MustCompile("^[a-zA-Z0-9-\\._]+$")
)
View Source
var (
	// NOTE: This format description is slightly different from what we parse down there.
	// The format given here is the one docker documents. But the repository also consist of a
	// namespace which is more or less always there. Since our business logic requires some checks based on the
	// namespace, we parse it explicitly.
	ErrInvalidFormat = errgo.New("Not a valid docker image. Format: [<registry>/]<repository>[:<version>]")
)

Functions

func NewVariableContext

func NewVariableContext(renderer Renderer, cluster cluster.Cluster, job *Job, group *TaskGroup, task *Task) *variableContext

Types

type Constraint

type Constraint struct {
	Attribute string `json:"attribute,omitempty" mapstructure:"attribute,omitempty"`
	Value     string `json:"value,omitempty" mapstructure:"value,omitempty"`
	Operator  string `json:"operator,omitempty" mapstructure:"operator,omitempty"`
}

Constraint contains a specification of a scheduling constraint.

func (Constraint) Conflicts

func (c Constraint) Conflicts(other Constraint) bool

Conflicts returns true if the given constraints have the same attribute, but a different value.

func (Constraint) Equals

func (c Constraint) Equals(other Constraint) bool

Equals returns true if the given constraints are exactly the same.

func (Constraint) OperatorEquals

func (c Constraint) OperatorEquals(op string) bool

OperatorEquals returns true if the operator equals the given operator. This method resolves empty operator to OperatorEqual.

func (Constraint) Validate

func (c Constraint) Validate() error

Validate checks the values of the given constraint. If ok, return nil, otherwise returns an error.

type Constraints

type Constraints []Constraint

Constraints is a list of Constraint's

func (Constraints) Add

func (list Constraints) Add(additional Constraints) (Constraints, error)

Add creates a new list of constraints with all constraints in `list` combined with all constraints of `additional`. If attributes exists in both lists, an error is raised.

func (Constraints) Contains

func (list Constraints) Contains(attribute string) bool

Contains returns true if the given list contains a constrains with the given attribute. Otherwise it returns false.

func (Constraints) Len

func (list Constraints) Len() int

Len is the number of elements in the collection.

func (Constraints) Less

func (list Constraints) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (Constraints) Merge

func (list Constraints) Merge(additional Constraints) Constraints

Merge creates a new list of constraints with all constraints in `list` combined with all constraints of `additional`. If attributes exists in both lists, the attribute in `additional` wins.

func (Constraints) Swap

func (list Constraints) Swap(i, j int)

Swap swaps the elements with indexes i and j.

func (Constraints) Validate

func (list Constraints) Validate() error

Validate checks the values of all constraints in the given list. If ok, return nil, otherwise returns an error.

type Dependency

type Dependency struct {
	Name             LinkName          `json:"-", mapstructure:"-"`
	Network          NetworkType       `json:"network,omitempty" mapstructure:"network,omitempty"`
	PrivateFrontEnds []PrivateFrontEnd `json:"private-frontends,omitempty"`
}

Dependency configures a link to a task in another job.

func (Dependency) PrivateFrontEndPort

func (t Dependency) PrivateFrontEndPort(defaultPort int) int

PrivateFrontEndPort returns the port number of the first private frontend with a non-0 port number.

func (Dependency) Validate

func (t Dependency) Validate() error

type DependencyList

type DependencyList []Dependency

func (DependencyList) Len

func (list DependencyList) Len() int

Len is the number of elements in the collection.

func (DependencyList) Less

func (list DependencyList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (DependencyList) Swap

func (list DependencyList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

func (DependencyList) Validate

func (l DependencyList) Validate() error

type DockerImage

type DockerImage struct {
	Registry   string // The registry name
	Namespace  string // The namespace
	Repository string // The repository name
	Version    string // The version part
}

func MustParseDockerImage

func MustParseDockerImage(image string) DockerImage

func ParseDockerImage

func ParseDockerImage(image string) (DockerImage, error)

func (DockerImage) DefaultLatestVersion

func (img DockerImage) DefaultLatestVersion() DockerImage

func (DockerImage) MarshalJSON

func (img DockerImage) MarshalJSON() ([]byte, error)

func (DockerImage) String

func (img DockerImage) String() string

Returns all image inforamtion combined: <registry>/<namespace>/<repository>:<version>

func (*DockerImage) UnmarshalJSON

func (img *DockerImage) UnmarshalJSON(data []byte) error

func (DockerImage) Validate

func (img DockerImage) Validate() error

Validate checks that the given docker image is valid. Returns nil if valid, or an error if not valid.

type EngineType

type EngineType string

EngineType is a name of a type of engine to run a task.

func (EngineType) String

func (et EngineType) String() string

String returns a string version of the given value

type InstanceName

type InstanceName string

func (InstanceName) IsEmpty

func (in InstanceName) IsEmpty() bool

IsEmpty returns true if the given instance name is empty, false otherwise.

func (InstanceName) String

func (in InstanceName) String() string

func (InstanceName) Validate

func (in InstanceName) Validate() error

type Job

type Job struct {
	ID           string         `json:"id,omitempty"`
	Name         JobName        `json:"name"`
	Groups       TaskGroupList  `json:"groups"`
	Constraints  Constraints    `json:"constraints,omitempty"`
	Dependencies DependencyList `json:"dependencies,omitempty"`
}

func ParseJobFromFile

func ParseJobFromFile(path string, cluster cluster.Cluster, renderer Renderer, options fg.Options,
	log *logging.Logger, vaultConfig vault.VaultConfig, ghLoginData vault.GithubLoginData) (*Job, error)

ParseJobFromFile reads a job from file

func (*Job) Dependency

func (j *Job) Dependency(name LinkName) (Dependency, error)

Dependency gets a dependency by the given name

func (*Job) Json

func (j *Job) Json() ([]byte, error)

Json returns formatted json representation of this job.

func (*Job) MaxCount

func (j *Job) MaxCount() uint

func (*Job) TaskGroup

func (j *Job) TaskGroup(name TaskGroupName) (*TaskGroup, error)

TaskGroup gets a taskgroup by the given name

func (*Job) Validate

func (j *Job) Validate() error

Check for errors

type JobName

type JobName string

func (JobName) String

func (jn JobName) String() string

func (JobName) Validate

func (jn JobName) Validate() error
type Link struct {
	Target LinkName `json:"target"`
	Type   LinkType `json:"type,omitempty" mapstructure:"type,omitempty"`
	Ports  []int    `json:"ports,omitempty" mapstructure:"ports,omitempty"`
}

func (Link) Equals

func (l Link) Equals(other Link) bool

func (Link) Validate

func (l Link) Validate() error

type LinkName

type LinkName string

LinkName is a name of a link consisting of: <job>.<task>[@<instance>] or <job>.<taskgroup>.<task>[@instance]

func NewLinkName

func NewLinkName(jn JobName, tgn TaskGroupName, tn TaskName, in InstanceName) LinkName

NewLinkName assembles a link name from its elements.

func (LinkName) EtcdServiceName

func (ln LinkName) EtcdServiceName() string

EtcdServiceName returns name of the service as it is used in ETCD.

func (LinkName) HasInstance

func (ln LinkName) HasInstance() bool

HasInstance returns true if there is a specific instance in link name.

func (LinkName) Instance

func (ln LinkName) Instance() (InstanceName, error)

Instance returns the instance part of the link name.

func (LinkName) Job

func (ln LinkName) Job() (JobName, error)

Job returns the job part of the link name.

func (LinkName) PrivateDomainName

func (ln LinkName) PrivateDomainName() string

PrivateDomainName returns the DNS name (in the private namespace) for the given link name.

func (LinkName) Resolve

func (ln LinkName) Resolve(job *Job) (*Task, *Dependency, error)

Resolve tries to find the task that this link refers to in the context of the given job.

func (LinkName) String

func (ln LinkName) String() string

String returns a link name in format <job>.<taskgroup>.<task>

func (LinkName) Task

func (ln LinkName) Task() (TaskName, error)

Task returns the task part of the link name.

func (LinkName) TaskGroup

func (ln LinkName) TaskGroup() (TaskGroupName, error)

TaskGroup returns the taskgroup part of the link name.

func (LinkName) Validate

func (ln LinkName) Validate() error

Validate checks if a link name follows a valid format

func (LinkName) WeaveDomainName

func (ln LinkName) WeaveDomainName() string

WeaveDomainName returns the DNS name (in the weave namespace) for the given link name.

type LinkType

type LinkType string

LinkType is a type of a link: http|tcp

func (LinkType) IsHTTP

func (lt LinkType) IsHTTP() bool

func (LinkType) IsTCP

func (lt LinkType) IsTCP() bool

func (LinkType) String

func (lt LinkType) String() string

String returns a link type as string

func (LinkType) Validate

func (lt LinkType) Validate() error

Validate checks if a link name follows a valid format

type Links []Link

func (Links) Add

func (list Links) Add(l Link) Links

type LogDriver

type LogDriver string

func (LogDriver) CreateDockerLogArgs

func (lg LogDriver) CreateDockerLogArgs(dockerOptions cluster.DockerOptions) []string

CreateDockerLogArgs creates a series of command line arguments for the given log driver, based on the given cluster.

func (LogDriver) String

func (lg LogDriver) String() string

func (LogDriver) Validate

func (lg LogDriver) Validate() error

type Metrics

type Metrics struct {
	Port      int    `json:"port,omitempty" mapstructure:"port,omitempty"`
	Path      string `json:"path,omitempty" mapstructure:"path,omitempty"`
	RulesPath string `json:"rules-path,omitempty" mapstructure:"rules-path,omitempty"`
}

Metrics contains a specification of a metrics provides by a task.

func (Metrics) Validate

func (m Metrics) Validate() error

Validate checks the values of the given metrics. If ok, return nil, otherwise returns an error.

type NetworkType

type NetworkType string

NetworkType is a name of a type of network.

func (NetworkType) IsDefault

func (nt NetworkType) IsDefault() bool

func (NetworkType) IsHost

func (nt NetworkType) IsHost() bool

func (NetworkType) IsWeave

func (nt NetworkType) IsWeave() bool

func (NetworkType) String

func (nt NetworkType) String() string

String returns a link name in format <job>.<taskgroup>.<task>

func (NetworkType) Validate

func (nt NetworkType) Validate() error

Validate returns an error if the given network type is invalid. Returns nil on ok.

type ParsedPortMapping

type ParsedPortMapping struct {
	HostIP        string
	HostPort      int
	ContainerPort int
	Protocol      string
}

func (ParsedPortMapping) HasHostIP

func (p ParsedPortMapping) HasHostIP() bool

func (ParsedPortMapping) HasHostPort

func (p ParsedPortMapping) HasHostPort() bool

func (ParsedPortMapping) IsTCP

func (p ParsedPortMapping) IsTCP() bool

func (ParsedPortMapping) IsUDP

func (p ParsedPortMapping) IsUDP() bool

func (ParsedPortMapping) ProtocolString

func (p ParsedPortMapping) ProtocolString() string

func (ParsedPortMapping) String

func (p ParsedPortMapping) String() string

func (ParsedPortMapping) Validate

func (p ParsedPortMapping) Validate() error

Validate checks the port mapping for errors

type Port

type Port struct {
	Port     string
	Protocol string
}

func (Port) String

func (p Port) String() string

func (*Port) UnmarshalJSON

func (d *Port) UnmarshalJSON(data []byte) error

type PortMapping

type PortMapping string

func (PortMapping) Parse

func (p PortMapping) Parse() (ParsedPortMapping, error)

Parse parses a given port mapping.

func (PortMapping) String

func (p PortMapping) String() string

type PrivateFrontEnd

type PrivateFrontEnd struct {
	Port             int    `json:"port,omitempty" mapstructure:"port,omitempty"`
	HostPort         int    `json:"host-port,omitempty" mapstructure:"host-port,omitempty"`
	Users            []User `json:"users,omitempty"`
	Weight           int    `json:"weight,omitempty" mapstructure:"weight,omitempty"`
	Mode             string `json:"mode,omitempty" mapstructure:"mode,omitempty"`
	RegisterInstance bool   `json:"register-instance,omitempty" mapstructure:"register-instance,omitempty"`
}

PrivateFrontEnd contains a specification of a private HTTP(S) frontend.

func (PrivateFrontEnd) IsTcp

func (f PrivateFrontEnd) IsTcp() bool

func (PrivateFrontEnd) Validate

func (f PrivateFrontEnd) Validate() error

Validate checks the values of the given frontend. If ok, return nil, otherwise returns an error.

type PublicFrontEnd

type PublicFrontEnd struct {
	Domain     string `json:"domain,omitempty" mapstructure:"domain,omitempty"`
	PathPrefix string `json:"path-prefix,omitempty" mapstructure:"path-prefix,omitempty"`
	SslCert    string `json:"ssl-cert,omitempty" mapstructure:"ssl-cert,omitempty"`
	Port       int    `json:"port,omitempty" mapstructure:"port,omitempty"`
	HostPort   int    `json:"host-port,omitempty" mapstructure:"host-port,omitempty"`
	Users      []User `json:"users,omitempty"`
	Mode       string `json:"mode,omitempty" mapstructure:"mode,omitempty"`
	Weight     int    `json:"weight,omitempty" mapstructure:"weight,omitempty"`
}

PublicFrontEnd contains a specification of a publicly visible HTTP(S) frontend.

func (PublicFrontEnd) Validate

func (f PublicFrontEnd) Validate() error

Validate checks the values of the given frontend. If ok, return nil, otherwise returns an error.

type Renderer

type Renderer interface {
	NormalizeTask(t *Task) error

	// Expand  "${private_ipv4}":
	ExpandPrivateIPv4() string

	// Expand  "${public_ipv4}":
	ExpandPublicIPv4() string

	// Expand  "${etcd_endpoints}":
	ExpandEtcdEndpoints() string

	// Expand  "${etcd_host}":
	ExpandEtcdHost() string

	// Expand  "${etcd_port}":
	ExpandEtcdPort() string

	// Expand  "${hostname}":
	ExpandHostname() string

	// Expand  "${machine_id}":
	ExpandMachineID() string

	// Expand  "${instance}":
	ExpandInstance() string

	// Expand  "${kubernetes-namespace}":
	ExpandKubernetesNamespace() string

	// Expand  "${kubernetes-pod}":
	ExpandKubernetesPod() string

	// Does the given task support a DNS name link to the given target?
	SupportsDNSLinkTo(task *Task, target LinkName) bool

	// Does the given task support to be linked to itself through a DNS name?
	TaskAcceptsDNSLink(task *Task) bool

	// Does the given dependency support to be linked to itself through a DNS name?
	DependencyAcceptsDNSLink(d Dependency) bool

	// TaskDNSName returns the DNS name used to reach the given task
	TaskDNSName(task *Task) string

	// DependencyDNSName returns the DNS name used to reach the given dependency
	DependencyDNSName(d Dependency) string

	// TaskPort returns the port number used to reach the given task's port
	// Mode can be "http" or "tcp".
	TaskPort(task *Task, port int, mode string) int

	// DependencyPort returns the DNS name used to reach the given dependency's port
	DependencyPort(d Dependency, port int) int
}

type RestartPolicy

type RestartPolicy string

RestartPolicy specifies how to restart tasks in a task group.

func (RestartPolicy) IsAll

func (rp RestartPolicy) IsAll() bool

func (RestartPolicy) String

func (rp RestartPolicy) String() string

String returns a restart policy as string

func (RestartPolicy) Validate

func (rp RestartPolicy) Validate() error

Validate checks if a restart policy follows a valid format

type Rewrite

type Rewrite struct {
	PathPrefix       string `json:"path-prefix,omitempty" mapstructure:"path-prefix,omitempty"`
	RemovePathPrefix string `json:"remove-path-prefix,omitempty" mapstructure:"remove-path-prefix,omitempty"`
	Domain           string `json:"domain,omitempty" mapstructure:"domain,omitempty"`
}

func (Rewrite) HasPathPrefixOnly

func (r Rewrite) HasPathPrefixOnly() bool

HasPathPrefixOnly returns true if only `path` has a non-empty value.

func (Rewrite) Merge

func (r Rewrite) Merge(other Rewrite) Rewrite

Merge merges non-empty data from other into the given Rewrite. Data from the given Rewrite prevails over the other Rewrite.

type Secret

type Secret struct {
	Path        string `json:"path"`
	Field       string `json:"field,omitempty" mapstructure:"field,omitempty"`
	Environment string `json:"environment,omitempty" mapstructure:"environment"`
	File        string `json:"file,omitempty" mapstructure:"file"`
}

Secret contains a specification of a secret that is to be used by the task.

func (Secret) Hash

func (s Secret) Hash() (string, error)

Hash returns a hash of the given secret config

func (Secret) TargetEnviroment

func (s Secret) TargetEnviroment() (bool, string)

TargetEnviroment returns true if the target is an environment variable and if so, the name of the variable.

func (Secret) TargetFile

func (s Secret) TargetFile() (bool, string)

TargetFile returns true if the target is a file and if so, the path of the file.

func (*Secret) Validate

func (s *Secret) Validate() error

Validate checks the values of the given secret. If ok, return nil, otherwise returns an error.

func (Secret) VaultPath

func (s Secret) VaultPath() string

VaultPath returns the path within the vault formatted at <path>[#<field>]

type SecretList

type SecretList []Secret

func (SecretList) AnyTargetEnviroment

func (list SecretList) AnyTargetEnviroment() bool

AnyTargetEnviroment returns true if at least one of the secrets in the list has an environment variable as target.

func (SecretList) AnyTargetFile

func (list SecretList) AnyTargetFile() bool

AnyTargetFile returns true if at least one of the secrets in the list has a file as target.

func (SecretList) Validate

func (list SecretList) Validate() error

Validate checks the values of the given secret. If ok, return nil, otherwise returns an error.

type Task

type Task taskData

func (*Task) ContainerName

func (t *Task) ContainerName(scalingGroup uint) string

ContainerName returns the name of the docker container used for this task.

func (*Task) FullName

func (t *Task) FullName() string

FullName returns the full name of this task: job/taskgroup/task

func (*Task) GroupCount

func (t *Task) GroupCount() uint

GroupCount returns the Count flag of the containing group.

func (*Task) GroupGlobal

func (t *Task) GroupGlobal() bool

GroupGlobal returns true if the Global flag of the containing group is set.

func (*Task) GroupName

func (t *Task) GroupName() TaskGroupName

GroupName returns the name of the group containing this task.

func (*Task) InstanceSpecificPrivateDomainName

func (t *Task) InstanceSpecificPrivateDomainName(scalingGroup uint) string

InstanceSpecificPrivateDomainName returns the DNS name (in the private namespace) for an instance of the given task.

func (*Task) JobID

func (t *Task) JobID() string

JobID returns the ID of the job containing the group containing this task.

func (*Task) JobName

func (t *Task) JobName() JobName

JobName returns the name of the job containing the group containing this task.

func (*Task) MarshalJSON

func (t *Task) MarshalJSON() ([]byte, error)

MarshalJSON converts the given task to JSON. It replaces default values with blanks (in the JSON)

func (*Task) MergedConstraints

func (t *Task) MergedConstraints() Constraints

MergedConstraints returns the constraints resulting from merging the job constraints with the group constraints.

func (*Task) PrivateDomainName

func (t *Task) PrivateDomainName() string

PrivateDomainName returns the DNS name (in the private namespace) for the given task.

func (*Task) PrivateFrontEndPort

func (t *Task) PrivateFrontEndPort(defaultPort int) int

PrivateFrontEndPort returns the port number of the first private frontend with a non-0 port number.

func (*Task) PublicFrontEndPort

func (t *Task) PublicFrontEndPort(defaultPort int) int

PublicFrontEndPort returns the port number of the first private frontend with a non-0 port number.

func (*Task) ServiceName

func (t *Task) ServiceName() string

ServiceName returns the name used to register this service.

func (*Task) Task

func (t *Task) Task(name TaskName) (*Task, error)

Task gets a task by the given name

func (*Task) TaskGroup

func (t *Task) TaskGroup(name TaskGroupName) (*TaskGroup, error)

TaskGroup gets a taskgroup by the given name

func (Task) Validate

func (t Task) Validate() error

Check for errors

func (*Task) WeaveDomainName

func (t *Task) WeaveDomainName() string

WeaveDomainName returns the DNS name (in the weave namespace) for the given task.

type TaskGroup

type TaskGroup struct {
	Name TaskGroupName `json:"name", mapstructure:"-"`

	Count         uint          `json:"count"`            // Number of instances of this group
	Global        bool          `json:"global,omitempty"` // Scheduled on all machines
	Tasks         TaskList      `json:"tasks"`
	Constraints   Constraints   `json:"constraints,omitempty"`
	RestartPolicy RestartPolicy `json:"restart,omitempty" mapstructure:"restart,omitempty"`
	// contains filtered or unexported fields
}

TaskGroup is a group of tasks that are scheduled on the same machine. TaskGroups can have multiple instances, specified by `Count`. Multiple instances are scheduled on different machines when possible.

func (*TaskGroup) FullName

func (tg *TaskGroup) FullName() string

FullName returns the full name of this taskgroup: job/taskgroup

func (*TaskGroup) Job

func (tg *TaskGroup) Job() *Job

Job returns the job that contains this group.

func (*TaskGroup) Task

func (tg *TaskGroup) Task(name TaskName) (*Task, error)

Task gets a task by the given name

func (*TaskGroup) TaskGroup

func (tg *TaskGroup) TaskGroup(name TaskGroupName) (*TaskGroup, error)

TaskGroup gets a taskgroup by the given name

func (*TaskGroup) Validate

func (tg *TaskGroup) Validate() error

Check for configuration errors

type TaskGroupList

type TaskGroupList []*TaskGroup

func (TaskGroupList) Len

func (l TaskGroupList) Len() int

func (TaskGroupList) Less

func (l TaskGroupList) Less(i, j int) bool

func (TaskGroupList) Swap

func (l TaskGroupList) Swap(i, j int)

type TaskGroupName

type TaskGroupName string

func (TaskGroupName) String

func (tgn TaskGroupName) String() string

func (TaskGroupName) Validate

func (tgn TaskGroupName) Validate() error

type TaskList

type TaskList []*Task

func (TaskList) IndexByName

func (l TaskList) IndexByName(taskName TaskName) int

IndexByName returns the index of the task with given name in the given list. Returns -1 if no such task is found.

func (TaskList) Len

func (l TaskList) Len() int

func (TaskList) Less

func (l TaskList) Less(i, j int) bool

func (TaskList) Swap

func (l TaskList) Swap(i, j int)

type TaskName

type TaskName string

func (TaskName) String

func (tn TaskName) String() string

func (TaskName) Validate

func (tn TaskName) Validate() error

type TaskType

type TaskType string

func (TaskType) IsOneshot

func (tt TaskType) IsOneshot() bool

IsOneshot returns true if the given task type equals "oneshot"

func (TaskType) IsProxy

func (tt TaskType) IsProxy() bool

IsProxy returns true if the given task type equals "proxy"

func (TaskType) IsService

func (tt TaskType) IsService() bool

IsService returns true if the given task type equals "service" (this default)

func (TaskType) String

func (tt TaskType) String() string

func (TaskType) Validate

func (tt TaskType) Validate() error

type User

type User struct {
	Name     string `json:"name" mapstructure:"name"`
	Password string `json:"password" mapstructure:"password"`
}

User contains a user name+password who has access to a frontend

type Volume

type Volume struct {
	Path         string     `json:"path"` // container path
	Type         VolumeType `json:"type,omitempty" mapstructure:"type,omitempty"`
	HostPath     string     `json:"host-path,omitempty" mapstructure:"host-path,omitempty"`
	Options      []string   `json:"options,omitempty" mapstructure:"options,omitempty"`
	MountOptions []string   `json:"mount-options,omitempty" mapstructure:"mount-options,omitempty"`
}

Volume contains a specification of a volume mounted into the tasks container

func ParseVolume

func ParseVolume(input string) (Volume, error)

ParseVolume parses a string into a Volume

func (Volume) IsInstance

func (v Volume) IsInstance() bool

IsInstance returns true of the type of the given volume equals "instance"

func (Volume) IsLocal

func (v Volume) IsLocal() bool

IsLocal returns true of the type of the given volume equals "local"

func (Volume) IsReadOnly

func (v Volume) IsReadOnly() bool

IsReadOnly returns true if the given volume contains the "ro" option.

func (Volume) MarshalJSON

func (v Volume) MarshalJSON() ([]byte, error)

MarshalJSON creates a json representation of a given volume

func (Volume) MountOption

func (v Volume) MountOption(key string) (string, error)

MountOption looks for a mount option with given key and returns its value. Returns OptionNotFoundError if option is not found.

func (Volume) String

func (v Volume) String() string

String creates a string representation of a given volume

func (*Volume) Validate

func (v *Volume) Validate() error

Validate checks the values of the given volume. If ok, return nil, otherwise returns an error.

type VolumeList

type VolumeList []Volume

VolumeList is a list of volumes, ordered such that volumes that need a volume unit come first

func (VolumeList) Len

func (l VolumeList) Len() int

Len is the number of elements in the collection.

func (VolumeList) Less

func (l VolumeList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (VolumeList) Swap

func (l VolumeList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type VolumeType

type VolumeType string

VolumeType specifies a type of volume

func (VolumeType) String

func (vt VolumeType) String() string

String returns a volume type as string

func (VolumeType) Validate

func (vt VolumeType) Validate() error

Validate checks if a volume type follows a valid format

Jump to

Keyboard shortcuts

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