lib

package
v0.0.0-...-d8ae95f Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CLR_0 = "\x1b[30;1m"
View Source
const CLR_G = "\x1b[32;1m"
View Source
const CLR_N = "\x1b[0m"
View Source
const CLR_R = "\x1b[31;1m"
View Source
const CLR_Y = "\x1b[33;1m"

Variables

View Source
var (
	ErrParameterMissing = errors.New("Required command parameters missing from call, please see log for more details")
	ErrMarathonError    = errors.New("An error accoured while querying the Marathon API, please see logs for more details")
	ErrMesosError       = errors.New("An error accoured while querying the Mesos API, please see logs for more details")
	ErrLeaderRequired   = errors.New("This task is required to be run on the cluster leader.")
)

Functions

func ContainerRunning

func ContainerRunning(container string, client DockerClient) (bool, error)

TODO (boldfield) :: This is kind of stupid... we shouldn't be loading all running containers TODO (boldfield) :: every time we check for the existance of a single container

func GetExternalIP

func GetExternalIP() (string, error)

func ListRunningContainers

func ListRunningContainers(client DockerClient, ignoredImages []string) ([]string, error)

TODO (boldfield) :: Using this method as a data source for the above method would be nice...

func NewDockerClient

func NewDockerClient() *docker.Client

func PrintBool

func PrintBool(b bool) string

func PrintGreen

func PrintGreen(txt string) string

func PrintRed

func PrintRed(txt string) string

func PrintYellow

func PrintYellow(txt string) string

func StopContainer

func StopContainer(name string, timeout uint, client DockerClient) error

Types

type Config

type Config struct {
	Environment map[string]*struct {
		Marathon_Host string
		Mesos_Host    string
	}
}

func LoadCfg

func LoadCfg(file string) Config

type DockerClient

type DockerClient interface {
	ListContainers(opts docker.ListContainersOptions) ([]docker.APIContainers, error)
	StopContainer(id string, ttl uint) error
}

type FrameworkMap

type FrameworkMap map[string]*mesos.Framework

type Marathon

type Marathon struct {
	Host string
	Apps []marathon.Application
	// contains filtered or unexported fields
}

func (*Marathon) Client

func (m *Marathon) Client() marathon.Marathon

func (*Marathon) LoadAppTasks

func (m *Marathon) LoadAppTasks(client MarathonClient, a *marathon.Application) error

func (*Marathon) LoadApps

func (m *Marathon) LoadApps(client MarathonClient) error

type MarathonApp

type MarathonApp struct {
	Id    string
	Tasks []*MarathonTask
}

func (*MarathonApp) AddTask

func (a *MarathonApp) AddTask(taskId, slaveId, slaveHost string, mesos, marathon, docker bool) *MarathonTask

func (*MarathonApp) GetTaskById

func (a *MarathonApp) GetTaskById(taskId string) *MarathonTask

type MarathonApps

type MarathonApps struct {
	Apps []*MarathonApp
}

func (*MarathonApps) AddApp

func (ma *MarathonApps) AddApp(appId string) *MarathonApp

func (*MarathonApps) AddTask

func (ma *MarathonApps) AddTask(taskId, appId, slaveId, slaveHost string, mesos, marathon, docker bool) *MarathonTask

func (*MarathonApps) GetAppById

func (ma *MarathonApps) GetAppById(appId string) *MarathonApp

type MarathonClient

type MarathonClient interface {
	ListApplications(url.Values) ([]string, error)
	Applications(url.Values) (*marathon.Applications, error)
	Tasks(string) (*marathon.Tasks, error)
}

type MarathonTask

type MarathonTask struct {
	Id        string
	Container string
	SlaveId   string
	SlaveHost string
	Mesos     bool
	Marathon  bool
	Docker    bool
}

type Mesos

type Mesos struct {
	Host    string
	Cluster *mesos.Cluster
	// contains filtered or unexported fields
}

func (*Mesos) Client

func (m *Mesos) Client() *mesos.Client

func (*Mesos) ErrIfNotLeader

func (m *Mesos) ErrIfNotLeader() error

func (*Mesos) Framework

func (m *Mesos) Framework(framework string) FrameworkMap

func (*Mesos) LoadCluster

func (m *Mesos) LoadCluster(c *mesos.Client) error

Loads the entire cluster, including information about slaves

func (*Mesos) LoadClusterInfo

func (m *Mesos) LoadClusterInfo(c *mesos.Client) error

Loads information about the cluster from the master, does not check slaves

func (*Mesos) LoadSlaveState

func (m *Mesos) LoadSlaveState(host string, c *mesos.Client) (*MesosSlave, error)

func (*Mesos) LoadSlaveStats

func (m *Mesos) LoadSlaveStats(host string, c *mesos.Client) (*MesosSlave, error)

type MesosSlave

type MesosSlave struct {
	Slave *mesos.Slave
}

func (*MesosSlave) Framework

func (s *MesosSlave) Framework(framework string) FrameworkMap

Jump to

Keyboard shortcuts

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