Documentation ¶
Index ¶
- Constants
- Variables
- type ActiveJob
- type Artifact
- type ArtifactType
- type AttachFlag
- type AttachReq
- type Command
- type ContainerConfig
- type DiscoverdConfig
- type Event
- type HealthCheck
- type Host
- type HostStatus
- type Job
- type JobResources
- type JobStatus
- type LogBuffer
- type LogBuffers
- type Mount
- type NetworkConfig
- type Port
- type ResourceCheck
- type Service
- type VolumeBinding
Constants ¶
View Source
const ( AttachSuccess byte = iota AttachWaiting AttachError AttachData AttachSignal AttachExit AttachResize )
View Source
const ( JobEventCreate string = "create" JobEventStart string = "start" JobEventStop string = "stop" JobEventError string = "error" )
View Source
const TagPrefix = "tag:"
TagPrefix is the prefix added to tags in discoverd instance metadata
Variables ¶
View Source
var ( ErrJobNotRunning = errors.New("host: job not running") ErrAttached = errors.New("host: job is attached") )
Functions ¶
This section is empty.
Types ¶
type ActiveJob ¶
type ActiveJob struct { Job *Job `json:"job,omitempty"` HostID string `json:"host_id,omitempty"` ContainerID string `json:"container_id,omitempty"` InternalIP string `json:"internal_ip,omitempty"` ForceStop bool `json:"force_stop,omitempty"` Status JobStatus `json:"status,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` StartedAt time.Time `json:"started_at,omitempty"` EndedAt time.Time `json:"ended_at,omitempty"` ExitStatus *int `json:"exit_status,omitempty"` Error *string `json:"error,omitempty"` }
type Artifact ¶
type Artifact struct { URI string `json:"url,omitempty"` Type ArtifactType `json:"type,omitempty"` }
type ArtifactType ¶
type ArtifactType string
const ( ArtifactTypeDocker ArtifactType = "docker" ArtifactTypeFile ArtifactType = "file" )
type AttachFlag ¶
type AttachFlag uint8
const ( AttachFlagStdout AttachFlag = 1 << iota AttachFlagStderr AttachFlagStdin AttachFlagLogs AttachFlagStream AttachFlagInitLog )
type AttachReq ¶
type AttachReq struct { JobID string `json:"job_id,omitempty"` Flags AttachFlag `json:"flags,omitempty"` Height uint16 `json:"height,omitempty"` Width uint16 `json:"width,omitempty"` }
type ContainerConfig ¶
type ContainerConfig struct { Args []string `json:"args,omitempty"` TTY bool `json:"tty,omitempty"` Stdin bool `json:"stdin,omitempty"` Data bool `json:"data,omitempty"` Env map[string]string `json:"env,omitempty"` Mounts []Mount `json:"mounts,omitempty"` Volumes []VolumeBinding `json:"volumes,omitempty"` Ports []Port `json:"ports,omitempty"` WorkingDir string `json:"working_dir,omitempty"` Uid int `json:"uid,omitempty"` HostNetwork bool `json:"host_network,omitempty"` DisableLog bool `json:"disable_log,omitempty"` }
func (ContainerConfig) Merge ¶
func (x ContainerConfig) Merge(y ContainerConfig) ContainerConfig
Apply 'y' to 'x', returning a new structure. 'y' trumps.
type DiscoverdConfig ¶
type HealthCheck ¶
type HealthCheck struct { // Type is one of tcp, http, https Type string `json:"type,omitempty"` // Interval is the time to wait between checks after the service has been // marked as up. It defaults to two seconds. Interval time.Duration `json:"interval,omitempty"` // Threshold is the number of consecutive checks of the same status before // a service will be marked as up or down after coming up for the first // time. It defaults to 2. Threshold int `json:"threshold,omitempty"` // If KillDown is true, the job will be killed if the service goes down (or // does not come up) KillDown bool `json:"kill_down,omitempty"` // StartTimeout is the maximum duration that a service can take to come up // for the first time if KillDown is true. It defaults to ten seconds. StartTimeout time.Duration `json:"start_timeout,omitempty"` // Extra optional config fields for http/https checks Path string `json:"path,omitempty"` Host string `json:"host,omitempty"` Match string `json:"match,omitempty"` Status int `json:"status,omitempty"` }
type HostStatus ¶
type HostStatus struct { ID string `json:"id"` Tags map[string]string `json:"tags,omitempty"` PID int `json:"pid"` URL string `json:"url"` Discoverd *DiscoverdConfig `json:"discoverd,omitempty"` Network *NetworkConfig `json:"network,omitempty"` Version string `json:"version"` }
type Job ¶
type Job struct { ID string `json:"id,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` ImageArtifact *Artifact `json:"artifact,omitempty"` FileArtifacts []*Artifact `json:"file_artifacts,omitempty"` Resources resource.Resources `json:"resources,omitempty"` Partition string `json:"partition,omitempty"` Config ContainerConfig `json:"config,omitempty"` // If Resurrect is true, the host service will attempt to start the job when // starting after stopping (via crash or shutdown) with the job running. Resurrect bool `json:"resurrect,omitempty"` }
type JobResources ¶
type JobResources struct {
Memory int `json:"memory,omitempty"` // in KiB
}
type LogBuffers ¶
type NetworkConfig ¶
type ResourceCheck ¶
type ResourceCheck struct {
Ports []Port `json:"ports,omitempty"`
}
type Service ¶
type Service struct { Name string `json:"name,omitempty"` // Create the service in service discovery Create bool `json:"create,omitempty"` Check *HealthCheck `json:"check,omitempty"` }
type VolumeBinding ¶
type VolumeBinding struct { // Target defines the filesystem path inside the container where the volume will be mounted. Target string `json:"target"` // VolumeID can be thought of as the source path if this were a simple bind-mount. It is resolved by a VolumeManager. VolumeID string `json:"volume"` Writeable bool `json:"writeable"` }
Click to show internal directories.
Click to hide internal directories.