maestroSpecs

package module
Version: v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

maestro-specs

Maestro RMI payload specifications

Overview

Maestro provides managment of the following:

  • Job Management: Jobs are usually one or more pieces of software which can be started & stopped.
    See jobsAndImages.go

  • Software image management: Jobs need software to run. Image management handles the movement, installation, deletion and version control of software used by a Job. Job definitions may reside, but an image may be updated. If the image is updated, the Job is simply started, the image is updated, and then the Job is restarted.
    See jobsAndImages.go

  • Config management: Jobs usually have a 'configuration' piece. This config may be a simple string of data, or may be one or many complex configuration files. These configs need to be moved, stored and made available to a Job.
    See config.go

  • Templates & containers: Many jobs use similar forms and require similar resources. Templates allow defining of common procedures such as start commands, resource requirements, and security settings. Example: A deviceJS script requires a standard way of starting, so deviceJS jobs use a particular template. Capabilities such as chroot()ing a process, limiting memory and other resources, and running a Job under a particular user ID are available through templates.
    See jobsAndImages.go

    Some Container Templates are predefined, such as devicejs. These templates are defined in the maestro config file.

A 'Running Config'

The simple way to update an entire configuration with Maestro is to send the daemon a 'running config' which is a larger JSON payload which states exactly what Jobs, Container Templates they use, Images they use, and Configs they use, as one large task for the daemon to setup.

Example:

Setup two deviceJS processes, each with multiple modules a piece. Each module is defined as a Job, but the Jobs can share the same process via their composite process ID which can be retried with GetCompositeProcess(). This example also sets up a single Job which just launches a proprietary binary.

As JSON

{
   "config" : "running",
   "date": 7329847329,
   "jobs":
     [
        {
          "job": "zigbeeHA",
          "composite_id": "devicejs-core-modules",
          "container_template":"devicejs",
          "config":"zigbeeHA-edge500v1"
        },
        {
          "job": "UPnP",
          "composite_id": "devicejs-core-modules",
          "container_template":"devicejs",
          "config":"std",
          "disabled":true
        },
        {
          "job": "testscript2",
          "container_template":"python-wrapper-debug",
          "exec_cmd":"{{IMAGE}}/testscript2.py"
        }        
     ],
  "templates":
     [
        {
          "name":"python-wrapper-debug",
          "exec_cmd":"/usr/bin/python",
          "exec_pre_args":[ "-v" ],
          "restart": true,
          "restart_limit":10,
          "uses_ok_string":true,
          "cgroup": {
             "mem_limit":10485100
          },
          "inherit_env": true,
          "add_env": [ "SPECIALVAR=stuff" ]
        }
     ],
  "images": 
     [
        {
          "job":"testscript2",
          "version":"0.0.1",
          "url":"https://www.wigwag.io/images/testscript2.tar.gz",
          "size": 10922,
          "checksum" : {
            "type":"sha256sum",
            "value":"c01b39c7a35ccc3b081a3e83d2c71fa9a767ebfeb45c69f08e17dfe3ef375a7b"
          },
          "image_type":"tarball"
        },
        {
          "job":"zigbeeHA",
          "version":"1.0.8",
          "url":"https://www.wigwag.io/images/wigwag-core-modules_zigbeeha_aarch64.tar.gz",
          "size": 419181,
          "checksum" : {
            "type":"sha256sum",
            "value":"defbabca35ccc3b081a3e83d2c71fa9a767ebfeb45c69f08e17dfe3ef375a7b"
          },
          "image_type":"devicejs_tarball"
        },
        {
          "job":"UPnP",
          "version":"1.0.1",
          "url":"https://www.wigwag.io/images/wigwag-core-modules_upnp_aarch64.tar.gz",
          "size": 10991,
          "checksum" : {
            "type":"sha256sum",
            "value":"09fba37a35ccc3b081a3e83d2c71fa9a767ebfeb45c69f08e17dfe3ef375a7b"
          },
          "image_type":"devicejs_tarball"
        }
     ],
  "configs":
     [
        {
           "name":"standard-edge500",
           "job":"zigbeeHA",
           "data": "{\n    \"siodev\": \"/dev/ttyUSB0\",\n    \"devType\": 0,\n    \"newNwk\": false,\n    \"channelMask\": 20,\n    \"baudRate\": 115200,\n    \"log_level\": 2,\n    \"networkRefreshDuration\": 0,\n    \"panIdSelection\": \"randomInRange\",\n    \"panId\": 16,\n    \"platform\": \"\",\n    \"logLevel\": 2\n}",
           "encoding":"utf8"
        },
        {
           "name":"testconfig",
           "job":"testscript2",
           "files": [ {
              "url":"https://www.wigwag.io/configfiles/testconfig.dat",
              "dest_relative_path":"/config/testconfig.dat",
              "checksum": {
                "type":"sha256sum",
                "value":"09fba37a35ccc3b081a3e83d2c71fa9a767ebfeb45c69f08e17dfe3ef375a7b"
              },
              "size": 9101
           } ]
        }        
     ]
}
Notes
  • In the above example UPnP is disabled true This means maestro will have the job in it's database, but the job will be stopped. If this job is currently running, Maestro will stop the job.

Documentation

Index

Constants

View Source
const CHECKSUM_TYPE_MD5 = "md5sum"
View Source
const CHECKSUM_TYPE_SHA256 = "sha256sum"
View Source
const CONTAINER_DEVICEJS_PROCESS = "deviceJS_process"

special container names: deviceJS_process is a special container name for deviceJS scripts This is currently the only type of process supporting "compositeID" which allows multiple Jobs to be in the same OS process

View Source
const CONTAINER_DEVICEJS_PROCESS_NODE8 = "deviceJS_process_node8"

as above, but uses node 8.x instead of older node.js

View Source
const DEFAULT_CONFIG_NAME = "default"
View Source
const DEFAULT_STATS_INTERVAL = 300
View Source
const FLAG_RUNNING_CONFIG_FAIL_FAST = "failFast"

if set the maestro will stop anytime any of the config fails to install

View Source
const FLAG_RUNNING_CONFIG_REMOVE_IMAGES = "removeOldImages"

if listed in Flags, this will make maestro remove any images no longer in use

View Source
const IMAGE_TYPE_DEVICEJS_TARBALL = "devicejs_tarball"
View Source
const IMAGE_TYPE_DEVICEJS_ZIP = "devicejs_zip"
View Source
const IMAGE_TYPE_DOCKER = "docker"
View Source
const IMAGE_TYPE_TARBALL = "tarball"
View Source
const IMAGE_TYPE_ZIP = "zip"
View Source
const JOB_END_CONFIG_STRING = "ENDCONFIG"
View Source
const JOB_OK_STRING = "!!OK!!"
View Source
const MAX_QUEUED_PROCESS_EVENTS = 100
View Source
const MAX_TASK_LIFE = 60 * 60 * 24 * 7 // 1 week in seconds
View Source
const (
	// MaxRoutePriority is largest number which can be used for RoutePriority setting
	MaxRoutePriority = 9
)
View Source
const MinimalIntervalForPeriodic = 200

MinimalIntervalForPeriodic is the lowest acceptable interval (in milliseconds) for a function to periodically execute in a plugin

View Source
const NUMBER_BANKS_WEBLOG = uint32(20)
View Source
const OP_ADD = "add"
View Source
const OP_ADD_ADDRESS = "add_addr"

manipulate the IP v4/v6 address on an interface

View Source
const OP_FLAG_RESTART = "restart" // force a restart
View Source
const OP_INTERFACE_STATE_CHANGE = "interface_state_change"

take interface up / down

View Source
const OP_RELEASE_DHCP = "release_dhcp"

force the interface to release its DHCP address

View Source
const OP_REMOVE = "rm"
View Source
const OP_REMOVE_ADDRESS = "rm_addr"
View Source
const OP_RENEW_DHCP = "renew_dhcp"

OP_RENEW_DHCP ask the interface to renew its address (or get a new address if it already released)

View Source
const OP_RUNNING_CONFIG_UPDATE = "update"

the update OP will change the running config. Jobs not in the current running config, are stopped & removed Jobs in the new Running config are added & started.

View Source
const OP_TYPE_IMAGE = "image"
View Source
const OP_TYPE_JOB = "job"
View Source
const OP_TYPE_NET_CONFIG = "net_config"

something other than an interface change

View Source
const OP_TYPE_NET_INTERFACE = "net_interface"
View Source
const OP_UPDATE = "update"
View Source
const OP_UPDATE_ADDRESS = "update_addr"
View Source
const OP_UPDATE_CONFIG = "update_config"

change pf DNS, default GW, or other other

View Source
const TASK_COMPLETE = "complete"
View Source
const TASK_FAILED = "failed"
View Source
const TASK_QUEUED = "queued"
View Source
const TASK_RUNNING = "running"

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Stuff interface{}
}

API is the container providing access to various maestro APIs for plugin's to use

type APIError

type APIError struct {
	HttpStatusCode int
	ErrorString    string
	Detail         string
}

func (*APIError) Error

func (err *APIError) Error() string

func (*APIError) GetDetail

func (err *APIError) GetDetail() string

func (*APIError) GetErrorString

func (err *APIError) GetErrorString() string

func (*APIError) GetHttpStatusCode

func (err *APIError) GetHttpStatusCode() int

type AliasAddressV4

type AliasAddressV4 struct {
	// IPv4 Address
	IPv4Addr string `yaml:"ipv4_addr" json:"ipv4_addr"`
	// IPv4 Subnet Mask
	IPv4Mask string `yaml:"ipv4_mask" json:"ipv4_mask"`
	// IPv4 Broadcast Addr. If empty, set automatically
	IPv4BCast string `yaml:"ipv4_bcast" json:"ipv4_bcast"`
}

type BatchOpPayload

type BatchOpPayload struct {
	TaskId string            `json:"task_id"`
	Ops    []json.RawMessage `json:"ops"` // an array of Operation Payload JSON elements
}

func (*BatchOpPayload) GetOps

func (this *BatchOpPayload) GetOps() (ret []Operation, err error)

retrives all Operations as a single array of Operations Each Operation can be cast to it's appropriate Operation type Note: this can be an expensive op

func (*BatchOpPayload) GetTaskId

func (this *BatchOpPayload) GetTaskId() (id string)

type BatchOperation

type BatchOperation interface {
	GetOps() (ret []Operation, err error)
	GetTaskId() string
}

type CGroupSetup

type CGroupSetup interface {
	GetMemLimit() uint64
}

type CGroupSetupConfig

type CGroupSetupConfig struct {
	MemLimit uint64 `yaml:"mem_limit"`
}

implements processes/processTemplates.go:CGroupSetup

func (*CGroupSetupConfig) GetMemLimit

func (this *CGroupSetupConfig) GetMemLimit() uint64

type Checksum

type Checksum interface {
	GetType() string // CHECKSUM_TYPE_xxxx
	GetValue() string
}

type ChecksumObj

type ChecksumObj struct {
	Type  string `yaml:"type" json:"type"` // CHECKSUM_TYPE_xxxx
	Value string `yaml:"value" json:"value"`
}

func (*ChecksumObj) GetType

func (this *ChecksumObj) GetType() string

func (*ChecksumObj) GetValue

func (this *ChecksumObj) GetValue() string

type CommonHooks

type CommonHooks interface {
	// called when Maestro has started all services
	MaestroReady()

	// called at a periodic interval. Useful for doing something periodically
	// such as hitting a watchdog. 'counter' is continually incremented
	// See maestro/src/maestroConfig for details
	MaestroPeriodicOk(counter int)
}

type CommonParam

type CommonParam struct {
	Param interface{}
	Mut   sync.Mutex
}

CommonParam is a container for a plugin to hold whatever data they may want to be kept / passed between one or more PeriodicFunc routines. Only one periodic routing in a plugin will access this CommonParam at any time, and hence no periodic routines in a plugin will run in parallel. Note: this means any plugin with a periodic function which hangs, will hang the entire plugin's periodic functions

type ConfigAnalyzer

type ConfigAnalyzer struct {
	// contains filtered or unexported fields
}

func NewConfigAnalyzer

func NewConfigAnalyzer(configtag string) (ret *ConfigAnalyzer)

NewConfigAnalyzer returns a new, empty ConfigAnalyzer object which will operate off the struct tag of 'configtag'

func (*ConfigAnalyzer) AddHook

func (a *ConfigAnalyzer) AddHook(configgroup string, hook ConfigChangeHook)

AddHook associated a config group label with a ConfigChangeHook

func (*ConfigAnalyzer) CallChanges

func (a *ConfigAnalyzer) CallChanges(current interface{}, future interface{}) (identical bool, noaction bool, err error)

CallChanges does a comparison between current and future items. Current and future should be the same type and be a struct. This struct should use struct tags on specific fields, of the format: CONFIGTAG:"SOMEID" where CONFIGTAG is a specific label used throughout the whole struct, to identify a field which belongs to a config group of SOMEID, and referenced with a ConfigChangeHook type handed to ConfigAnalyzer by the AddHook function. The overall structs being compared may have multiple SOMEIDs but should always use the same CONFIGTAG value. The struct tags themselves may be combined with other key/values used for json or YAML encoding or anything else, space separated, which is compatible with the reflect.Lookup function (typical convention for multiple values in a struct tag) Given that this labeling via struct tags is done, then CallChanges will compare 'current' to 'future' by value, for each field in the struct. It will then, after a full comparison is done, call the ConfigChangeHook's methods. See ConfigChangeHook for how these methods are called.

NOTE: Technically current and future can have different types, but must have fields with the same names to be compared. The function will only look at field names which are in 'current' and which are public, and which have identical types.

func (*ConfigAnalyzer) DiffChanges

func (a *ConfigAnalyzer) DiffChanges(current interface{}, future interface{}) (identical bool, noaction bool, allchanges map[string]*changes, err error)

type ConfigChangeHook

type ConfigChangeHook interface {
	// ChangesStart is called before reporting any changes via multiple calls to SawChange. It will only be called
	// if there is at least one change to report
	ChangesStart(configgroup string)
	// SawChange is called whenever a field changes. It will be called only once for each field which is changed.
	// It will always be called after ChangesStart is called
	// If SawChange return true, then the value of futvalue will replace the value of current value
	// Index is valid if the value is >=0, in that case it indicates the index of the item in a slice
	SawChange(configgroup string, fieldchanged string, futvalue interface{}, curvalue interface{}, index int) (acceptchange bool)
	// ChangesComplete is called when all changes for a specific configgroup tagname
	// If ChangesComplete returns true, then all changes in that group will be assigned to the current struct
	ChangesComplete(configgroup string) (acceptallchanges bool)
}

ConfigChangeHook should be implemented if change should happen for a given config struct. A single ConfigChangeHook instance is assigned to a config group. For clarity, the order of execution for the ConfigChangeHook interface is: [Analysis Run] --> No changes (no action)

||
||  See one or more changes
\/

(once) ChangesStart() [ called only once, for a given analysis ]

||
||
\/

(one or more calls) SawChange() [ called once for every field which changed ]

||
||
\/

(once) ChangesComplete() [ called once ]

type ConfigDefinition

type ConfigDefinition interface {
	// A unique identifier for this config
	// The name must be unique across all other configs, for this 'Job name'
	GetConfigName() string

	// The Job this Config is associated with
	GetJobName() string
	// For simple and smaller configs, a string may just be provided. This will be
	// store in the Maestro DB
	GetData() (data string, encoding string)
	// For configs which require their own data files, etc, arbitrary files may be
	// downloaded.
	GetFiles() []ConfigFileData
	// Last time/date modified, in ISO 8601 format
	// see RFC https://www.ietf.org/rfc/rfc3339.txt
	GetModTime() string

	// Duplicates a new copy of the config in memory
	Dup() ConfigDefinition
}

type ConfigDefinitionPayload

type ConfigDefinitionPayload struct {
	Name string `yaml:"name" json:"name"` // the identifier for this config
	Job  string `yaml:"job" json:"job"`   // the job this image is associated with
	Data string `yaml:"data" json:"data"`
	// the encoding type. Only 'base64' and 'utf8' are supported.
	// an empty or missing value is assumed to be utf8
	Encoding string                  `yaml:"encoding" json:"encoding"`
	Files    []ConfigFileDataPayload `yaml:"files" json:"files"`
	ModTime  string                  `yaml:"mod_time" json:"mod_time"`
}

func (*ConfigDefinitionPayload) Dup

func (*ConfigDefinitionPayload) GetConfigName

func (this *ConfigDefinitionPayload) GetConfigName() string

func (*ConfigDefinitionPayload) GetData

func (this *ConfigDefinitionPayload) GetData() (data string, encoding string)

func (*ConfigDefinitionPayload) GetFiles

func (this *ConfigDefinitionPayload) GetFiles() []ConfigFileData

func (*ConfigDefinitionPayload) GetJobName

func (this *ConfigDefinitionPayload) GetJobName() string

func (*ConfigDefinitionPayload) GetModTime

func (this *ConfigDefinitionPayload) GetModTime() string

type ConfigFileData

type ConfigFileData interface {
	GetURL() string
	GetChecksum() Checksum
	GetRelativePath() string
	GetSize() uint64
}

type ConfigFileDataPayload

type ConfigFileDataPayload struct {
	URL          string      `yaml:"url" json:"url"`
	RelativePath string      `yaml:"dest_relative_path" json:"dest_relative_path"`
	Size         uint64      `yaml:"size" json:"size"`
	Checksum     ChecksumObj `yaml:"checksum" json:"checksum"`
}

func (*ConfigFileDataPayload) GetChecksum

func (this *ConfigFileDataPayload) GetChecksum() Checksum

func (*ConfigFileDataPayload) GetRelativePath

func (this *ConfigFileDataPayload) GetRelativePath() string

func (*ConfigFileDataPayload) GetSize

func (this *ConfigFileDataPayload) GetSize() uint64

func (*ConfigFileDataPayload) GetURL

func (this *ConfigFileDataPayload) GetURL() string

type ContainerTemplOperation

type ContainerTemplOperation interface {
	GetOp() string
	GetParams() []string
	GetTemplate() *ContainerTemplate
}

type ContainerTemplate

type ContainerTemplate interface {
	GetName() string
	GetCGroupSetup() CGroupSetup
	GetExecCmd() string
	GetEnv() []string
	GetPreArgs() []string
	GetPostArgs() []string
	GetDependsOn() []string
	IsInheritEnv() bool
	// The process sends the magic maestro OK string on startup
	// In this case, maestro will wait for this string before setting
	// the job state to RUNNING
	// After this string it will redirect log output
	UsesOkString() bool
	GetDeferRunningStatus() uint32
	// Maestro will attempt to make the child process die
	// if Maestro itself dies. This is not always possible, and may not work
	// on non Linux systems
	IsDieOnParentDeath() bool
	// if true, then all Job data for which shares the same 'composite ID', which uses this
	// container type, will be sent to the started process via stdin
	// The data will be encoded as a JSON object of the format:
	// { "jobs" : [
	//      { JOB_CONFIG }
	//      ...
	//   ]
	// }
	// Where JOB_CONFIG the JSON encoded version of the job configuration which has that
	// composite ID
	IsSendCompositeJobsToStdin() bool
	// make a GREASE_ORIGIN_ID env var, and then when execvpe the new process, attach this env var
	// which will have the generated origin ID for the process. Useful for deviceJS
	IsSendGreaseOriginIdEnv() bool
	// If this container is used as a template for a composite process
	// then this string is sent as the 'process_config' value in the JSON object
	// (composite process config) which is sent via stdout
	GetCompositeConfig() string
	// Returns true if the template definiton can be modified
	// defaults to true if never set
	IsMutable() bool
}

type ContainerTemplatePayload

type ContainerTemplatePayload struct {
	Name   string             `yaml:"name"`
	CGroup *CGroupSetupConfig `yaml:"cgroup" json:"cgroup"`

	// if true, the image will be ran chroot-ed, wherever it is installed
	ChrootImage bool
	// applies only for job's without images. Provides a path for the process should be chroot()
	ChrootPath string `yaml:"chroot_path" json:"chroot_path"`

	InheritEnv   bool     `yaml:"inherit_env" json:"inherit_env"`
	AddEnv       []string `yaml:"add_env" json:"add_env"`
	ExecCmd      string   `yaml:"exec_cmd" json:"exec_cmd"`
	ExecPreArgs  []string `yaml:"exec_pre_args" json:"exec_pre_args"`
	ExecPostArgs []string `yaml:"exec_post_args" json:"exec_post_args"`

	DependsOn []string `yaml:"depends_on" json:"depends_on"`

	Restart                 bool   `yaml:"restart" json:"restart"`
	RestartOnDependencyFail bool   `yaml:"restart_on_dependency_fail" json:"restart_on_dependency_fail"`
	RestartLimit            uint32 `yaml:"restart_limit" json:"restart_limit"`
	RestartPause            uint32 `yaml:"restart_pause" json:"restart_pause"`
	DieOnParentDeath        bool   `yaml:"die_on_parent_death" json:"die_on_parent_death"`
	// if set to true, then all Job data for which shares the same 'composite ID', which uses this
	// container type, will be sent to the started process via stdin
	// The data will be encoded as a JSON object of the format:
	// { "jobs" : [
	//      { JOB_CONFIG }
	//      ...
	//   ]
	// }
	// Where JOB_CONFIG the JSON encoded version of the job configuration which has that
	// composite ID
	SendCompositeJobsToStdin bool `yaml:"send_composite_jobs_to_stdin" json:"send_composite_jobs_to_stdin"`
	// If this container is used as a template for a composite process
	// then this string is sent as the 'process_config' value in the JSON object
	// (composite process config) which is sent via stdout
	CompositeConfig string `yaml:"composite_config" json:"composite_config"`
	// make a GREASE_ORIGIN_ID env var, and then when execvpe the new process, attach this env var
	// which will have the generated origin ID for the process. Useful for deviceJS
	SendGreaseOriginIdEnv bool `yaml:"send_grease_origin_id" json:"send_grease_origin_id"`
	// this is a maestro thing. It will wait for the process to send back
	// a string of "!!OK!!" on STDOUT - until this is sent back, the process is marked
	// as "STARTING" but not "RUNNING" and it's STDOUT is not sent into the logger
	OkString bool `yaml:"uses_ok_string" json:"uses_ok_string"`
	// Defers the RUNNING status change on a Job for N milliseconds
	// This is not compatible with the uses_ok_string option above.
	// This is designed to ask Maestro to wait for a processes to fully start
	// before trying to start another Job who's dependcies are waiting
	// on this process
	DeferRunningStatus uint32 `yaml:"defer_running_status" json:"defer_running_status"`
	// if set, then if the OK message is not recieved in X ms, the job will be concedered failed
	// and the process will be killed
	TimeoutForOk uint32 `yaml:"timeout_for_ok" json:"timeout_for_ok"`
	// true if the definition can not be modified
	// Note: In the config file, this should be set to true, if you wish Maestro to
	// not save settings in the config file to the maestro database.
	Immutable bool `yaml:"immutable" json:"immutable"`
}

implements processes/processTemplates.go:ContainerTemplate

func (*ContainerTemplatePayload) GetCGroupSetup

func (this *ContainerTemplatePayload) GetCGroupSetup() CGroupSetup

func (*ContainerTemplatePayload) GetCompositeConfig

func (this *ContainerTemplatePayload) GetCompositeConfig() string

func (*ContainerTemplatePayload) GetDeferRunningStatus

func (this *ContainerTemplatePayload) GetDeferRunningStatus() uint32

func (*ContainerTemplatePayload) GetDependsOn

func (this *ContainerTemplatePayload) GetDependsOn() []string

func (*ContainerTemplatePayload) GetEnv

func (this *ContainerTemplatePayload) GetEnv() []string

func (*ContainerTemplatePayload) GetExecCmd

func (this *ContainerTemplatePayload) GetExecCmd() string

func (*ContainerTemplatePayload) GetName

func (this *ContainerTemplatePayload) GetName() string

func (*ContainerTemplatePayload) GetPostArgs

func (this *ContainerTemplatePayload) GetPostArgs() []string

func (*ContainerTemplatePayload) GetPreArgs

func (this *ContainerTemplatePayload) GetPreArgs() []string

func (*ContainerTemplatePayload) IsDieOnParentDeath

func (this *ContainerTemplatePayload) IsDieOnParentDeath() bool

func (*ContainerTemplatePayload) IsInheritEnv

func (this *ContainerTemplatePayload) IsInheritEnv() bool

func (*ContainerTemplatePayload) IsMutable

func (this *ContainerTemplatePayload) IsMutable() bool

func (*ContainerTemplatePayload) IsSendCompositeJobsToStdin

func (this *ContainerTemplatePayload) IsSendCompositeJobsToStdin() bool

func (*ContainerTemplatePayload) IsSendGreaseOriginIdEnv

func (this *ContainerTemplatePayload) IsSendGreaseOriginIdEnv() bool

func (*ContainerTemplatePayload) UsesOkString

func (this *ContainerTemplatePayload) UsesOkString() bool

type Error

type Error interface {
	GetHttpStatusCode() int
	GetErrorString() string
	GetDetail() string
}

type GeneratePlatformDeviceKeyNCert

type GeneratePlatformDeviceKeyNCert func(dict *templates.TemplateVarDictionary, deviceid string, accountid string, log Logger) (key string, cert string, err error)

GeneratePlatformDeviceKeyNCert generates key and cert for the platform

type GetPlatformVars

type GetPlatformVars func(dict *templates.TemplateVarDictionary, log Logger) (err error)

GetPlatformVars shold be implemented by any platform reader plugin

type Hook

type Hook interface {
	// Impl. should setup the given hook library, returning an err (error) if
	// the setup failed to complete. A nil err indicates the Hook installed correctly.
	// The id string whould be instance unique to Maestro
	// The library should use log Logger to output any info or errors
	MaestroInitHook(log Logger) (err error, id string)

	// called when maestro shuts down
	// The signal type for shutdown is passed, or zero if none.
	MaestroStopHook(sig int)
}

For any Hook library to work, this interface must be implemented:

type IEEE8021x

type IEEE8021x struct {
}

type ImageDefinition

type ImageDefinition interface {
	GetJobName() string
	GetURL() string
	GetVersion() string
	GetSize() uint64
	GetChecksum() Checksum
	GetImageType() string // IMAGE_TYPE_xxxxx
	ComputeSignature() string
}

type ImageDefinitionPayload

type ImageDefinitionPayload struct {
	Job       string       `yaml:"job" json:"job"` // the job this image is associated with
	Version   string       `yaml:"version" json:"version"`
	URL       string       `yaml:"url" json:"url"`
	Size      uint64       `yaml:"size" json:"size"`
	Checksum  *ChecksumObj `yaml:"checksum" json:"checksum"`
	ImageType string       `yaml:"image_type" json:"image_type"` // IMAGE_TYPE_xxxxx
}

func (*ImageDefinitionPayload) ComputeSignature

func (this *ImageDefinitionPayload) ComputeSignature() string

Computed a signature of the operation based on specific fields. To deal with an API call which does the same thing multiple times

func (*ImageDefinitionPayload) GetChecksum

func (this *ImageDefinitionPayload) GetChecksum() Checksum

func (*ImageDefinitionPayload) GetImageType

func (this *ImageDefinitionPayload) GetImageType() string

func (*ImageDefinitionPayload) GetJobName

func (this *ImageDefinitionPayload) GetJobName() string

func (*ImageDefinitionPayload) GetSize

func (this *ImageDefinitionPayload) GetSize() uint64

func (*ImageDefinitionPayload) GetURL

func (this *ImageDefinitionPayload) GetURL() string

func (*ImageDefinitionPayload) GetVersion

func (this *ImageDefinitionPayload) GetVersion() string

type ImageOpPayload

type ImageOpPayload struct {
	Type    string `yaml:"type" json:"type"` // should always be 'job'
	Op      string `yaml:"op" json:"op"`
	AppName string `yaml:"app_name" json:"app_name"` // not always needed, especially with those stated in
	Version string `yaml:"app_name" json:"app_name"` // config file
	Flags   []string
	Image   *ImageDefinitionPayload `yaml:"image" json:"image"`
	Params  []string                `yaml:"params" json:"params"`
	TaskId  string                  `yaml:"task_id" json:"task_id"`
}

func NewImageOpPayload

func NewImageOpPayload() *ImageOpPayload

func (*ImageOpPayload) GetAppName

func (this *ImageOpPayload) GetAppName() string

func (*ImageOpPayload) GetFlags

func (this *ImageOpPayload) GetFlags() []string

func (*ImageOpPayload) GetImageDefinition

func (this *ImageOpPayload) GetImageDefinition() ImageDefinition

func (*ImageOpPayload) GetOp

func (this *ImageOpPayload) GetOp() string

func (*ImageOpPayload) GetParams

func (this *ImageOpPayload) GetParams() []string

func (*ImageOpPayload) GetTaskId

func (this *ImageOpPayload) GetTaskId() string

func (*ImageOpPayload) GetType

func (this *ImageOpPayload) GetType() string

func (*ImageOpPayload) GetVersion

func (this *ImageOpPayload) GetVersion() string

type ImageOperation

type ImageOperation interface {
	GetType() string // operation type
	GetOp() string
	GetParams() []string
	GetTaskId() string
	GetImageDefinition() ImageDefinition
	GetAppName() string
	GetVersion() string
}

type InitMaestroPluginFunc

type InitMaestroPluginFunc func(opts *PluginOpts, api *API, log Logger) error

InitMaestroPluginFunc is the type of InitMaestroPlugin() which is called anytime a plugin is loaded by maestro

type JobDefinition

type JobDefinition interface {
	GetJobName() string

	// If len > 0, then this Job can be placed in a composite process
	// identified by this string
	// So, if multiple Jobs can be in the same process, then each Job must share
	// this same value AND each Job must also use the same Container Template string
	GetCompositeId() string

	// get the template to use, if this is nil, then use the commands from
	// getExecCmd() / getArgs()
	GetContainerTemplate() string

	// the Config data and/or files to be used for this Job
	// this config, should match up with a defined Config object
	// for this Job name
	GetConfigName() string
	// this returns the config string which may have been provided with the
	// Job. This is not necessarily the current config or the one which
	// should be provided to the Job on startup
	GetStaticConfig() string
	// Maestro will attempt to make the child process die
	// if Maestro itself dies. This is not always possible, and may not work
	// on non Linux systems
	IsDieOnParentDeath() bool

	// a string to be sent via stdin on process startup
	GetMessageForProcess() string
	UsesOkString() bool
	GetDeferRunningStatus() uint32
	// the command to run. If the
	GetExecCmd() string
	GetArgs() []string
	GetEnv() []string
	GetPgid() int // a value of zero indicate create a new PGID
	IsInheritEnv() bool
	IsDaemonize() bool
	GetDependsOn() []string
	IsAutostart() bool
	GetRestartOnDependencyFail() bool
	IsRestart() bool
	GetRestartLimit() uint32
	GetRestartPause() uint32
	// Returns true if the job definiton can be modified
	// defaults to true if never set
	IsMutable() bool
}

type JobDefinitionPayload

type JobDefinitionPayload struct {
	Job               string `yaml:"job" json:"job"`
	CompositeId       string `yaml:"composite_id" json:"composite_id"`
	ContainerTemplate string `yaml:"container_template" json:"container_template"`
	// The configuration for this Job
	// If the Config has the Data field set up, it will be sent this config on stdin
	// once its process has started
	// If the Job is part of a 'composite process', it's config will be sent as part of an
	// array of strings, with the array and string encoded in JSON
	// The Config's "name" is "default" unless config_name is stated
	Config string `yaml:"config" json:"config"`
	// The name of the config. If config_name is not provided, it will be
	// the string "default"
	ConfigName string `yaml:"config_name" json:"config_name"`
	// Sent to the process on stdout after any 'data' config
	Message string `yaml:"message" json:"message"`
	// this is a maestro thing. It will wait for the process to send back
	// a string of "!!OK!!" on STDOUT - until this is sent back, the process is marked
	// as "STARTING" but not "RUNNING" and it's STDOUT is not sent into the logger
	WaitForOk bool `yaml:"wait_for_ok" json:"wait_for_ok"`
	// Defers the RUNNING status change on a Job for N milliseconds
	// This is not compatible with the wait_for_ok option above.
	// This is designed to ask Maestro to wait for a processes to fully start
	// before trying to start another Job who's dependcies are waiting
	// on this process
	DeferRunningStatus uint32 `yaml:"defer_running_status" json:"defer_running_status"`
	// if a Job is defined it will automatically start. Set this to
	// true to prevent a Job from starting automatically
	NoAutoStart             bool     `yaml:"no_autostart" json:"no_autostart"`
	Restart                 bool     `yaml:"restart" json:"restart"`
	RestartOnDependencyFail bool     `yaml:"restart_on_dependency_fail" json:"restart_on_dependency_fail"`
	RestartLimit            uint32   `yaml:"restart_limit" json:"restart_limit"`
	RestartPause            uint32   `yaml:"restart_pause" json:"restart_pause"`
	DependsOn               []string `yaml:"depends_on" json:"depends_on"`
	ExecCmd                 string   `yaml:"exec_cmd" json:"exec_cmd"`
	ExecArgs                []string `yaml:"exec_args" json:"exec_args"`
	Pgid                    int      `yaml:"pgid" json:"pgid"`
	Env                     []string `yaml:"env" json:"env"`
	InheritEnv              bool     `yaml:"inherit_env" json:"inherit_env"`
	DieOnParentDeath        bool     `yaml:"die_on_parent_death" json:"die_on_parent_death"`
	Daemonize               bool     `yaml:"daemonize" json:"daemonize"` // create a new SID for this process ?
	// true if the definition can not be modified
	// Note: In the config file, this should be set to true, if you wish Maestro to
	// not save settings in the config file to the maestro database.
	Immutable bool `yaml:"immutable" json:"immutable"`
}

implements processes/processTemplates.go:JobDefinition

func (*JobDefinitionPayload) GetArgs

func (this *JobDefinitionPayload) GetArgs() []string

func (*JobDefinitionPayload) GetCompositeId

func (this *JobDefinitionPayload) GetCompositeId() string

func (*JobDefinitionPayload) GetConfigName

func (this *JobDefinitionPayload) GetConfigName() string

func (*JobDefinitionPayload) GetContainerTemplate

func (this *JobDefinitionPayload) GetContainerTemplate() string

func (*JobDefinitionPayload) GetDeferRunningStatus

func (this *JobDefinitionPayload) GetDeferRunningStatus() uint32

func (*JobDefinitionPayload) GetDependsOn

func (this *JobDefinitionPayload) GetDependsOn() []string

func (*JobDefinitionPayload) GetEnv

func (this *JobDefinitionPayload) GetEnv() []string

func (*JobDefinitionPayload) GetExecCmd

func (this *JobDefinitionPayload) GetExecCmd() string

func (*JobDefinitionPayload) GetJobName

func (this *JobDefinitionPayload) GetJobName() string

func (*JobDefinitionPayload) GetMessageForProcess

func (this *JobDefinitionPayload) GetMessageForProcess() string

func (*JobDefinitionPayload) GetPgid

func (this *JobDefinitionPayload) GetPgid() int

func (*JobDefinitionPayload) GetRestartLimit

func (this *JobDefinitionPayload) GetRestartLimit() uint32

func (*JobDefinitionPayload) GetRestartOnDependencyFail

func (this *JobDefinitionPayload) GetRestartOnDependencyFail() bool

func (*JobDefinitionPayload) GetRestartPause

func (this *JobDefinitionPayload) GetRestartPause() uint32

func (*JobDefinitionPayload) GetStaticConfig

func (this *JobDefinitionPayload) GetStaticConfig() string

func (*JobDefinitionPayload) IsAutostart

func (this *JobDefinitionPayload) IsAutostart() bool

func (*JobDefinitionPayload) IsDaemonize

func (this *JobDefinitionPayload) IsDaemonize() bool

func (*JobDefinitionPayload) IsDieOnParentDeath

func (this *JobDefinitionPayload) IsDieOnParentDeath() bool

func (*JobDefinitionPayload) IsInheritEnv

func (this *JobDefinitionPayload) IsInheritEnv() bool

func (*JobDefinitionPayload) IsMutable

func (this *JobDefinitionPayload) IsMutable() bool

func (*JobDefinitionPayload) IsRestart

func (this *JobDefinitionPayload) IsRestart() bool

func (*JobDefinitionPayload) UsesOkString

func (this *JobDefinitionPayload) UsesOkString() bool

type JobHooks

type JobHooks interface {
	MaestroJobStarted(name string)

	MaestroJobStopped(name string)

	MaestroJobFailed(name string)

	// called if a Job's max restarts are reached, or other reason
	// the Job can no longer ever be restarted
	MaestroJobTotalFailure(name string)
}

type JobOpPayload

type JobOpPayload struct {
	Type   string `yaml:"type" json:"type"` // should always be 'job'
	Op     string `yaml:"op" json:"op"`
	Flags  []string
	Job    *JobDefinitionPayload `yaml:"job" json:"job"`
	Params []string              `yaml:"params" json:"params"`
	TaskId string                `yaml:"task_id" json:"task_id"`
}

func NewJobOpPayload

func NewJobOpPayload() *JobOpPayload

func (*JobOpPayload) GetFlags

func (this *JobOpPayload) GetFlags() []string

func (*JobOpPayload) GetJobPayload

func (this *JobOpPayload) GetJobPayload() JobDefinition

func (*JobOpPayload) GetOp

func (this *JobOpPayload) GetOp() string

func (*JobOpPayload) GetParams

func (this *JobOpPayload) GetParams() []string

func (*JobOpPayload) GetTaskId

func (this *JobOpPayload) GetTaskId() string

func (*JobOpPayload) GetType

func (this *JobOpPayload) GetType() string

type JobOperation

type JobOperation interface {
	GetType() string // operation type
	GetOp() string
	GetFlags() []string
	GetParams() []string
	GetJobPayload() JobDefinition
	GetTaskId() string
}

type Logger

type Logger interface {
	Info(a ...interface{})
	Infof(format string, a ...interface{})
	Success(a ...interface{})
	Successf(format string, a ...interface{})
	Warn(a ...interface{})
	Warnf(format string, a ...interface{})
	Error(a ...interface{})
	Errorf(format string, a ...interface{})
	Debug(a ...interface{})
	Debugf(format string, a ...interface{})
}

A Logger interface is passed to some Maestro plugins, allowing the plugin to Log to Maestro's internal logs, as part of the Maestro process.

type NetConfigOpPayload

type NetConfigOpPayload struct {
	Type      string                `yaml:"type" json:"type"` // should always be 'job'
	Op        string                `yaml:"op" json:"op"`
	Params    []string              `yaml:"params" json:"params"`
	TaskId    string                `yaml:"task_id" json:"task_id"`
	NetConfig *NetworkConfigPayload `yaml:"ifconfig" json:"ifconfig"`
}

func NewNetConfigOpPayload

func NewNetConfigOpPayload() *NetConfigOpPayload

func (*NetConfigOpPayload) GetNetConfig

func (this *NetConfigOpPayload) GetNetConfig() *NetworkConfigPayload

func (*NetConfigOpPayload) GetOp

func (this *NetConfigOpPayload) GetOp() string

func (*NetConfigOpPayload) GetParams

func (this *NetConfigOpPayload) GetParams() []string

func (*NetConfigOpPayload) GetTaskId

func (this *NetConfigOpPayload) GetTaskId() string

func (*NetConfigOpPayload) GetType

func (this *NetConfigOpPayload) GetType() string

type NetConfigOperation

type NetConfigOperation interface {
	GetType() string // operation type
	GetOp() string
	GetParams() []string
	GetTaskId() string

	GetNetConfig() *NetworkConfigPayload
}

NetInterfaceOperation is a "Operation"

type NetIfConfigPayload

type NetIfConfigPayload struct {
	// Type of connection.  e.g. wifi or lte
	Type string `yaml:"type" json:"type" netgroup:"if"`
	// like "eth0"
	IfName string `yaml:"if_name" json:"if_name" netgroup:"if"`
	// use either this or IfName, index is a non-zero positive integer
	// IfName is preferred and takes precedence
	IfIndex int `yaml:"if_index" json:"if_index" netgroup:"if"`
	// use DHCP?
	DhcpV4Enabled bool `yaml:"dhcpv4" json:"dhcpv4" netgroup:"ipv4"`
	// IPv4 Address
	IPv4Addr string `yaml:"ipv4_addr" json:"ipv4_addr" netgroup:"ipv4"`
	// IPv4 Subnet Mask  - of the CIDR form, such as in 192.168.1.21/24
	// then this number would be 24
	IPv4Mask int `yaml:"ipv4_mask" json:"ipv4_mask" netgroup:"ipv4"`
	// IPv4 Broadcast Addr. If empty, set automatically
	IPv4BCast string `yaml:"ipv4_bcast" json:"ipv4_bcast" netgroup:"ipv4"`
	// additional addresses to assign to the interface, if any
	AliasAddrV4 []AliasAddressV4 `yaml:"alias_ipv4" json:"alias_ipv4" netgroup:"ipv4"`
	// IPv6 Address
	IPv6Addr string `yaml:"ipv6_addr" json:"ipv6_addr"  netgroup:"ipv6"`

	// HwAddr is a MAC address or similar address
	// MAC addresses should be formatted "aa:bb:cc:01:23:45" etc.
	// 48 or 64 bit addresses can be stated, or whatever may be supported by the hardware
	// such as a 20-octet IP for InifiniBand
	HwAddr string `yaml:"hw_addr" json:"hw_addr" netgroup:"mac"`

	//SSID of the wifi network
	WifiSsid string `yaml:"wifi_ssid" json:"wifi_ssid" netgroup:"wifi"`
	//Wifi password
	WifiPassword string `yaml:"wifi_password" json:"wifi_password" netgroup:"wifi"`

	// Modem serial device.  It is possible to use "*" to refer to any available modem.
	SerialDevice string `yaml:"serial" json:"serial"`
	// APN
	AccessPointName string `yaml:"apn" json:"apn"`

	// IEEE8021x is the IEEE 802.1x auth settings
	IEEE8021x *IEEE8021x `yaml:"ieee8021x" json:"ieee8021x" netgroup:"IEEE8021x"`

	// These typically optional:
	// if not empty, this address will be deleted before setting the new address
	ReplaceAddress string `yaml:"replace_addr" json:"replace_addr" netgroup:"mac"`
	// if true, this will clear any existing addresses assigned to the interface
	// before setting up the specified addresses
	ClearAddresses bool `yaml:"clear_addresses" json:"clear_addresses" netgroup:"mac"`
	// if true, the interface should be configured, be turned off / disabled (rare)
	Down bool `yaml:"down" json:"down" group:"mac"`

	// DefaultGateway is a default route associated with this interface, which should be set if this
	// interface is up. If empty, none will be setup - unless DHCP provides one. If one is provided
	// here it will override the DHCP provided one. The Priority field
	// should help determine which route has the best metric, which will allow the kernel
	// to use the fastest route.
	DefaultGateway string `yaml:"default_gateway" json:"default_gateway"  netgroup:"gateway"`

	// NOT IMPLEMENTED
	FallbackDefaultGateway string `yaml:"fallback_default_gateway" json:"fallback_default_gateway" netgroup:"gateway"`

	// RoutePriority. Priority 0 - means the first, primary interface, 1 would mean
	// the secondary, etc. Priority is used to decide which physical interface should
	// be the default route, if such interface has a default GW
	// valid values: 0-9 (MaxRoutePriority)
	RoutePriority int `yaml:"route_priority" json:"route_priority" netgroup:"route"`

	// An Aux interface, is not considered in the line up of outbound interfaces
	// It usually routes to an internal only network
	Aux bool `yaml:"aux" json:"aux"  netgroup:"mac"`

	// NOT IMPLEMENTED
	// Override DNS
	// Use only on a secondary, backup interface. If the interface becomes active
	// then DNS should switch to this server.
	NameserverOverrides string `yaml:"nameserver_overrides" json:"nameserver_overrides" netgroup:"nameserver"`

	// NOT IMPLEMENTED
	// routes this interfaces provides
	Routes []string `yaml:"routes" json:"routes" netgroup:"route"`

	// NOT IMPLEMENTED
	// A https test server to use for this interface, to make sure
	// the interface has a route out. If empty, ignored
	TestHttpsRouteOut string `yaml:"test_https_route_out" json:"test_https_route_out" netgroup:"http"`

	// NOT IMPLEMENTED
	// A host to ICMPv4 echo, to test that this interface has
	// a route to where it should. If empty, ignored
	TestICMPv4EchoOut string `yaml:"test_echo_route_out" json:"test_echo_route_out" netgroup:"ipv4"`

	// Normally DHCP services will clear all addresses
	// on the given interface before setting the interface address
	// provided by the DHCP server. This disables that behavior,
	// meaning existing addresses will remain on the interface - if they were there
	// before Maestro started.
	DhcpDisableClearAddresses bool `yaml:"dhcp_disable_clear_addresses" json:"dhcp_disable_clear_addresses" netgroup:"dhcp"`

	// DhcpStepTimeout is the maximum amount of seconds to wait in each step
	// of getting a DHCP address. If not set, a sane default will be used.
	DhcpStepTimeout int `yaml:"dhcp_step_timeout" json:"dhcp_step_timeout"  netgroup:"dhcp"`

	// For use typically in the config file, not required. For incoming API calls,
	// the default behavior is "override", b/c the API calls always modify the
	// interface's database entry.
	// existing: "override"  # this will replace any data already set in the database
	// existing: ""          # this is the default. The database will take precedence, if it has an entry for the interface
	// existing: "replace"   # this will remove the existing datavase entry entirely. And then take whatever
	//                       # the config file has to offer
	Existing string `yaml:"existing" json:"existing" netgroup:"config_netif"`
}

type NetInterfaceOpPayload

type NetInterfaceOpPayload struct {
	Type   string   `yaml:"type" json:"type"` // should always be 'job'
	Op     string   `yaml:"op" json:"op"`
	Params []string `yaml:"params" json:"params"`
	TaskId string   `yaml:"task_id" json:"task_id"`

	IfConfig *NetIfConfigPayload `yaml:"ifconfig" json:"ifconfig"`
}

func NewNetInterfaceOpPayload

func NewNetInterfaceOpPayload() *NetInterfaceOpPayload

func (*NetInterfaceOpPayload) GetIfConfig

func (this *NetInterfaceOpPayload) GetIfConfig() *NetIfConfigPayload

func (*NetInterfaceOpPayload) GetOp

func (this *NetInterfaceOpPayload) GetOp() string

func (*NetInterfaceOpPayload) GetParams

func (this *NetInterfaceOpPayload) GetParams() []string

func (*NetInterfaceOpPayload) GetTaskId

func (this *NetInterfaceOpPayload) GetTaskId() string

func (*NetInterfaceOpPayload) GetType

func (this *NetInterfaceOpPayload) GetType() string

type NetInterfaceOperation

type NetInterfaceOperation interface {
	GetType() string // operation type
	GetOp() string
	GetParams() []string
	GetTaskId() string

	GetIfConfig() *NetIfConfigPayload
}

NetInterfaceOperation is a "Operation"

type NetworkConfigPayload

type NetworkConfigPayload struct {
	// If the flag is "disable : false" then maestro will do networking.  If the flag is "disable : true" then maestro will not do networking.
	Disable bool `yaml:"disable" json:"disable" netgroup:"config_network"`

	// an array of network interfaces to configure
	Interfaces []*NetIfConfigPayload `yaml:"interfaces" json:"interfaces" netgroup:"if"`

	// DontSetDefaultRoute when true means maestro will not
	// add/replace/delete the default route in the system routing table, if one exists, with a setting from the interface
	// whether via DHCP or static (DefaultGateway field). In case, a default route is not set for the system and this flag is true,
	// the default route must be set manually or by Network Manager.
	DontSetDefaultRoute bool `yaml:"dont_set_default_route" json:"dont_set_default_route" netgroup:"route"`

	Nameservers []string `yaml:"nameservers" json:"nameservers" netgroup:"nameserver"`

	// this tells network subsystem to ignore DHCP offers which have
	// DNS server settings. Whatever the DHCP server says in regards to
	// DNS will be ignored
	DnsIgnoreDhcp bool `yaml:"dns_ignore_dhcp" json:"dns_ignore_dhcp" netgroup:"dns"`

	// AltResolvConf, if populated with a string, will cause the network subsystem to
	// not write /etc/resolv.conf, and instead write what would go to /etc/resolv.conf to
	// an alternate file.
	AltResolvConf string `yaml:"alt_resolv_conf" json:"alt_resolve_conf" netgroup:"nameserver"`

	// DnsRunLocalCaching if true, a local caching nameserver will be used.
	DnsRunLocalCaching bool `yaml:"dns_local_caching" json:"dns_local_caching" netgroup:"dns"`

	// True if the gateway should forward all DNS requests to a
	// specific gateway only
	DnsForwardTo string `yaml:"default_gateway" json:"default_gateway" netgroup:"dns"`

	// True if you want the gateway to do lookup via DNS root servers
	// i.e. the gateway runs it's own recursive, lookup name server
	DnsRunRootLookup bool `yaml:"dns_root_lookup" json:"dns_root_lookup" netgroup:"dns"`

	// A string, which is what the content of the /etc/hosts file should
	// be
	DnsHostsData string `yaml:"dns_hosts_data" json:"dns_hosts_data" netgroup:"dns"`

	// Fallback Gateways. (NOT IMPLEMENTED)
	// These will be enabled if a primary outbound interface fails,
	// and a secondary outbound interface exists
	FallbackNameservers string `yaml:"fallback_nameservers" json:"fallback_nameservers" netgroup:"nameserver"`

	// For use typically in the config file, not required. For incoming API calls,
	// the default behavior is "override", b/c the API calls always modify the
	// interface's database entry.
	// existing: "override"  # this will replace any data already set in the database
	// existing: ""          # this is the default. The database will take precedence, if it has an entry for the interface
	// existing: "replace"   # this will remove the existing database entry entirely. And then take whatever
	//                       # the config file has to offer
	Existing string `yaml:"existing" json:"existing" netgroup:"config_network"`
}

type NetworkHooks

type NetworkHooks interface {

	// called if the default route is setup (typicall meaning the network or Internet is reachable)
	// and DNS is setup with at least a single resolver.
	MaestroNetworkReady()

	// called when Maestro has positive connectivity to it's management server
	MaestroCloudManagerReady()

	// called whent the conditions of MaestroNetworkReady or no longer true
	MaestroNetworkDown()

	// called when an Interface is setup
	MaestroInterfaceSetup(name string, ifindex int)

	// called when an interface is shutdown
	MaestroInterfaceShutdown(name string, ifindex int)
}

type Operation

type Operation interface {
	GetType() string // operation type
	GetOp() string
	GetParams() []string
	GetTaskId() string
}

type PeriodicFunc

type PeriodicFunc func(num int, param *CommonParam) (contin bool, err error)

PeriodicFunc is the call spec for any function maestro should call periodically. contin should return true if the periodic function should continue to be called error returns when an error occurs in the PeriodicFunc but does not stop the function from continuing to be called if not nil

type PlatformKeyWriter

type PlatformKeyWriter interface {
	WritePlatformDeviceKeyNCert(dict *templates.TemplateVarDictionary, key string, cert string, log Logger) (err error)
	GeneratePlatformDeviceKeyNCert(dict *templates.TemplateVarDictionary, deviceid string, accountid string, log Logger) (key string, cert string, err error)
}

PlatformKeyWriter interface spec. Exported platforms should expose an instance of this interface named 'PlatformKeyWriter'

type PlatformReader

type PlatformReader interface {
	// SetOptsPlatform is called upon intitialization of the platform reader
	// an implementation is not required to do anyything, but this can allow the reader
	// to setup correctly
	SetOptsPlatform(map[string]interface{}) (err error)
	GetPlatformVars(dict *templates.TemplateVarDictionary, log Logger) (err error)
}

PlatformReader interface spec. Exported platforms should expose an instance of this interface named 'PlatformReader'

type PluginOpts

type PluginOpts struct {
	Periodic []*PluginPeriodic `yaml:"periodic" json:"periodic"`
}

type PluginPeriodic

type PluginPeriodic struct {
	// FunctionName is a symbol name of a function with a call spec
	// of PeriodicFunc which is in the plugin
	FunctionName string `yaml:"func" json:"func"`
	// PeriodicInterval is the milliseconds between a PeriodicFunc completing a call,
	// and a new call being started
	IntervalMS int `yaml:"interval_ms" json:"interval_ms"`
}

PluginPeriodic is used to describe plugins which have a symbol which should be called periodically

type RunningConfig

type RunningConfig interface {
	GetJobs() []JobDefinition
	GetTemplates() []ContainerTemplate
	GetImages() []ImageDefinition
}

type RunningConfigOp

type RunningConfigOp interface {
	GetOp() string
	GetConfig() RunningConfig
	GetFlags() []string
}

type RunningConfigOpPayload

type RunningConfigOpPayload struct {
	Op     string                `yaml:"op" json:"op"`
	Config *RunningConfigPayload `yaml:"conf" json:"conf"`
	Flags  []string              `yaml:"flags" json:"flags"`
}

type RunningConfigPayload

type RunningConfigPayload struct {
	Jobs      []JobDefinitionPayload     `yaml:"jobs" json:"jobs"`
	Templates []ContainerTemplatePayload `yaml:"templates" json:"templates"`
	Images    []ImageDefinitionPayload   `yaml:"images" json:"images"`
	Configs   []ConfigDefinition         `yaml:"configs" json:"configs"`
}

This payload setups an entire running configuration, comprised of Jobs/Templates/Images

type StatsConfig

type StatsConfig interface {
	GetInterval() uint32
	GetConfig_CheckMem() (uint32, bool)
}

type StatsConfigPayload

type StatsConfigPayload struct {
	Interval     uint32 `yaml:"interval" json:"interval"`
	CheckMem     bool   `yaml:"check_mem" json:"check_mem"`
	CheckMemPace uint32 `yaml:"check_mem_pace" json:"check_mem_pace"`
}

func (StatsConfigPayload) GetConfig_CheckMem

func (stats StatsConfigPayload) GetConfig_CheckMem() (pace uint32, doit bool)

func (StatsConfigPayload) GetInterval

func (stats StatsConfigPayload) GetInterval() (ret uint32)

Interface defintion here is defined in processes/processMgmt.go:ProcessStatsConfig:

type TaskIdResponse

type TaskIdResponse interface {
	GetTaskId() string
}

type TaskIdResponsePayload

type TaskIdResponsePayload struct {
	TaskId string `yaml:"task_id" json:"task_id"`
}

func (*TaskIdResponsePayload) GetTaskId

func (this *TaskIdResponsePayload) GetTaskId() string

type TaskStatus

type TaskStatus interface {
	GetTaskStatus() string
	GetData() string
}

type TaskStatusPayload

type TaskStatusPayload struct {
	TaskId string `yaml:"task_id" json:"task_id"`
	Status string `yaml:"status" json:"status"`
	Data   string `yaml:"data" json:"data"`
}

func (*TaskStatusPayload) GetData

func (this *TaskStatusPayload) GetData() string

func (*TaskStatusPayload) GetStatus

func (this *TaskStatusPayload) GetStatus() string

type Watchdog

type Watchdog interface {
	// Called by Maestro upon load. If the watchdog needs a setup procedure this
	// should occur here. An error returned will prevent further calls from Maestro
	// including KeepAlive()
	Setup(config *WatchdogConfig, logger WatchdogLogger) error
	// CriticalInterval returns the time interval the watchdog *must* be called
	// in order to keep the system alive. The implementer should build in enough buffer
	// to this for the plugin to do its work of keep any hw / sw watchdog alive.
	// Maestro will call KeepAlive() at this interval or quicker, but never slower.
	CriticalInterval() time.Duration
	// KeepAlive is called by Maestro to keep the watch dog up. A call of KeepAlive
	// means the watchdog plug can safely assume all is normal on the system
	KeepAlive() error
	// NotOk is called by Maestro at the same interval as KeepAlive, but in leiu of it
	// when the system is not meeting the criteria to keep the watch dog up
	NotOk() error
	// Disabled is called when Maestro desires, typically from a command it recieved, to
	// disabled the watchdog. Usually for debugging. Implementors should disable the watchdog
	// or if this is impossible, they can return an error.
	Disable() error
	// Enable() is not called normally. But if Disable() is called, the a call of Enable()
	// should renable the watchdog if it was disabled.
	Enable() error
}

Watchdog plugins must meet this inteface spec All calls are blocking. The implementor should not block indefinitely

type WatchdogConfig

type WatchdogConfig struct {
	// Path is used by maestro and the config file, it is not for the plugin.
	// This the location of the ELF plugin object itself
	Path string `yaml:"path" json:"path"`
	// Disable, if true, then the watchdog plugin will load and immediately after Setup()
	// Disable() will be called
	Disable bool `yaml:"disable" json:"disable"`
	// Opt1 is a generic implementor optional parameter
	Opt1 string `yaml:"opt1" json:"opt1"`
	// Opt2 is a generic implementor optional parameter
	Opt2 string `yaml:"opt2" json:"opt2"`
}

WatchdogConfig is the config structure used to configure any watchdog plugin It will be passed to the watchdog Setup() procedure

type WatchdogLogger

type WatchdogLogger interface {
	Errorf(format string, a ...interface{})
	Debugf(format string, a ...interface{})
	Infof(format string, a ...interface{})
}

WatchdogLogger is passed in to the watchdog as a way for it to log output / problems.

type WritePlatformDeviceKeyNCert

type WritePlatformDeviceKeyNCert func(dict *templates.TemplateVarDictionary, key string, cert string, log Logger) (err error)

WritePlatformDeviceKeyNCert writes a key and cert for the platform

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL