manager

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvLeaderFile is the environment variable that may be used to customize the plugin leader detection
	EnvLeaderFile = "INFRAKIT_LEADER_FILE"

	// EnvStoreDir is the directory where the configs are stored
	EnvStoreDir = "INFRAKIT_STORE_DIR"

	// EnvID is the id for the manager node (for file backend only)
	EnvID = "INFRAKIT_ID"
)
View Source
const (
	// Kind is the canonical name of the plugin and also key used to locate the plugin in discovery
	Kind = "manager"

	// LookupName is the name used to look up the object via discovery
	LookupName = "group"

	// EnvOptionsBackend is the environment variable to use to set the default value of Options.Backend
	EnvOptionsBackend = "INFRAKIT_MANAGER_BACKEND"

	// EnvMuxListen is the listen string (:24864)
	EnvMuxListen = "INFRAKIT_MUX_LISTEN"

	// EnvAdvertise is the location of this node (127.0.0.1:24864)
	EnvAdvertise = "INFRAKIT_ADVERTISE"

	// EnvGroup is the group name backend
	EnvGroup = "INFRAKIT_MANAGER_GROUP"

	// EnvMetadata is the metadata backend
	EnvMetadata = "INFRAKIT_MANAGER_METADATA"

	// EnvMetadataUpdateInterval is the metadata backend update interval
	// if > 0, this will allow non-leader updates of metadata to be synced
	// to the leader. otherwise, a non-leader will not see the leader's updates
	// until it becomes the leader.  This is because even though the data is
	// persisted, it is not polled and read by the non-leaders on a regular basis
	// (unless this is set).
	EnvMetadataUpdateInterval = "INFRAKIT_MANAGER_METADATA_UPDATE_INTERVAL"
)

Variables

View Source
var DefaultBackendEtcdOptions = BackendEtcdOptions{
	PollInterval: types.FromDuration(5 * time.Second),
	Options: etcd.Options{
		RequestTimeout: 1 * time.Second,
		Config: clientv3.Config{
			Endpoints: []string{etcd.LocalIP() + ":2379"},
		},
	},
}

DefaultBackendEtcdOptions contains the defaults for running etcd as backend

View Source
var DefaultBackendFileOptions = BackendFileOptions{
	ID:           local.Getenv(EnvID, "manager1"),
	PollInterval: types.FromDuration(5 * time.Second),
	LeaderFile:   local.Getenv(EnvLeaderFile, filepath.Join(local.InfrakitHome(), "leader")),
	StoreDir:     local.Getenv(EnvStoreDir, filepath.Join(local.InfrakitHome(), "configs")),
}

DefaultBackendFileOptions is the default for the file backend

View Source
var DefaultBackendSwarmOptions = BackendSwarmOptions{
	PollInterval: types.FromDuration(5 * time.Second),
	Docker: docker.ConnectInfo{
		Host: "unix:///var/run/docker.sock",
		TLS:  &tlsconfig.Options{},
	},
}

DefaultBackendSwarmOptions is the Options for using the swarm backend.

View Source
var DefaultOptions = defaultOptions()

DefaultOptions return an Options with default values filled in.

Functions

func Run

func Run(plugins func() discovery.Plugins, name plugin.Name,
	config *types.Any) (transport plugin.Transport, impls map[run.PluginCode]interface{}, onStop func(), err error)

Run runs the plugin, blocking the current thread. Error is returned immediately if the plugin cannot be started.

Types

type BackendEtcdOptions

type BackendEtcdOptions struct {
	// PollInterval is how often to check
	PollInterval types.Duration

	etcd.Options `json:",inline" yaml:",inline"`

	// TLS config
	TLS *tlsconfig.Options
}

BackendEtcdOptions contain the options for the etcd backend

type BackendFileOptions

type BackendFileOptions struct {
	// PollInterval is how often to check
	PollInterval types.Duration

	// LeaderFile is the location of the leader file
	LeaderFile string

	// StoreDir is the path to the directory where state is stored
	StoreDir string

	// ID is the id of the node
	ID string
}

BackendFileOptions contain the options for the file backend

type BackendSwarmOptions

type BackendSwarmOptions struct {
	// PollInterval is how often to check
	PollInterval types.Duration
	// Docker holds the connection params to the Docker engine for join tokens, etc.
	Docker docker.ConnectInfo `json:",inline" yaml:",inline"`
}

BackendSwarmOptions contain the options for the swarm backend

type MuxConfig

type MuxConfig struct {
	// Listen string e.g. :24864
	Listen string

	// Advertise is the public listen string e.g. public_ip:24864
	Advertise string
}

MuxConfig is the struct for the mux frontend

type Options

type Options struct {
	manager.Options

	// Backend is the backend used for leadership, persistence, etc.
	// Possible values are file, etcd, and swarm
	Backend string

	// Settings is the configuration of the backend
	Settings *types.Any

	// Mux is the tcp frontend for remote connectivity
	Mux *MuxConfig
	// contains filtered or unexported fields
}

Options capture the options for starting up the plugin.

Jump to

Keyboard shortcuts

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