dcos

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	AdminUsername string
	AgentFQDN     string
	Connection    *remote.Connection
}

Cluster holds information on how to communicate with the the dcos instances

func NewCluster

func NewCluster(cfg *config.Config, eng *engine.Engine) (*Cluster, error)

NewCluster returns a new cluster struct

func (*Cluster) AppCount

func (c *Cluster) AppCount() (int, error)

AppCount will determine the number of apps installed

func (*Cluster) AppExists

func (c *Cluster) AppExists(path string) bool

AppExists queries the marathon app list to see if an app exists for a given path

func (*Cluster) AppHealthy

func (c *Cluster) AppHealthy(path string) bool

AppHealthy returns true if the app is deployed and healthy

func (*Cluster) GetNodes

func (c *Cluster) GetNodes() ([]Node, error)

GetNodes will return a []Node for a given cluster

func (*Cluster) InstallDCOSClient

func (c *Cluster) InstallDCOSClient() error

InstallDCOSClient will download and place in the path the dcos client

func (*Cluster) InstallMarathonApp

func (c *Cluster) InstallMarathonApp(filepath string, sleep, duration time.Duration) (int, error)

InstallMarathonApp will send the marathon.json file to the remote server and install it using the dcos cli

func (*Cluster) InstallMarathonLB

func (c *Cluster) InstallMarathonLB() error

InstallMarathonLB will setup a loadbalancer if one has not been created

func (*Cluster) NodeCount

func (c *Cluster) NodeCount() (int, error)

NodeCount will return the node count for a dcos cluster

func (*Cluster) PackageExists

func (c *Cluster) PackageExists(name string) bool

PackageExists retruns true if the package name is found when doing dcos package list

func (*Cluster) Version

func (c *Cluster) Version() (string, error)

Version will return the node count for a dcos cluster

func (*Cluster) WaitForNodes

func (c *Cluster) WaitForNodes(nodeCount int, sleep, duration time.Duration) bool

WaitForNodes will return an false if the nodes never become healthy

func (*Cluster) WaitOnReady

func (c *Cluster) WaitOnReady(path string, sleep, duration time.Duration) bool

WaitOnReady will block until app is in ready state

type Container

type Container struct {
	Type   string `json:"type"`
	Docker Docker `json:"docker"`
}

Container holds information about the type of container being deployed

type Docker

type Docker struct {
	Image          string    `json:"image"`
	Network        string    `json:"network"`
	Priviledged    bool      `json:"priviledged"`
	ForcePullImage bool      `json:"forcePullImage"`
	PortMappings   []PortMap `json:"portMappings"`
}

Docker tells what image is being deployed and its port mappings

type HealthCheck

type HealthCheck struct {
	GracePeriodSeconds     int    `json:"gracePeriodSeconds"`
	IntervalSeconds        int    `json:"intervalSeconds"`
	TimeoutSeconds         int    `json:"timeoutSeconds"`
	MaxConsecutiveFailures int    `json:"maxConsecutiveFailures"`
	PortIndex              int    `json:"portIndex"`
	Path                   string `json:"path"`
	Protocol               string `json:"protocol"`
	IgnoreHTTP1xx          bool   `json:"ignoreHttp1xx"`
}

HealthCheck contains the information needed to tell DCOS how to health check a given app

type List

type List struct {
	Nodes []Node `json:"nodes"`
}

List holds a slice of nodes

type MarathonApp

type MarathonApp struct {
	ID                    string              `json:"id"`
	Instances             int                 `json:"instances"`
	CPUS                  float64             `json:"cpus"`
	Memory                int                 `json:"mem"`
	Disk                  int                 `json:"disk"`
	GPUS                  int                 `json:"gpus"`
	BackoffSeconds        int                 `json:"backoffSeconds"`
	BackoffFactor         float64             `json:"backoffFactor"`
	MaxLaunchDelaySeconds int                 `json:"maxLaunchDelaySeconds"`
	RequirePorts          bool                `json:"requirePorts"`
	KillSelection         string              `json:"killSelection"`
	TaskHealthy           int                 `json:"tasksHealthy"`
	TaskRunning           int                 `json:"tasksRunning"`
	TaskStaged            int                 `json:"tasksStaged"`
	TaskUnhealthy         int                 `json:"tasksUnhealthy"`
	Container             Container           `json:"container"`
	HealthChecks          []HealthCheck       `json:"healthChecks"`
	UpgradeStrategy       UpgradeStrategy     `json:"upgradeStrategy"`
	UnreachableStrategy   UnreachableStrategy `json:"unreachableStrategy"`
	AcceptedResourceRoles []string            `json:"acceptedResourceRoles"`
	Labels                map[string]string   `json:"labels"`
}

MarathonApp is the parent struct for a marathon app declared as json

type Node

type Node struct {
	Host   string `json:"host_ip"`
	Health int    `json:"health"`
	Role   string `json:"role"`
}

Node represents a node object returned from querying the v1/nodes api

type PortMap

type PortMap struct {
	Name          string `json:"name"`
	ContainerPort int    `json:"containerPort"`
	HostPort      int    `json:"hostPort"`
	ServicePort   int    `json:"servicePort"`
	Protocol      string `json:"protocol"`
}

PortMap is how the ports are exposed to the system and container

type UnreachableStrategy

type UnreachableStrategy struct {
	InactiveAfterSeconds int `json:"inactiveAfterSeconds"`
	ExpungeAfterSeconds  int `json:"expungeAfterSeconds"`
}

UnreachableStrategy tells how long to wait if an instance isnt reachable

type UpgradeStrategy

type UpgradeStrategy struct {
	MinimumHealthCapacity int `json:"minimumHealthCapacity"`
	MaximumOverCapacity   int `json:"maximumOverCapacity"`
}

UpgradeStrategy holds how many instances can be up or down during an upgrade

type Version

type Version struct {
	Version string `json:"version"`
}

Version holds response from calling http://localhost:80/dcos-metadata/dcos-version.json

Jump to

Keyboard shortcuts

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