Documentation ¶
Index ¶
- Variables
- func GetAgentIP() string
- func GetDockerDNS() []string
- func GetESStartupTimeout() int
- func GetGateway(defaultRPCPort int) string
- func GetVarPath() string
- func LoadOptions(ops Options)
- func NormalizeYYYYMMDD(s string) (string, error)
- type API
- type AttachConfig
- type CompileTemplateConfig
- type ControllerOptions
- type DeployTemplateConfig
- type ExportLogsConfig
- type HostConfig
- type IPConfig
- type ImageMap
- type Options
- type PoolConfig
- type PortMap
- type RunningService
- type SchedulerConfig
- type ServiceConfig
- type ServiceMap
- type ServiceStateController
- type ShellConfig
- type URL
Constants ¶
This section is empty.
Variables ¶
var LogstashDays = func() ([]string, error) { response, e := elastigo.DoCommand("GET", "/_aliases", nil) if e != nil { return []string{}, fmt.Errorf("couldn't fetch list of indices: %s", e) } var aliasMap map[string]interface{} if e = json.Unmarshal(response, &aliasMap); e != nil { return []string{}, fmt.Errorf("couldn't parse response (%s): %s", response, e) } result := make([]string, 0, len(aliasMap)) for index := range aliasMap { if trimmed := strings.TrimPrefix(index, "logstash-"); trimmed != index { if trimmed, e = NormalizeYYYYMMDD(trimmed); e != nil { trimmed = "" } result = append(result, trimmed) } } sort.Sort(sort.Reverse(sort.StringSlice(result))) return result, nil }
Returns a list of all the dates with a logstash-YYYY.MM.DD index available in ElasticSearch. The strings are in YYYY.MM.DD format, and in reverse chronological order.
Functions ¶
func GetESStartupTimeout ¶
func GetESStartupTimeout() int
GetESStartupTimeout returns the Elastic Search Startup Timeout
func NormalizeYYYYMMDD ¶
NormalizeYYYYMMDD matches optional non-digits, 4 digits, optional non-digits, 2 digits, optional non-digits, 2 digits, optional non-digits Returns those 8 digits formatted as "dddd.dd.dd", or error if unparseable.
Types ¶
type API ¶
type API interface { // Server StartServer() error StartProxy(ControllerOptions) error // Hosts GetHosts() ([]host.Host, error) GetHost(string) (*host.Host, error) AddHost(HostConfig) (*host.Host, error) RemoveHost(string) error // Pools GetResourcePools() ([]pool.ResourcePool, error) GetResourcePool(string) (*pool.ResourcePool, error) AddResourcePool(PoolConfig) (*pool.ResourcePool, error) RemoveResourcePool(string) error GetPoolIPs(string) (*facade.PoolIPs, error) AddVirtualIP(pool.VirtualIP) error RemoveVirtualIP(pool.VirtualIP) error // Services GetServices() ([]service.Service, error) GetServiceStates(string) ([]servicestate.ServiceState, error) GetServiceStatus(string) (map[string]dao.ServiceStatus, error) GetService(string) (*service.Service, error) GetServicesByName(string) ([]service.Service, error) AddService(ServiceConfig) (*service.Service, error) RemoveService(string) error UpdateService(io.Reader) (*service.Service, error) StartService(SchedulerConfig) (int, error) RestartService(SchedulerConfig) (int, error) StopService(SchedulerConfig) (int, error) AssignIP(IPConfig) error // RunningServices (ServiceStates) GetRunningServices() ([]dao.RunningService, error) Attach(AttachConfig) error Action(AttachConfig) error // Shell StartShell(ShellConfig) error RunShell(ShellConfig) error // Snapshots GetSnapshots() ([]dao.SnapshotInfo, error) GetSnapshotsByServiceID(string) ([]dao.SnapshotInfo, error) AddSnapshot(string, string) (string, error) RemoveSnapshot(string) error Commit(string) (string, error) Rollback(string, bool) error // Templates GetServiceTemplates() ([]template.ServiceTemplate, error) GetServiceTemplate(string) (*template.ServiceTemplate, error) AddServiceTemplate(io.Reader) (*template.ServiceTemplate, error) RemoveServiceTemplate(string) error CompileServiceTemplate(CompileTemplateConfig) (*template.ServiceTemplate, error) DeployServiceTemplate(DeployTemplateConfig) ([]service.Service, error) // Backup & Restore Backup(string) (string, error) Restore(string) error // Docker ResetRegistry() error Squash(imageName, downToLayer, newName, tempDir string) (string, error) RegistrySync() error // Logs ExportLogs(config ExportLogsConfig) error // Metric PostMetric(metricName string, metricValue string) (string, error) ScriptRun(fileName string, config *script.Config, stopChan chan struct{}) error ScriptParse(fileName string, config *script.Config) error }
API is the intermediary between the command-line interface and the dao layer
type AttachConfig ¶
type AttachConfig struct { Running *dao.RunningService Command string Args []string }
AttachConfig is the deserialized object from the command-line
type CompileTemplateConfig ¶
CompileTemplateConfig is the configuration object to conpile a template directory
type ControllerOptions ¶
type ControllerOptions struct { ServiceID string // The uuid of the service to launch InstanceID string // The service state instance id Command []string // The command to launch MuxPort int // the TCP port for the remote mux Mux bool // True if a remote mux is used TLS bool // True if TLS should be used on the mux KeyPEMFile string // path to the KeyPEMfile CertPEMFile string // path to the CertPEMfile ServicedEndpoint string Autorestart bool MetricForwarderPort string // port to which container processes send performance data to Logstash bool LogstashBinary string // path to the logstash-forwarder binary LogstashConfig string // path to the logstash-forwarder config file LogstashIdleFlushTime string // how often should log stash flush its logs LogstashSettleTime string // how long to wait for log stash to flush its logs before exiting VirtualAddressSubnet string // The subnet of virtual addresses, 10.3 MetricForwardingEnabled bool // Enable metric forwarding from the container }
ControllerOptions are options to be run when starting a new proxy server
type DeployTemplateConfig ¶
type DeployTemplateConfig struct { ID string PoolID string DeploymentID string ManualAssignIPs bool }
DeployTemplateConfig is the configuration object to deploy a template
type ExportLogsConfig ¶
ExportLogsConfig is the deserialized object from the command-line
type HostConfig ¶
HostConfig is the deserialized object from the command-line
type ImageMap ¶
ImageMap parses docker image data
type Options ¶
type Options struct { Endpoint string // the endpoint address to make RPC requests to UIPort string Listen string OutboundIP string // outbound ip to listen on Master bool DockerDNS []string Agent bool MuxPort int TLS bool KeyPEMFile string CertPEMFile string VarPath string ResourcePath string Zookeepers []string RemoteZookeepers []string ReportStats bool HostStats string StatsPeriod int MCUsername string MCPasswd string Mount []string ResourcePeriod int FSType string ESStartupTimeout int HostAliases []string Verbosity int StaticIPs []string DockerRegistry string CPUProfile string // write cpu profile to file MaxContainerAge int // max container age in seconds MaxDFSTimeout int // max timeout for snapshot VirtualAddressSubnet string MasterPoolID string LogstashES string //logstatsh elasticsearch host:port LogstashMaxDays int // Days to keep logstash indices LogstashMaxSize int // Max size of logstash data DebugPort int // Port to listen for profile clients AdminGroup string // user group that can log in to control center MaxRPCClients int // the max number of rpc clients to an endpoint RPCDialTimeout int SnapshotTTL int // hours to keep snapshots around, zero for infinity }
Options are the server options
type PoolConfig ¶
PoolConfig is the deserialized data from the command-line
type PortMap ¶
type PortMap map[string]servicedefinition.EndpointDefinition
PortMap parses remote and local port data from the command line
type RunningService ¶
type RunningService struct { Service *service.Service State *servicestate.ServiceState }
RunningService contains the service for a state
type SchedulerConfig ¶
type ServiceConfig ¶
type ServiceConfig struct { Name string ParentServiceID string ImageID string Command string LocalPorts *PortMap RemotePorts *PortMap }
ServiceConfig is the deserialized object from the command-line
type ServiceMap ¶
ServiceMap maps services by its service id
func NewServiceMap ¶
func NewServiceMap(services []service.Service) ServiceMap
NewServiceMap creates a new service map from a slice of services
func (ServiceMap) Add ¶
func (m ServiceMap) Add(service service.Service) error
Add appends a service to the service map
func (ServiceMap) Get ¶
func (m ServiceMap) Get(serviceID string) service.Service
Get gets a service from the service map identified by its service id
func (ServiceMap) Remove ¶
func (m ServiceMap) Remove(serviceID string) error
Remove removes a service from the service map
func (ServiceMap) Tree ¶
func (m ServiceMap) Tree() map[string][]string
Tree returns a map of parent services and its list of children
func (ServiceMap) Update ¶
func (m ServiceMap) Update(service service.Service)
Update updates an existing service within the ServiceMap. If the service not exist, it gets created.
type ServiceStateController ¶
type ServiceStateController func(SchedulerConfig) (int, error)
Type of method that controls the state of a service
type ShellConfig ¶
type ShellConfig struct { ServiceID string Command string Args []string Username string SaveAs string IsTTY bool Mounts []string ServicedEndpoint string LogToStderr bool LogStash struct { Enable bool SettleTime string IdleFlushTime string } }
ShellConfig is the deserialized object from the command-line