types

package
v0.3.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2017 License: Apache-2.0 Imports: 22 Imported by: 27

Documentation

Overview

Deprecated, Remove Later

Index

Constants

View Source
const (
	OpStatusNoop             = "noop"
	OpStatusCreating         = "creating"
	OpStatusScalingUp        = "scaling_up"
	OpStatusScalingDown      = "scaling_down"
	OpStatusUpdating         = "updating"
	OpStatusCanaryUpdating   = "canary_updating"
	OpStatusCanaryUnfinished = "canary_unfinished"
	OpStatusWeightUpdating   = "weight_updating"
	OpStatusStarting         = "starting"
	OpStatusStopping         = "stopping"
	OpStatusDeleting         = "deleting"
	OpStatusRollback         = "rollbacking"
)
View Source
const (
	DefaultCanaryUpdateDelay = 5

	CanaryUpdateOnFailureStop     = "stop"
	CanaryUpdateOnFailureContinue = "continue"
)
View Source
const (
	EventTypeTaskHealthy      = "task_healthy"
	EventTypeTaskWeightChange = "task_weight_change"
	EventTypeTaskUnhealthy    = "task_unhealthy"
)
View Source
const (
	TaskHealthyUnset = "unset"
	TaskHealthy      = "healty"
	TaskUnHealthy    = "unhealthy"
)
View Source
const (
	// update onfailure action
	UpdateStop     = "stop"
	UpdateContinue = "continue"
	UpdateRollback = "rollback" // TODO(nmg)
)

Variables

View Source
var DefaultDeployConfig = DeployConfig{
	WaitDelay: 1,
	Replicas:  1,
}

Functions

func Convert

func Convert(src, target interface{}) error

Convert converts a struct (src) to another one (target) using yaml marshalling/unmarshalling. If the structure are not compatible, this will throw an error as the unmarshalling will fail.

func InterpolateRawServiceMap

func InterpolateRawServiceMap(baseRawServices *RawServiceMap, envMap map[string]string) error

InterpolateRawServiceMap replaces varialbse in raw service map struct based on environment lookup

Types

type Agent added in v0.2.1

type Agent struct {
	ID         string    `json:"id"`
	SysInfo    *SysInfo  `json:"sysinfo"`
	CreatedAt  time.Time `json:"created_at"`
	LastActive time.Time `json:"last_active"`
}

Agent is a db swan Agent

func (*Agent) Valid added in v0.2.1

func (a *Agent) Valid() error

type AppFilterOptions

type AppFilterOptions struct {
	LabelsSelector labels.Selector
	FieldsSelector fields.Selector
}

type Application

type Application struct {
	ID              string          `json:"id"`
	Name            string          `json:"name"`
	RunAs           string          `json:"runAs"`
	Cluster         string          `json:"cluster"`
	OpStatus        string          `json:"operationStatus"`
	Progress        int             `json:"progress"`         // only used within app update
	ProgressDetails map[string]bool `json:"progress_details"` // only used within app update, taskid -> updated
	TaskCount       int             `json:"task_count"`
	Version         []string        `json:"currentVersion"`
	VersionCount    int             `json:"version_count"`
	Status          string          `json:"status"`
	TasksStatus     map[string]int  `json:"tasks_status"`
	Health          *Health         `json:"health"`
	ErrMsg          string          `json:"errmsg"`
	CreatedAt       time.Time       `json:"created"`
	UpdatedAt       time.Time       `json:"updated"`
}

type CPUInfo added in v0.2.1

type CPUInfo struct {
	Processor int64   `json:"processor"`
	Physical  int64   `json:"physical"`
	Used      float64 `json:"used"` // 1 - idle
}

type CanaryUpdateBody added in v0.2.1

type CanaryUpdateBody struct {
	Version   *Version `json:"version"`
	Instances int      `json:"instances"`
	Value     float64  `json:"value"`
	OnFailure string   `json:"onFailure"`
	Delay     float64  `json:"delay"`
}

type CombinedEvents added in v0.2.1

type CombinedEvents struct {
	Event *TaskEvent
	Proxy *upstream.BackendCombined // built from event
	DNS   *resolver.Record          // built from event
}

type Compose

type Compose struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name"`
	Desc        string    `json:"desc"`
	OpStatus    string    `json:"op_status"` // op status
	ErrMsg      string    `json:"errmsg"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`

	// request settings
	YAMLRaw   string                `json:"yaml_raw"`
	YAMLEnv   map[string]string     `json:"yaml_env"`
	YAMLExtra map[string]*YamlExtra `json:"yaml_extra"`

	// held temporary struct convert from YAML and will be converted to App Version
	ServiceGroup ServiceGroup `json:"service_group"`
}

Compose

func (*Compose) Cluster

func (c *Compose) Cluster() string

func (*Compose) RequireConvert

func (c *Compose) RequireConvert() bool

func (*Compose) RunAs added in v0.2.2

func (c *Compose) RunAs() string

func (*Compose) ToServiceGroup

func (c *Compose) ToServiceGroup() (ServiceGroup, error)

conver raw yaml to docker service group

func (*Compose) Valid

func (c *Compose) Valid() error

type ComposeApp

type ComposeApp struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	RunAs       string    `json:"run_as"`
	Cluster     string    `json:"cluster"`
	DisplayName string    `json:"display_name"`
	Desc        string    `json:"desc"`
	OpStatus    string    `json:"op_status"` // op status
	ErrMsg      string    `json:"errmsg"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`

	// Extra Labels
	Labels map[string]string `json:"labels"`

	// YAML request data
	YAMLRaw string            `json:"yaml_raw"`
	YAMLEnv map[string]string `json:"yaml_env"`

	// held temporary struct convert from YAMLRaw & YAMLEnv and will be converted to App Version
	ComposeV3 *ComposeV3
}

ComposeApp represents a db compose app

func (*ComposeApp) ParseComposeToVersions

func (cmpApp *ComposeApp) ParseComposeToVersions() (map[string]*Version, error)

func (*ComposeApp) Valid

func (cmpApp *ComposeApp) Valid() error

type ComposeAppSorter

type ComposeAppSorter []*ComposeApp

ComposeApp sorter

func (ComposeAppSorter) Len

func (s ComposeAppSorter) Len() int

func (ComposeAppSorter) Less

func (s ComposeAppSorter) Less(i, j int) bool

func (ComposeAppSorter) Swap

func (s ComposeAppSorter) Swap(i, j int)

type ComposeAppWrapper

type ComposeAppWrapper struct {
	*ComposeApp
	Apps []*Application `json:"apps"`
}

wrap ComposeApp with related apps

type ComposeService

type ComposeService struct {
	Name            string             `yaml:"name"`
	CapAdd          StrSlice           `yaml:"cap_add"`
	CapDrop         StrSlice           `yaml:"cap_drop"`
	CgroupParent    string             `yaml:"cgroup_parent"`
	Command         StrSlice           `yaml:"command"`
	ContainerName   string             `yaml:"container_name"`
	DependsOn       StrSlice           `yaml:"depends_on"`
	Devices         StrSlice           `yaml:"devices"`
	Dns             StrSlice           `yaml:"dns"`
	DnsSearch       StrSlice           `yaml:"dns_search"`
	DomainName      string             `yaml:"domainname"`
	Entrypoint      StrSlice           `yaml:"entrypoint"`
	Environment     SliceMap           `yaml:"environment"`
	Expose          StrSlice           `yaml:"expose"`
	ExternalLinks   StrSlice           `yaml:"external_links"`
	ExtraHosts      SliceMap           `yaml:"extra_hosts"`
	Hostname        string             `yaml:"hostname"`
	HealthCheck     *HealthCheckConfig `yaml:"healthcheck"`
	Image           string             `yaml:"image"`
	Ipc             string             `yaml:"ipc"`
	Labels          SliceMap           `yaml:"labels"`
	Links           StrSlice           `yaml:"links"`
	Logging         *LoggingConfig     `yaml:"logging"`
	MacAddress      string             `yaml:"mac_address"`
	NetworkMode     string             `yaml:"network_mode"`
	Pid             string             `yaml:"pid"`
	Ports           StrSlice           `yaml:"ports"`
	Privileged      bool               `yaml:"privileged"`
	ReadOnly        bool               `yaml:"read_only"`
	Restart         string             `yaml:"restart"`
	SecurityOpt     StrSlice           `yaml:"security_opt"`
	StdinOpen       bool               `yaml:"stdin_open"`
	StopGracePeriod string             `yaml:"stop_grace_period"`
	StopSignal      string             `yaml:"stop_signal"`
	ShmSize         string             `yaml:"shm_size"`
	Tmpfs           StrSlice           `yaml:"tmpfs"`
	Tty             bool               `yaml:"tty"`
	Ulimits         map[string]*Ulimit `yaml:"ulimits"`
	User            string             `yaml:"user"`
	Volumes         StrSlice           `yaml:"volumes"`
	WorkingDir      string             `yaml:"working_dir"`

	// swan extended attributes
	Deploy     *DeployConfig `yaml:"deploy"`
	Resource   *Resource     `yaml:"resource"`
	PullAlways bool          `yaml:"pull_always"`
	Proxy      *Proxy        `yaml:"proxy"`
	URIs       StrSlice      `yaml:"uris"`
	IPs        StrSlice      `yaml:"ips"`
}

ComposeService (-> App Version)

func (*ComposeService) Valid

func (s *ComposeService) Valid() error

type ComposeSorter added in v0.2.2

type ComposeSorter []*Compose

compose sorter

func (ComposeSorter) Len added in v0.2.2

func (s ComposeSorter) Len() int

func (ComposeSorter) Less added in v0.2.2

func (s ComposeSorter) Less(i, j int) bool

func (ComposeSorter) Swap added in v0.2.2

func (s ComposeSorter) Swap(i, j int)

type ComposeV3

type ComposeV3 struct {
	Version   string                     `yaml:"version"`
	Variables []string                   `yaml:"-"`
	Services  map[string]*ComposeService `yaml:"services"`
}

ComposeV3 represents parsed docker compose v3 object Services (-> map[name]App Version) note: do NOT support naming volumes & networks currently

func ParseComposeV3

func ParseComposeV3(data []byte, envMap map[string]string) (*ComposeV3, error)

func (*ComposeV3) Circled

func (c *ComposeV3) Circled() error

func (*ComposeV3) ConvertServiceToVersion

func (c *ComposeV3) ConvertServiceToVersion(svrName, cmpName, runAs, cluster string, extLabels map[string]string) (*Version, error)

convert specified Compose Service to App Version

func (*ComposeV3) DependMap

func (c *ComposeV3) DependMap() (map[string][]string, error)

func (*ComposeV3) GetServices

func (c *ComposeV3) GetServices() []string

func (*ComposeV3) GetVariables

func (c *ComposeV3) GetVariables() []string

func (*ComposeV3) PrioritySort

func (c *ComposeV3) PrioritySort() ([]string, error)

func (*ComposeV3) UnmarshalYAML

func (c *ComposeV3) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*ComposeV3) Valid

func (c *ComposeV3) Valid() error

type ComposeV3Alias

type ComposeV3Alias ComposeV3 // prevent oom

type ComposeWrapper added in v0.2.2

type ComposeWrapper struct {
	*Compose
	Apps []*Application `json:"apps"`
}

wrap compose with related apps

type Constraint

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

func (*Constraint) Match

func (c *Constraint) Match(attrs map[string]string) bool

type Container

type Container struct {
	Type    string    `json:"type"`
	Docker  *Docker   `json:"docker"`
	Volumes []*Volume `json:"volumes"`
}

func (*Container) Valid added in v0.2.5

func (c *Container) Valid() error

type ContainersInfo added in v0.2.1

type ContainersInfo struct {
	Total   int64 `json:"total"`
	Running int   `json:"running"`
	Stopped int   `json:"stopped"`
	Killed  int   `json:"killed"`
	Paused  int   `json:"paused"`
}

type DeployConfig

type DeployConfig struct {
	Replicas    int           `yaml:"replicas"`
	WaitDelay   int           `yaml:"wait_delay"`
	Constraints []*Constraint `yaml:"constraints"`
}

type Docker

type Docker struct {
	ForcePullImage bool           `json:"forcePullImage,omitempty"`
	Image          string         `json:"image"`
	Network        string         `json:"network,omitempty"`
	Parameters     []*Parameter   `json:"parameters,omitempty"`
	PortMappings   []*PortMapping `json:"portMappings,omitempty"`
	Privileged     bool           `json:"privileged,omitempty"`
}

func (*Docker) Valid added in v0.2.5

func (d *Docker) Valid() error

type DockerService

type DockerService struct {
	Name    string                `json:"name"`
	Service *ctypes.ServiceConfig `json:"service"`
	Network *ctypes.NetworkConfig `json:"network"`
	Volume  *ctypes.VolumeConfig  `json:"volume"`
	Extra   *YamlExtra            `json:"extra"`
}

DockerService (-> App Version)

func (*DockerService) ToVersion

func (s *DockerService) ToVersion(cName, cluster string) (*Version, error)

convert Docker service to App Version

func (*DockerService) Valid

func (s *DockerService) Valid() error

type EndpointIPAMConfig

type EndpointIPAMConfig struct {
	IPv4Address  string   `json:",omitempty"`
	IPv6Address  string   `json:",omitempty"`
	LinkLocalIPs []string `json:",omitempty"`
}

EndpointIPAMConfig represents IPAM configurations for the endpoint

type EndpointResource

type EndpointResource struct {
	Name        string
	EndpointID  string
	MacAddress  string
	IPv4Address string
	IPv6Address string
}

EndpointResource contains network resources allocated and used for a container in a network

type EndpointSettings

type EndpointSettings struct {
	// Configurations
	IPAMConfig *EndpointIPAMConfig
	Links      []string
	Aliases    []string
	// Operational data
	NetworkID           string
	EndpointID          string
	Gateway             string
	IPAddress           string
	IPPrefixLen         int
	IPv6Gateway         string
	GlobalIPv6Address   string
	GlobalIPv6PrefixLen int
	MacAddress          string
	DriverOpts          map[string]string
}

EndpointSettings stores the network endpoint details

type FrameworkInfo

type FrameworkInfo struct {
	ID string
}

type Health

type Health struct {
	Total     int64 `json:"total"`
	Healthy   int64 `json:"healthy"`
	UnHealthy int64 `json:"unhealthy"`
	UnSet     int64 `json:"unset"`
}

type HealthCheck

type HealthCheck struct {
	Protocol            string  `json:"protocol,omitempty"`
	PortName            string  `json:"portName,omitempty"`
	Path                string  `json:"path,omitempty"`
	Command             string  `json:"cmd,omitempty"`
	ConsecutiveFailures uint32  `json:"consecutiveFailures,omitempty"`
	GracePeriodSeconds  float64 `json:"gracePeriodSeconds,omitempty"`
	IntervalSeconds     float64 `json:"intervalSeconds,omitempty"`
	TimeoutSeconds      float64 `json:"timeoutSeconds,omitempty"`
	DelaySeconds        float64 `json:"delaySeconds,omitempty"`
}

func (*HealthCheck) Valid added in v0.2.3

func (h *HealthCheck) Valid() error

type HealthCheckConfig

type HealthCheckConfig struct {
	Test     StrSlice `yaml:"test"`
	Timeout  string   `yaml:"timeout"`
	Interval string   `yaml:"interval"`
	Retries  int      `yaml:"retries"`
	Disable  bool     `yaml:"disable"`
}

type IPAM

type IPAM struct {
	Driver  string
	Options map[string]string //Per network IPAM driver options
	Config  []IPAMConfig
}

IPAM represents IP Address Management

type IPAMConfig

type IPAMConfig struct {
	Subnet     string            `json:",omitempty"`
	IPRange    string            `json:",omitempty"`
	Gateway    string            `json:",omitempty"`
	AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"`
}

IPAMConfig represents IPAM configurations

type KillPolicy

type KillPolicy struct {
	Duration int64 `json:"duration,omitempty"` // by seconds
}

func (*KillPolicy) Valid added in v0.2.5

func (p *KillPolicy) Valid() error

type Leader

type Leader struct {
	Leader string `json:"leader"`
}

type LoggingConfig

type LoggingConfig struct {
	Driver  string   `yaml:"driver"`
	Options SliceMap `yaml:"options"`
}

type MemoryInfo added in v0.2.1

type MemoryInfo struct {
	Total int64 `json:"total"`
	Used  int64 `json:"used"`
}

type NetworkResource

type NetworkResource struct {
	Name       string                      // Name is the requested name of the network
	ID         string                      `json:"Id"` // ID uniquely identifies a network on a single machine
	Scope      string                      // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level)
	Driver     string                      // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
	EnableIPv6 bool                        // EnableIPv6 represents whether to enable IPv6
	IPAM       IPAM                        // IPAM is the network's IP Address Management
	Internal   bool                        // Internal represents if the network is used internal only
	Attachable bool                        // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
	Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
	Options    map[string]string           // Options holds the network specific options to use for when creating the network
	Labels     map[string]string           // Labels holds metadata specific to the network being created
}

NetworkResource is the body of the "get network" http response message

type NetworkSettings

type NetworkSettings struct {
	Networks map[string]*EndpointSettings
}

NetworkSettings exposes the network settings in the api

type Parameter

type Parameter struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

func (*Parameter) Valid added in v0.2.5

func (p *Parameter) Valid() error

type PortMapping

type PortMapping struct {
	ContainerPort int32  `json:"containerPort,omitempty"`
	HostPort      int32  `json:"hostPort,omitempty"`
	Name          string `json:"name,omitempty"`
	Protocol      string `json:"protocol,omitempty"`
}

func (*PortMapping) Valid added in v0.2.3

func (pm *PortMapping) Valid() error

type Proxy

type Proxy struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	Alias   string `json:"alias" yaml:"alias"`
	Listen  string `json:"listen" yaml:"listen"`
	Sticky  bool   `json:"sticky" yaml:"sticky"`
}

func (*Proxy) MarshalJSON added in v0.2.3

func (p *Proxy) MarshalJSON() ([]byte, error)

hijack Marshaler & Unmarshaler to make fit with int type `Listen`

func (*Proxy) UnmarshalJSON added in v0.2.3

func (p *Proxy) UnmarshalJSON(data []byte) error

func (*Proxy) Valid

func (p *Proxy) Valid() error

type ProxyAlias added in v0.2.3

type ProxyAlias struct {
	Enabled bool   `json:"enabled"`
	Alias   string `json:"alias"`
	Listen  int    `json:"listen"`
	Sticky  bool   `json:"sticky"`
}

similiar as above, but `Listen` int type

type RawComposeV3

type RawComposeV3 struct {
	Version  string        `yaml:"version"`
	Services RawServiceMap `yaml:"services"`
}

RawComposeV3 represent a ComposeV3 struct unparsed

type RawService

type RawService map[string]interface{}

RawService represent a Service in map form unparsed

type RawServiceMap

type RawServiceMap map[string]RawService

RawServiceMap a collection of RawServices

type Resource

type Resource struct {
	CPUs float64 `json:"cpus" yaml:"cpus"`
	GPUs float64 `json:"gpus" yaml:"gpus"`
	Mem  float64 `json:"mem" yaml:"mem"`
	Disk float64 `json:"disk" yaml:"disk"`
}

type RestartPolicy added in v0.2.1

type RestartPolicy struct {
	Retries int `json:"retries"`
}

func (*RestartPolicy) Valid added in v0.2.5

func (p *RestartPolicy) Valid() error

type Scale added in v0.2.1

type Scale struct {
	Instances int
	IPs       []string
}

type ServiceGroup

type ServiceGroup map[string]*DockerService

ServiceGroup (-> map[name]App Version)

func (ServiceGroup) DependMap added in v0.2.2

func (sg ServiceGroup) DependMap() (map[string][]string, error)

func (ServiceGroup) PrioritySort

func (sg ServiceGroup) PrioritySort() ([]string, error)

func (ServiceGroup) Valid

func (sg ServiceGroup) Valid() error

type SliceMap

type SliceMap map[string]string

StrSlice represents a map[string]strig or a []string

func (*SliceMap) UnmarshalYAML

func (m *SliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type Stats

type Stats struct {
	ClusterID string `json:"clusterID"`

	AppCount  int `json:"appCount"`
	TaskCount int `json:"taskCount"`

	Created float64 `json:"created"`

	Master string `json:"master"`
	Slaves string `json:"slaves"`

	Attributes []map[string]interface{} `json:"attributes"`

	TotalCpu  float64 `json:"totalCpu"`
	TotalMem  float64 `json:"totalMem"`
	TotalDisk float64 `json:"totalDisk"`

	CpuTotalOffered  float64 `json:"cpuTotalOffered"`
	MemTotalOffered  float64 `json:"memTotalOffered"`
	DiskTotalOffered float64 `json:"diskTotalOffered"`

	CpuTotalUsed  float64 `json:"cpuTotalUsed"`
	MemTotalUsed  float64 `json:"memTotalUsed"`
	DiskTotalUsed float64 `json:"diskTotalUsed"`

	AppStats map[string]int `json:"appStats,omitempty"`
}

type StrSlice

type StrSlice []string

StrSlice represents a single string or a []string

func (*StrSlice) UnmarshalYAML

func (s *StrSlice) UnmarshalYAML(unmarshal func(interface{}) error) error

type SysInfo added in v0.2.1

type SysInfo struct {
	Hostname   string              `json:"hostname"`
	OS         string              `json:"os"`
	Uptime     string              `json:"uptime"`
	UnixTime   int64               `json:"unixtime"`
	LoadAvg    float64             `json:"loadavg"`
	CPU        CPUInfo             `json:"cpu"`
	Memory     MemoryInfo          `json:"memory"`
	Containers ContainersInfo      `json:"containers"`
	IPs        map[string][]string `json:"ips"` // inet name -> ips
	Listenings []int64             `json:"listenings"`
}

type Task

type Task struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	IP            string    `json:"ip"`
	Ports         []uint64  `json:"ports"`
	Healthy       string    `json:"healthy"`
	Weight        float64   `json:"weight"`
	AgentId       string    `json:"agentId"`
	Version       string    `json:"version"`
	Status        string    `json:"status"`
	ErrMsg        string    `json:"errmsg"`
	OpStatus      string    `json:"opstatus"`
	ContainerID   string    `json:"container_id"`
	ContainerName string    `json:"container_name"`
	Retries       int       `json:"retries"`
	MaxRetries    int       `json:"maxRetries"`
	Histories     []*Task   `json:"histories"`
	Created       time.Time `json:"created"`
	Updated       time.Time `json:"updated"`
}

func (*Task) Index

func (t *Task) Index() string

type TaskConfig

type TaskConfig struct {
	CPUs           float64           `json:"cpus"`
	GPUs           float64           `json:"gpus"`
	Mem            float64           `json:"mem"`
	Disk           float64           `json:"disk"`
	IP             string            `json:"ip"`
	Ports          []uint64          `json:"ports"`
	Image          string            `json:"image"`
	Command        string            `json:"cmd"`
	Privileged     bool              `json:"privileged"`
	ForcePullImage bool              `json:"forcePullImage"`
	Volumes        []*Volume         `json:"volumes"`
	PortMappings   []*PortMapping    `json:"portmappings"`
	Network        string            `json:"network"`
	Parameters     []*Parameter      `json:"parameters"`
	HealthCheck    *HealthCheck      `json:"healthCheck"`
	KillPolicy     *KillPolicy       `json:"killPolicy"`
	RestartPolicy  *RestartPolicy    `json:"restart"`
	Labels         map[string]string `json:"labels"`
	URIs           []string          `json:"uris"`
	Env            map[string]string `json:"env"`
	Constraints    []*Constraint     `json:"constraints"`
	Proxy          *Proxy            `json:"proxy"`
	Version        string            `json:"version"`
}

func NewTaskConfig

func NewTaskConfig(spec *Version, idx int) *TaskConfig

func (*TaskConfig) BuildCommand

func (c *TaskConfig) BuildCommand() *mesosproto.CommandInfo

func (*TaskConfig) BuildContainer

func (c *TaskConfig) BuildContainer(id, name string) *mesosproto.ContainerInfo

func (*TaskConfig) BuildHealthCheck

func (c *TaskConfig) BuildHealthCheck() *mesosproto.HealthCheck

func (*TaskConfig) BuildLabels

func (c *TaskConfig) BuildLabels(id, name string) *mesosproto.Labels

func (*TaskConfig) BuildResources

func (c *TaskConfig) BuildResources() []*mesosproto.Resource

type TaskEvent

type TaskEvent struct {
	Type           string  `json:"type"`
	AppID          string  `json:"app_id"`
	AppAlias       string  `json:"app_alias"`  // for proxy
	AppListen      string  `json:"app_listen"` // for proxy
	AppSticky      bool    `json:"app_sticky"` // for proxy
	VersionID      string  `json:"version_id"`
	AppVersion     string  `json:"app_version"`
	TaskID         string  `json:"task_id"`
	IP             string  `json:"task_ip"`
	Port           uint64  `json:"task_port"`
	Weight         float64 `json:"weihgt"`
	GatewayEnabled bool    `json:"gateway"` // for proxy
}

func (*TaskEvent) Format

func (e *TaskEvent) Format() []byte

Format format task events to SSE text

type TaskList

type TaskList []*Task

func (TaskList) Len

func (tl TaskList) Len() int

func (TaskList) Less

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

func (TaskList) Reverse

func (tl TaskList) Reverse()

func (TaskList) Sort

func (tl TaskList) Sort()

func (TaskList) Swap

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

type TaskSorter

type TaskSorter []*Task

func (TaskSorter) Len

func (s TaskSorter) Len() int

func (TaskSorter) Less

func (s TaskSorter) Less(i, j int) bool

func (TaskSorter) Swap

func (s TaskSorter) Swap(i, j int)

type Ulimit

type Ulimit struct {
	Soft int `yaml:"soft"`
	Hard int `yaml:"hard"`
}

Ulimit represents a single int or a Ulimit

func (*Ulimit) UnmarshalYAML

func (u *Ulimit) UnmarshalYAML(unmarshal func(interface{}) error) error

type UlimitAlias

type UlimitAlias Ulimit // prevent oom

type UpdatePolicy

type UpdatePolicy struct {
	Delay     float64 `json:"delay"`
	OnFailure string  `json:"onFailure,omitempty"`
}

func (*UpdatePolicy) Valid added in v0.2.5

func (p *UpdatePolicy) Valid() error

type UpdateWeightBody

type UpdateWeightBody struct {
	Weight float64 `json:"weight"`
}

type UpdateWeightsBody

type UpdateWeightsBody struct {
	Value float64
}

type Version

type Version struct {
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	Command       string            `json:"cmd"`
	CPUs          float64           `json:"cpus"`
	GPUs          float64           `json:"gpus"`
	Mem           float64           `json:"mem"`
	Disk          float64           `json:"disk"`
	Instances     int32             `json:"instances"`
	RunAs         string            `json:"runAs"`
	Cluster       string            `json:"cluster"`
	Container     *Container        `json:"container"`
	Labels        map[string]string `json:"labels"`
	HealthCheck   *HealthCheck      `json:"healthCheck"`
	Env           map[string]string `json:"env"`
	KillPolicy    *KillPolicy       `json:"kill"`
	RestartPolicy *RestartPolicy    `json:"restart"`
	UpdatePolicy  *UpdatePolicy     `json:"update"`
	Constraints   []*Constraint     `json:"constraints"`
	URIs          []string          `json:"uris"`
	IPs           []string          `json:"ips"`
	Proxy         *Proxy            `json:"proxy"`
}

func (*Version) AddLabel

func (v *Version) AddLabel(name, value string) *Version

AddLabel adds a label to the application

func (*Version) EmptyLabels

func (v *Version) EmptyLabels() *Version

EmptyLabels explicitly empties the labels

func (*Version) IsHealthSet added in v0.2.2

func (v *Version) IsHealthSet() bool

func (*Version) Validate

func (v *Version) Validate() error

type VersionList

type VersionList []*Version

func (VersionList) Len

func (vl VersionList) Len() int

func (VersionList) Less

func (vl VersionList) Less(i, j int) bool

func (VersionList) Reverse

func (vl VersionList) Reverse()

func (VersionList) Sort

func (vl VersionList) Sort()

func (VersionList) Swap

func (vl VersionList) Swap(i, j int)

type Volume

type Volume struct {
	ContainerPath string `json:"containerPath,omitempty"`
	HostPath      string `json:"hostPath,omitempty"`
	Mode          string `json:"mode,omitempty"`
}

func (*Volume) Valid added in v0.2.5

func (v *Volume) Valid() error

type YamlExtra

type YamlExtra struct {
	Cluster     string            `json:"cluster"`
	WaitDelay   uint              `json:"wait_delay"` // by second
	PullAlways  bool              `json:"pull_always"`
	Resource    *Resource         `json:"resource"`
	Constraints []*Constraint     `json:"constraints"`
	RunAs       string            `json:"runas"`
	URIs        []string          `json:"uris"`
	IPs         []string          `json:"ips"`
	Labels      map[string]string `json:"labels"` // extra labels: uid, username, vcluster ...
	Proxy       *Proxy            `json:"proxy"`
}

YamlExtra

Jump to

Keyboard shortcuts

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