types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpStatusNoop     = "noop"
	OpStatusCreating = "creating"
	OpStatusScaling  = "scaling"
	OpStatusUpdating = "updating"
	OpStatusDeleting = "deleting"
	OpStatusRollback = "rollbacking"
)
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 MaxDeployStep = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type AppFilterOptions

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

type Application

type Application struct {
	ID        string      `json:"id"`
	Name      string      `json:"name"`
	Alias     string      `json:"alias"`
	RunAs     string      `json:"runAs"`
	Priority  int         `json:"priority"`
	Cluster   string      `json:"cluster"`
	OpStatus  string      `json:"operationStatus"`
	Tasks     TaskList    `json:"tasks"`
	Version   []string    `json:"currentVersion"`
	Versions  VersionList `json:"versions"`
	Status    string      `json:"status"`
	Health    *Health     `json:"health"`
	CreatedAt time.Time   `json:"created"`
	UpdatedAt time.Time   `json:"updated"`
}

type Compose

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

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

save to -> keyCompose

func (*Compose) RequireConvert

func (c *Compose) RequireConvert() bool

func (*Compose) ToServiceGroup

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

func (*Compose) Valid

func (c *Compose) Valid() error

type Constraint

type Constraint struct {
	Attribute string `json:"attribute"`
	Operator  string `json:"operator"`
	Value     string `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"`
}

type DeployPolicy

type DeployPolicy struct {
	Step      int64  `json:"step"`
	OnFailure string `json:"onfailure"`
}

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"`
}

type DockerService

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

func (*DockerService) ToVersion

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

func (*DockerService) Valid

func (s *DockerService) Valid() error

type FrameworkInfo

type FrameworkInfo struct {
	ID string
}

type Gateway

type Gateway struct {
	Enabled bool    `json:"enabled"`
	Weight  float64 `json:"weight,omitempty"`
}

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"`
}

type KillPolicy

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

type Leader

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

type Parameter

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

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"`
}

type Proxy

type Proxy struct {
	Enabled bool   `json:"enabled"`
	Alias   string `json:"alias"`
}

type Resource

type Resource struct {
	CPU   float64  `json:"cpu"`
	Mem   float64  `json:"mem"`
	Disk  float64  `json:"disk"`
	Ports []uint64 `json:"ports"`
}

type ScaleBody

type ScaleBody struct {
	Instances int      `json:"instances"`
	IPs       []string `json:"ips"` // TODO(nmg): Removed after automatic IPAM.
}

type ServiceGroup

type ServiceGroup map[string]*DockerService

func (ServiceGroup) PrioritySort

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

func (ServiceGroup) Valid

func (sg ServiceGroup) Valid() 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 Task

type Task struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	IP       string    `json:"ip"`
	Port     uint64    `json:"port"`
	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"`
	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"`
	Mem            float64           `json:"mem"`
	Disk           float64           `json:"disk"`
	IP             string            `json:"ip"`
	Port           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"`
	Labels         map[string]string `json:"labels"`
	URIs           []string          `json:"uris"`
	Env            map[string]string `json:"env"`
	Constraints    []*Constraint     `json:"constraints"`
	Proxy          *Proxy            `json:"proxy"`
}

func NewTaskConfig

func NewTaskConfig(spec *Version) *TaskConfig

func (*TaskConfig) BuildCommand

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

func (*TaskConfig) BuildContainer

func (c *TaskConfig) BuildContainer(offer *mesosproto.Offer) *mesosproto.ContainerInfo

func (*TaskConfig) BuildHealthCheck

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

func (*TaskConfig) BuildKillPolicy

func (c *TaskConfig) BuildKillPolicy() *mesosproto.KillPolicy

func (*TaskConfig) BuildLabels

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

func (*TaskConfig) BuildResources

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

type TaskEvent

type TaskEvent struct {
	Type           string  `json:"type"`
	AppID          string  `json:"app_id"`
	AppAlias       string  `json:"app_alias"`
	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"`
}

func (*TaskEvent) Format

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

Format format task events to SSE text

type TaskHistory

type TaskHistory struct {
	ID         string `json:"id"`
	AppID      string `json:"appID"`
	VersionID  string `json:"versionID"`
	AppVersion string `json:"appVersion"`

	OfferID       string `json:"offerID"`
	AgentID       string `json:"agentID"`
	AgentHostname string `json:"agentHostname"`

	CPU  float64 `json:"cpu"`
	Mem  float64 `json:"mem"`
	Disk float64 `json:"disk"`

	State   string `json:"state,omitempty"`
	Reason  string `json:"reason,omitempty"`
	Message string `json:"message,omitempty"`
	Stdout  string `json:"stdout,omitempty"`
	Stderr  string `json:"stderr,omitempty"`

	ArchivedAt    time.Time `json:"archivedAt, omitempty"`
	ContainerId   string    `json:"containerId"`
	ContainerName string    `json:"containerName"`
	Weight        float64   `json:"weight,omitempty"`
}

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() TaskList

func (TaskList) Sort

func (tl TaskList) Sort() TaskList

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 UpdateBody

type UpdateBody struct {
	Instances int     `json:"instances"`
	Canary    *canary `json:"canary"`
}

type UpdatePolicy

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

type UpdateWeightBody

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

type UpdateWeightsBody

type UpdateWeightsBody struct {
	Weights map[string]float64 `json:"weights"`
}

type Version

type Version struct {
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	Command      string            `json:"cmd"`
	CPUs         float64           `json:"cpus"`
	Mem          float64           `json:"mem"`
	Disk         float64           `json:"disk"`
	Instances    int32             `json:"instances"`
	RunAs        string            `json:"runAs"`
	Priority     int32             `json:"priority"`
	Container    *Container        `json:"container"`
	Labels       map[string]string `json:"labels"`
	HealthCheck  *HealthCheck      `json:"healthCheck"`
	Env          map[string]string `json:"env"`
	DeployPolicy *DeployPolicy     `json:"deploy"`
	KillPolicy   *KillPolicy       `json:"kill"`
	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

name:	the name of the label
value: value for this label

func (*Version) EmptyLabels

func (v *Version) EmptyLabels() *Version

EmptyLabels explicitly empties the labels -- use this if you need to empty the labels of an application that already has labels set (setting labels to nil will keep the current value)

func (*Version) Validate

func (v *Version) Validate() error

validate version TODO(nmg): use json schema validation replace latter.

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() VersionList

func (VersionList) Sort

func (vl VersionList) Sort() VersionList

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"`
}

type YamlExtra

type YamlExtra struct {
	Priority    uint              `json:"priority"`
	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"`
}

Jump to

Keyboard shortcuts

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