Documentation
¶
Index ¶
- Constants
- func Walk(sd *ServiceDefinition, visit Visit) error
- type AddressResourceConfig
- type AddressResourceConfigByPort
- type ConfigFile
- type EndpointDefinition
- type HostPolicy
- type LogConfig
- type LogTag
- type ServiceDefinition
- type ServiceDefinitionByName
- type SnapshotCommands
- type Task
- type Visit
- type Volume
Constants ¶
const ( //DEFAULT policy for scheduling a service instance DEFAULT HostPolicy = "" //LeastCommitted run on host w/ least committed memory LeastCommitted = "LEAST_COMMITTED" //PreferSeparate attempt to schedule instances of a service on separate hosts PreferSeparate = "PREFER_SEPARATE" //RequireSeparate schedule instances of a service on separate hosts RequireSeparate = "REQUIRE_SEPARATE" )
Variables ¶
This section is empty.
Functions ¶
func Walk ¶
func Walk(sd *ServiceDefinition, visit Visit) error
Walk a ServiceDefinition hierarchy and call the Visit function at each ServiceDefinition. Returns error if any Visit returns an error
Types ¶
type AddressResourceConfig ¶
AddressResourceConfig defines an external facing port for a service definition
func (*AddressResourceConfig) Normalize ¶
func (arc *AddressResourceConfig) Normalize()
Normalize adjusts attributes to be in an expected format, lowercases and trims certain fields
func (AddressResourceConfig) ValidEntity ¶
func (arc AddressResourceConfig) ValidEntity() error
ValidEntity used to make sure AddressResourceConfig is in a valid state
type AddressResourceConfigByPort ¶
type AddressResourceConfigByPort []AddressResourceConfig
AddressResourceConfigByPort implements sort.Interface for []AddressResourceConfig based on the Port field
func (AddressResourceConfigByPort) Len ¶
func (a AddressResourceConfigByPort) Len() int
func (AddressResourceConfigByPort) Less ¶
func (a AddressResourceConfigByPort) Less(i, j int) bool
func (AddressResourceConfigByPort) Swap ¶
func (a AddressResourceConfigByPort) Swap(i, j int)
type ConfigFile ¶
type ConfigFile struct { Filename string // complete path of file Owner string // owner of file within the container, root:root or 0:0 for root owned file, what you would pass to chown Permissions string // permission of file, eg 0664, what you would pass to chmod Content string // content of config file }
ConfigFile config file for a service
type EndpointDefinition ¶
type EndpointDefinition struct { Name string // Human readable name of the endpoint. Unique per service definition Purpose string Protocol string PortNumber uint16 PortTemplate string // A template which, if specified, is used to calculate the port number VirtualAddress string // An address by which an imported endpoint may be accessed within the container, e.g. "mysqlhost:1234" Application string ApplicationTemplate string AddressConfig AddressResourceConfig VHosts []string // VHost is used to request named vhost for this endpoint. Should be the name of a }
EndpointDefinition An endpoint that a Service exposes.
func (EndpointDefinition) ValidEntity ¶
func (se EndpointDefinition) ValidEntity() error
ValidEntity used to make sure ServiceEndpoint is in a valid state
type HostPolicy ¶
type HostPolicy string
HostPolicy represents the optional policy used to determine which hosts on which to run instances of a service. Default is to run on the available host with the most uncommitted RAM.
func (*HostPolicy) UnmarshalText ¶
func (p *HostPolicy) UnmarshalText(b []byte) error
UnmarshalText implements the encoding/TextUnmarshaler interface
type LogConfig ¶
type LogConfig struct { Path string // The location on the container's filesystem of the log, can be a directory Type string // Arbitrary string that identifies the "types" of logs that come from this source. This will be Filters []string // A list of filters that must be contained in either the LogFilters or a parent's LogFilter, LogTags []LogTag // Key value pair of tags that are sent to logstash for all entries coming out of this logfile }
LogConfig represents the configuration for a logfile for a service.
type ServiceDefinition ¶
type ServiceDefinition struct { Name string // Name of the defined service Title string // Title is a label used when describing this service in the context of a service tree Version string // Version of the defined service Command string // Command which runs the service Description string // Description of the service Tags []string // Searchable service tags ImageID string // Docker image hosting the service Instances domain.MinMax // Constraints on the number of instances ChangeOptions []string // Control options for what happens when a running service is changed Launch string // Must be "AUTO", the default, or "MANUAL" HostPolicy HostPolicy // Policy for starting up instances Hostname string // Optional hostname which should be set on run Privileged bool // Whether to run the container with extended privileges ConfigFiles map[string]ConfigFile // Config file templates Context map[string]interface{} // Context information for the service Endpoints []EndpointDefinition // Comms endpoints used by the service Services []ServiceDefinition // Supporting subservices Tasks []Task // Scheduled tasks for celery to find LogFilters map[string]string // map of log filter name to log filter definitions Volumes []Volume // list of volumes to bind into containers LogConfigs []LogConfig Snapshot SnapshotCommands // Snapshot quiesce info for the service: Pause/Resume bash commands RAMCommitment utils.EngNotation // expected RAM commitment to use for scheduling CPUCommitment uint64 // expected CPU commitment (#cores) to use for scheduling Runs map[string]string // Map of commands that can be executed with 'serviced run ...' Actions map[string]string // Map of commands that can be executed with 'serviced action ...' HealthChecks map[string]domain.HealthCheck // HealthChecks for a service. Prereqs []domain.Prereq // Optional list of scripts that must be successfully run before kicking off the service command. MonitoringProfile domain.MonitorProfile // An optional list of queryable metrics, graphs, and thresholds MemoryLimit float64 PIDFile string // An optional path or command to generate a path for a PID file to which signals are relayed. }
ServiceDefinition is the definition of a service hierarchy.
func BuildFromPath ¶
func BuildFromPath(path string) (*ServiceDefinition, error)
BuildFromPath given a path will create a ServiceDefintion
func (*ServiceDefinition) NormalizeLaunch ¶
func (sd *ServiceDefinition) NormalizeLaunch()
NormalizeLaunch normalizes the launch string. Sets to commons.AUTO if empty otherwise just trims and lower cases. Does not check if value is valid
func (ServiceDefinition) String ¶
func (s ServiceDefinition) String() string
func (*ServiceDefinition) ValidEntity ¶
func (sd *ServiceDefinition) ValidEntity() error
ValidEntity validates Host fields
type ServiceDefinitionByName ¶
type ServiceDefinitionByName []ServiceDefinition
ServiceDefinitionByName implements sort.Interface for []ServiceDefinition based on Name field
func (ServiceDefinitionByName) Len ¶
func (a ServiceDefinitionByName) Len() int
func (ServiceDefinitionByName) Less ¶
func (a ServiceDefinitionByName) Less(i, j int) bool
func (ServiceDefinitionByName) Swap ¶
func (a ServiceDefinitionByName) Swap(i, j int)
type SnapshotCommands ¶
type SnapshotCommands struct { Pause string // bash command to pause the volume (quiesce) Resume string // bash command to resume the volume (unquiesce) }
SnapshotCommands commands to be called during and after a snapshot
type Task ¶
type Task struct { Name string Schedule string Command string LastRunAt time.Time TotalRunCount int }
Task A scheduled task
type Visit ¶
type Visit func(sd *ServiceDefinition) error
Visit function called when walking a ServiceDefinition hierarchy
type Volume ¶
type Volume struct { Owner string //Resource Path Owner Permission string //Resource Path permissions, eg what you pass to chmod ResourcePath string //Resource Pool Path, shared across all hosts in a resource pool ContainerPath string //Container bind-mount path Type string //Path use, i.e. "dfs" or "tmp" }
Volume import defines a file system directory underneath an export directory