Documentation
¶
Index ¶
- Constants
- func ApiJobToStructJob(job *api.Job, trafficLimit int) *models.Job
- func ApiOrderToStructOrder(order *api.Order) *models.Order
- func ApiTaskToStructsTask(apiTask *api.Task, structsTask *models.Task)
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func GetMd5Hash(text string) string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Addresses
- type AdvertiseAddrs
- type Agent
- type AppInfo
- type ClientConfig
- type CloudOrderResponse
- type Command
- type Config
- type HTTPCodedError
- type HTTPServer
- func (s *HTTPServer) AgentForceLeaveRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentJoinRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentMembersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentSelfRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentServersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AllocSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AllocsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) ClientAllocRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) DcsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) EvalSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) EvalsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) JobSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) JobsInfoRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) JobsRenewalRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) JobsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) LoginRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) NodeSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) NodesRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) OperatorRaftConfiguration(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) OperatorRaftPeer(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) OperatorRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) OrderCloudRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) OrderSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) OrdersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) PendingOrdersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) RegionListRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) Shutdown()
- func (s *HTTPServer) StatusLeaderRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) StatusPeersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) ValidateJobRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- type Member
- type Metric
- type Network
- type Node
- type Ports
- type ServerConfig
- type StringFlag
- type ZTreeData
Constants ¶
const ( DefaultAddr = "0.0.0.0" DefaultMaxPayload = 100 * 1024 * 1024 // 100M )
This is the default addr to all interfaces.
const (
// ErrInvalidMethod is used if the HTTP method is not supported
ErrInvalidMethod = "Invalid method"
)
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Addresses ¶
type Addresses struct {
HTTP string `mapstructure:"http"`
RPC string `mapstructure:"rpc"`
Serf string `mapstructure:"serf"`
Nats string `mapstructure:"nats"`
}
Addresses encapsulates all of the addresses we bind to for various network services. Everything is optional and defaults to BindAddr.
type AdvertiseAddrs ¶
type AdvertiseAddrs struct {
HTTP string `mapstructure:"http"`
RPC string `mapstructure:"rpc"`
Serf string `mapstructure:"serf"`
Nats string `mapstructure:"nats"`
}
AdvertiseAddrs is used to control the addresses we advertise out for different network services. All are optional and default to BindAddr and their default Port.
func (*AdvertiseAddrs) Merge ¶
func (a *AdvertiseAddrs) Merge(b *AdvertiseAddrs) *AdvertiseAddrs
Merge merges two advertise addrs configs together.
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is a long running daemon that is used to run both clients and servers. Servers are responsible for managing state and making scheduling decisions. Clients can be scheduled to, and are responsible for interfacing with servers to run allocations.
func (*Agent) Leave ¶
Leave is used gracefully exit. Clients will inform servers of their departure so that allocations can be rescheduled.
type ClientConfig ¶
type ClientConfig struct {
// Enabled controls if we are a client
Enabled bool `mapstructure:"enabled"`
// StateDir is the store directory
StateDir string `mapstructure:"state_dir"`
// Servers is a list of known server addresses. These are as "host:port"
Servers []string `mapstructure:"managers"`
// NoHostUUID disables using the host's UUID and will force generation of a
// random UUID.
NoHostUUID bool `mapstructure:"no_host_uuid"`
}
ClientConfig is configuration specific to the client mode
func (*ClientConfig) Merge ¶
func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig
Merge is used to merge two client configs together
type CloudOrderResponse ¶
type Command ¶
type Command struct {
Version string
Revision string
Ui cli.Ui
ShutdownCh <-chan struct{}
// contains filtered or unexported fields
}
Command is a Command implementation that runs a Udup agent. The command will not end unless a shutdown message is sent on the ShutdownCh. If two messages are sent on the ShutdownCh it will forcibly exit.
type Config ¶
type Config struct {
// Region is the region this agent is in. Defaults to global.
Region string `mapstructure:"region"`
// Datacenter is the datacenter this agent is in. Defaults to dc1
Datacenter string `mapstructure:"datacenter"`
// NodeName is the name we register as. Defaults to hostname.
NodeName string `mapstructure:"name"`
// DataDir is the directory to store our store in
DataDir string `mapstructure:"data_dir"`
// LogLevel is the level of the logs to putout
LogLevel string `mapstructure:"log_level"`
LogToStdout bool `mapstructure:"log_to_stdout"`
// file to write our pid to
PidFile string `mapstructure:"pid_file"`
// Specify the log file name. The empty string means to log to stdout.
LogFile string `mapstructure:"log_file"`
// BindAddr is the address on which all of server's services will
// be bound. If not specified, this defaults to 0.0.0.0 .
BindAddr string `mapstructure:"bind_addr"`
// Ports is used to control the network ports we bind to.
Ports *Ports `mapstructure:"ports"`
// Addresses is used to override the network addresses we bind to.
// Use normalizedAddrs if you need the host+port to bind to.
Addresses *Addresses `mapstructure:"addresses"`
// AdvertiseAddrs is used to control the addresses we advertise.
AdvertiseAddrs *AdvertiseAddrs `mapstructure:"advertise"`
// Client has our client related settings
Client *ClientConfig `mapstructure:"agent"`
// Server has our server related settings
Server *ServerConfig `mapstructure:"manager"`
Metric *Metric `mapstructure:"metric"`
Network *Network `mapstructure:"network"`
// Profile is used to select a timing profile for Serf. The supported choices
// are "wan", "lan", and "local". The default is "lan"
Profile string `mapstructure:"profile"`
// LeaveOnInt is used to gracefully leave on the interrupt signal
LeaveOnInt bool `mapstructure:"leave_on_interrupt"`
// LeaveOnTerm is used to gracefully leave on the terminate signal
LeaveOnTerm bool `mapstructure:"leave_on_terminate"`
// Consul contains the configuration for the Consul Agent and
// parameters necessary to register services, their checks, and
// discover the current Udup servers.
Consul *uconf.ConsulConfig `mapstructure:"consul"`
// UdupConfig is used to override the default config.
// This is largly used for testing purposes.
UdupConfig *uconf.ServerConfig `mapstructure:"-" json:"-"`
// ClientConfig is used to override the default config.
// This is largly used for testing purposes.
ClientConfig *uconf.ClientConfig `mapstructure:"-" json:"-"`
// Version information is set at compilation time
Version string
Revision string
// List of config files that have been loaded (in order)
Files []string `mapstructure:"-"`
// HTTPAPIResponseHeaders allows users to configure the Udup http agent to
// set arbritrary headers on API responses
HTTPAPIResponseHeaders map[string]string `mapstructure:"http_api_response_headers"`
// EnableUi enables the statically-compiled assets for the Udup web UI and
// serves them at the default /ui/ endpoint automatically.
EnableUi bool `mapstructure:"ui"`
// UiDir is the directory containing the Web UI resources.
// If provided, the UI endpoints will be enabled.
UiDir string `mapstructure:"ui_dir"`
// Schema name for dtle meta info (e.g. gtid_executed).
// Do not use special characters (which need to be quoted) in schema name.
DtleSchemaName string `mapstructure:"dtle_schema_name"`
// contains filtered or unexported fields
}
Config is the configuration for the Udup agent.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig is a the baseline configuration for Udup
func LoadConfig ¶
LoadConfig loads the configuration at the given path, regardless if its a file or directory.
func LoadConfigDir ¶
LoadConfigDir loads all the configurations in the given directory in alphabetical order.
func ParseConfig ¶
ParseConfig parses the config from the given io.Reader.
Due to current internal limitations, the entire contents of the io.Reader will be copied into memory first before parsing.
func ParseConfigFile ¶
ParseConfigFile parses the given path as a config file.
type HTTPCodedError ¶
HTTPCodedError is used to provide the HTTP error code
func CodedError ¶
func CodedError(c int, s string) HTTPCodedError
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is used to wrap an Agent and expose it over an HTTP interface
func NewHTTPServer ¶
NewHTTPServer starts new HTTP server over the agent
func (*HTTPServer) AgentForceLeaveRequest ¶
func (s *HTTPServer) AgentForceLeaveRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentJoinRequest ¶
func (s *HTTPServer) AgentJoinRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentMembersRequest ¶
func (s *HTTPServer) AgentMembersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentSelfRequest ¶
func (s *HTTPServer) AgentSelfRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentServersRequest ¶
func (s *HTTPServer) AgentServersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
AgentServersRequest is used to query the list of servers used by the Udup Client for RPCs. This endpoint can also be used to update the list of servers for a given agent.
func (*HTTPServer) AllocSpecificRequest ¶
func (s *HTTPServer) AllocSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AllocsRequest ¶
func (s *HTTPServer) AllocsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) ClientAllocRequest ¶
func (s *HTTPServer) ClientAllocRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) DcsRequest ¶
func (s *HTTPServer) DcsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) EvalSpecificRequest ¶
func (s *HTTPServer) EvalSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) EvalsRequest ¶
func (s *HTTPServer) EvalsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) JobSpecificRequest ¶
func (s *HTTPServer) JobSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) JobsInfoRequest ¶
func (s *HTTPServer) JobsInfoRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) JobsRenewalRequest ¶
func (s *HTTPServer) JobsRenewalRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) JobsRequest ¶
func (s *HTTPServer) JobsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) LoginRequest ¶
func (s *HTTPServer) LoginRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) NodeSpecificRequest ¶
func (s *HTTPServer) NodeSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) NodesRequest ¶
func (s *HTTPServer) NodesRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) OperatorRaftConfiguration ¶
func (s *HTTPServer) OperatorRaftConfiguration(resp http.ResponseWriter, req *http.Request) (interface{}, error)
OperatorRaftConfiguration is used to inspect the current Raft configuration. This supports the stale query mode in case the cluster doesn't have a leader.
func (*HTTPServer) OperatorRaftPeer ¶
func (s *HTTPServer) OperatorRaftPeer(resp http.ResponseWriter, req *http.Request) (interface{}, error)
OperatorRaftPeer supports actions on Raft peers. Currently we only support removing peers by address.
func (*HTTPServer) OperatorRequest ¶
func (s *HTTPServer) OperatorRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) OrderCloudRequest ¶
func (s *HTTPServer) OrderCloudRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) OrderSpecificRequest ¶
func (s *HTTPServer) OrderSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) OrdersRequest ¶
func (s *HTTPServer) OrdersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) PendingOrdersRequest ¶
func (s *HTTPServer) PendingOrdersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) RegionListRequest ¶
func (s *HTTPServer) RegionListRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) Shutdown ¶
func (s *HTTPServer) Shutdown()
Shutdown is used to shutdown the HTTP server
func (*HTTPServer) StatusLeaderRequest ¶
func (s *HTTPServer) StatusLeaderRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) StatusPeersRequest ¶
func (s *HTTPServer) StatusPeersRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) ValidateJobRequest ¶
func (s *HTTPServer) ValidateJobRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)
type Metric ¶
type Metric struct {
DisableHostname bool `mapstructure:"disable_hostname"`
UseNodeName bool `mapstructure:"use_node_name"`
CollectionInterval string `mapstructure:"collection_interval"`
PublishAllocationMetrics bool `mapstructure:"publish_allocation_metrics"`
PublishNodeMetrics bool `mapstructure:"publish_node_metrics"`
// contains filtered or unexported fields
}
type Network ¶
type Network struct {
// MAX_PAYLOAD is the maximum allowed payload size. Should be using
// something different if > 1MB payloads are needed.
MaxPayload int `mapstructure:"max_payload"`
}
type Ports ¶
type Ports struct {
HTTP int `mapstructure:"http"`
RPC int `mapstructure:"rpc"`
Serf int `mapstructure:"serf"`
Nats int `mapstructure:"nats"`
}
Ports encapsulates the various ports we bind to for network services. If any are not specified then the defaults are used instead.
type ServerConfig ¶
type ServerConfig struct {
// Enabled controls if we are a server
Enabled bool `mapstructure:"enabled"`
// BootstrapExpect tries to automatically bootstrap the udup cluster,
// by withholding peers until enough servers join.
BootstrapExpect int `mapstructure:"bootstrap_expect"`
// DataDir is the directory to store our store in
DataDir string `mapstructure:"data_dir"`
// NumSchedulers is the number of scheduler thread that are run.
// This can be as many as one per core, or zero to disable this server
// from doing any scheduling work.
NumSchedulers int `mapstructure:"num_schedulers"`
// EnabledSchedulers controls the set of sub-schedulers that are
// enabled for this server to handle. This will restrict the evaluations
// that the workers dequeue for processing.
EnabledSchedulers []string `mapstructure:"enabled_schedulers"`
// HeartbeatGrace is the grace period beyond the TTL to account for network,
// processing delays and clock skew before marking a node as "down".
HeartbeatGrace string `mapstructure:"heartbeat_grace"`
// StartJoin is a list of addresses to attempt to join when the
// agent starts. If Serf is unable to communicate with any of these
// addresses, then the agent will error and exit.
StartJoin []string `mapstructure:"join"`
// RetryMaxAttempts specifies the maximum number of times to retry joining a
// host on startup. This is useful for cases where we know the node will be
// online eventually.
RetryMaxAttempts int `mapstructure:"retry_max"`
// RetryInterval specifies the amount of time to wait in between join
// attempts on agent start. The minimum allowed value is 1 second and
// the default is 30s.
RetryInterval string `mapstructure:"retry_interval"`
// contains filtered or unexported fields
}
ServerConfig is configuration specific to the server mode
func (*ServerConfig) Merge ¶
func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig
Merge is used to merge two server configs together
type StringFlag ¶
type StringFlag []string
StringFlag implements the flag.Value interface and allows multiple calls to the same variable to append a list.
func (*StringFlag) Set ¶
func (s *StringFlag) Set(value string) error
func (*StringFlag) String ¶
func (s *StringFlag) String() string