clusterconf

package
v0.0.0-...-5c345c6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: MIT Imports: 20 Imported by: 0

README

clusterconf

clusterconf

Usage

const (
	RWZFS = iota
	TempZFS
	RAMDisk
)

Valid bundle dataset types

type Bundle
type Bundle struct {
	ID         uint64                   `json:"id"`
	Datasets   map[string]BundleDataset `json:"datasets"`
	Services   map[string]BundleService `json:"services"`
	Redundancy uint64                   `json:"redundancy"`
	Ports      BundlePorts              `json:"ports"`
	// ModIndex should be treated as opaque, but passed back on updates.
	ModIndex uint64 `json:"modIndex"`
}

Bundle is information about a bundle of services.

type BundleDataset
type BundleDataset struct {
	Name  string            `json:"name"`
	ID    string            `json:"id"`
	Type  BundleDatasetType `json:"type"`
	Quota uint64            `json:"type"`
}

BundleDataset is configuration for a dataset associated with a bundle.

type BundleDatasetType
type BundleDatasetType int

BundleDatasetType is the type of dataset to be used in a bundle.

type BundleHeartbeat
type BundleHeartbeat struct {
	IP           net.IP           `json:"ip"`
	HealthErrors map[string]error `json:"healthErrors"`
}

BundleHeartbeat is bundle heartbeat information.

func (BundleHeartbeat) MarshalJSON
func (b BundleHeartbeat) MarshalJSON() ([]byte, error)

MarshalJSON marshals BundleHeartbeat into a JSON map, converting error values to strings.

func (*BundleHeartbeat) UnmarshalJSON
func (b *BundleHeartbeat) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a BundleHeartbeat, converting string values to errors.

type BundleHeartbeatArgs
type BundleHeartbeatArgs struct {
	ID           uint64           `json:"id"`
	Serial       string           `json:"serial"`
	IP           net.IP           `json:"ip"`
	HealthErrors map[string]error `json:"healthErrors"`
}

BundleHeartbeatArgs are argumenst for updating a bundle heartbeat.

type BundleHeartbeatList
type BundleHeartbeatList struct {
	Heartbeats map[uint64]BundleHeartbeats `json:"heartbeats"`
}

BundleHeartbeatList is the result of a ListBundleHeartbeats.

func (BundleHeartbeatList) MarshalJSON
func (b BundleHeartbeatList) MarshalJSON() ([]byte, error)

MarshalJSON marshals BundleHeartbeatList into a JSON map, converting uint keys to strings. TODO: Needed until go 1.7 is released

func (*BundleHeartbeatList) UnmarshalJSON
func (b *BundleHeartbeatList) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a BundleHeartbeatList, converting string keys to uints. TODO: Needed until go 1.7 is released

type BundleHeartbeats
type BundleHeartbeats map[string]BundleHeartbeat

BundleHeartbeats are a set of bundle heartbeats for a node.

type BundleListResult
type BundleListResult struct {
	Bundles []*Bundle `json:"bundles"`
}

BundleListResult is the result from listing bundles.

type BundlePayload
type BundlePayload struct {
	Bundle *Bundle `json:"bundle"`
}

BundlePayload can be used for task args or result when a bundle object needs to be sent.

type BundlePort
type BundlePort struct {
	Port             int      `json:"port"`
	Public           bool     `json:"public"`
	ConnectedBundles []string `json:"connectedBundles"`
	ExternalPort     int      `json:"externalPort"`
}

BundlePort is configuration for a port associated with a bundle.

type BundlePorts
type BundlePorts map[int]BundlePort

BundlePorts is a map of port numbers to port information.

func (BundlePorts) MarshalJSON
func (p BundlePorts) MarshalJSON() ([]byte, error)

MarshalJSON marshals BundlePorts into a JSON map, converting int keys to strings.

func (BundlePorts) UnmarshalJSON
func (p BundlePorts) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a BundlePorts, converting string keys to ints.

type BundleService
type BundleService struct {
	ServiceConf
	Datasets map[string]ServiceDataset `json:"datasets"`
}

BundleService is configuration overrides for a service of a bundle and associated bundles.

type ClusterConf
type ClusterConf struct {
}

ClusterConf is a provider of cluster configuration functionality.

func New
func New(config *Config, tracker *acomm.Tracker) *ClusterConf

New creates a new instance of ClusterConf

func (*ClusterConf) BundleHeartbeat
func (c *ClusterConf) BundleHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

BundleHeartbeat registers a new node heartbeat that is using the dataset.

func (*ClusterConf) DatasetHeartbeat
func (c *ClusterConf) DatasetHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

DatasetHeartbeat registers a new node heartbeat that is using the dataset.

func (*ClusterConf) DeleteBundle
func (c *ClusterConf) DeleteBundle(req *acomm.Request) (interface{}, *url.URL, error)

DeleteBundle deletes a bundle config.

func (*ClusterConf) DeleteDataset
func (c *ClusterConf) DeleteDataset(req *acomm.Request) (interface{}, *url.URL, error)

DeleteDataset deletes a dataset config.

func (*ClusterConf) DeleteService
func (c *ClusterConf) DeleteService(req *acomm.Request) (interface{}, *url.URL, error)

DeleteService deletes a service config.

func (*ClusterConf) GetBundle
func (c *ClusterConf) GetBundle(req *acomm.Request) (interface{}, *url.URL, error)

GetBundle retrieves a bundle.

func (*ClusterConf) GetDHCP
func (c *ClusterConf) GetDHCP(*acomm.Request) (interface{}, *url.URL, error)

GetDHCP retrieves the current cluster DHCP settings.

func (*ClusterConf) GetDataset
func (c *ClusterConf) GetDataset(req *acomm.Request) (interface{}, *url.URL, error)

GetDataset retrieves a dataset.

func (*ClusterConf) GetDefaults
func (c *ClusterConf) GetDefaults(req *acomm.Request) (interface{}, *url.URL, error)

GetDefaults retrieves the cluster config.

func (*ClusterConf) GetNode
func (c *ClusterConf) GetNode(req *acomm.Request) (interface{}, *url.URL, error)

GetNode returns the latest information about a node.

func (*ClusterConf) GetNodesHistory
func (c *ClusterConf) GetNodesHistory(req *acomm.Request) (interface{}, *url.URL, error)

GetNodesHistory gets the heartbeat history for one or more nodes.

func (*ClusterConf) GetService
func (c *ClusterConf) GetService(req *acomm.Request) (interface{}, *url.URL, error)

GetService retrieves a service.

func (*ClusterConf) ListBundleHeartbeats
func (c *ClusterConf) ListBundleHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListBundleHeartbeats returns a list of all active bundle heartbeats.

func (*ClusterConf) ListBundles
func (c *ClusterConf) ListBundles(req *acomm.Request) (interface{}, *url.URL, error)

ListBundles retrieves a list of all bundles.

func (*ClusterConf) ListDatasetHeartbeats
func (c *ClusterConf) ListDatasetHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasetHeartbeats returns a list of all active dataset heartbeats.

func (*ClusterConf) ListDatasets
func (c *ClusterConf) ListDatasets(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasets returns a list of all Datasets.

func (*ClusterConf) ListNodes
func (c *ClusterConf) ListNodes(req *acomm.Request) (interface{}, *url.URL, error)

ListNodes list all current nodes.

func (*ClusterConf) NodeHeartbeat
func (c *ClusterConf) NodeHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

NodeHeartbeat records a new node heartbeat.

func (*ClusterConf) RegisterTasks
func (c *ClusterConf) RegisterTasks(server *provider.Server)

RegisterTasks registers all of Systemd's task handlers with the server.

func (*ClusterConf) SetDHCP
func (c *ClusterConf) SetDHCP(req *acomm.Request) (interface{}, *url.URL, error)

SetDHCP updates the cluster DHCP settings.

func (*ClusterConf) UpdateBundle
func (c *ClusterConf) UpdateBundle(req *acomm.Request) (interface{}, *url.URL, error)

UpdateBundle creates or updates a bundle config. When updating, a Get should first be performed and the modified Bundle passed back.

func (*ClusterConf) UpdateDataset
func (c *ClusterConf) UpdateDataset(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDataset creates or updates a dataset config. When updating, a Get should first be performed and the modified Dataset passed back.

func (*ClusterConf) UpdateDefaults
func (c *ClusterConf) UpdateDefaults(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDefaults sets or updates

func (*ClusterConf) UpdateService
func (c *ClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error)

UpdateService creates or updates a service config. When updating, a Get should first be performed and the modified Service passed back.

type Config
type Config struct {
	*provider.Config
}

Config holds all configuration for the provider.

func NewConfig
func NewConfig(flagSet *pflag.FlagSet, v *viper.Viper) *Config

NewConfig creates a new instance of Config.

func (*Config) BundleTTL
func (c *Config) BundleTTL() time.Duration

BundleTTL returns the TTL for bundle node heartbeats.

func (*Config) DatasetTTL
func (c *Config) DatasetTTL() time.Duration

DatasetTTL returns the TTL for dataset node heartbeats.

func (*Config) LoadConfig
func (c *Config) LoadConfig() error

LoadConfig loads and validates the ClusterConf provider config.

func (*Config) NodeTTL
func (c *Config) NodeTTL() time.Duration

NodeTTL returns the TTL for node heartbeats.

func (*Config) Validate
func (c *Config) Validate() error

Validate returns whether the config is valid, containing necessary values.

type ConfigData
type ConfigData struct {
	provider.ConfigData
	DatasetTTL string `json:"datasetTTL"`
	BundleTTL  string `json:"bundleTTL"`
	NodeTTL    string `json:"nodeTTL"`
}

ConfigData defines the structure of the config data (e.g. in the config file)

type DHCPConfig
type DHCPConfig struct {
	DNS      []string `json:"dns"`
	Duration string   `json:"duration"`
	Gateway  string   `json:"gateway"`
	Net      string   `json:"net"`
}

DHCPConfig represents the dhcp settings for the cluster.

func (*DHCPConfig) Validate
func (c *DHCPConfig) Validate() error

Validate validates the DHCPConfig settings.

type Dataset
type Dataset struct {
	ID                string `json:"id"`
	Parent            string `json:"parent"`
	ParentSameMachine bool   `json:"parentSameMachine"`
	ReadOnly          bool   `json:"readOnly"`
	NFS               bool   `json:"nfs"`
	Redundancy        uint64 `json:"redundancy"`
	Quota             uint64 `json:"quota"`
	// ModIndex should be treated as opaque, but passed back on updates.
	ModIndex uint64 `json:"modIndex"`
}

Dataset is information about a dataset.

type DatasetHeartbeat
type DatasetHeartbeat struct {
	IP    net.IP `json:"ip"`
	InUse bool   `json:"inUse"`
}

DatasetHeartbeat is dataset heartbeat information.

type DatasetHeartbeatArgs
type DatasetHeartbeatArgs struct {
	ID    string `json:"id"`
	IP    net.IP `json:"ip"`
	InUse bool   `json:"inUse"`
}

DatasetHeartbeatArgs are arguments for updating a dataset node heartbeat.

type DatasetHeartbeatList
type DatasetHeartbeatList struct {
	Heartbeats map[string]map[string]DatasetHeartbeat
}

DatasetHeartbeatList is the result of a ListDatasetHeartbeats.

type DatasetListResult
type DatasetListResult struct {
	Datasets []*Dataset `json:"datasets"`
}

DatasetListResult is the result for listing datasets.

type DatasetPayload
type DatasetPayload struct {
	Dataset *Dataset `json:"dataset"`
}

DatasetPayload can be used for task args or result when a dataset object needs to be sent.

type Defaults
type Defaults struct {
	DefaultsConf

	ModIndex uint64 `json:"modIndex"`
}

Defaults is information about the cluster configuration.

type DefaultsConf
type DefaultsConf struct {
	ZFSManual bool `json:"zfsManual"`
}

DefaultsConf is the configuration for the cluster.

type DefaultsPayload
type DefaultsPayload struct {
	Defaults *Defaults `json:"defaults"`
}

DefaultsPayload can be used for task args or result when a cluster object needs to be sent.

type DeleteBundleArgs
type DeleteBundleArgs struct {
	ID uint64 `json:"id"`
}

DeleteBundleArgs are args for bundle delete task.

type GetBundleArgs
type GetBundleArgs struct {
	ID              uint64 `json:"id"`
	CombinedOverlay bool   `json:"overlay"`
}

GetBundleArgs are args for retrieving a bundle.

type HealthCheck
type HealthCheck struct {
	ID   string      `json:"id"`
	Type string      `json:"type"`
	Args interface{} `json:"args"`
}

HealthCheck is configuration for performing a health check.

type IDArgs
type IDArgs struct {
	ID string `json:"id"`
}

IDArgs are arguments for operations requiring only an ID.

type ListBundleArgs
type ListBundleArgs struct {
	CombinedOverlay bool `json:"overlay"`
}

ListBundleArgs are args for retrieving a bundle list.

type ListNodesResult
type ListNodesResult struct {
	Nodes []Node `json:"nodes"`
}

ListNodesResult is the result of ListNodes.

type MockClusterConf
type MockClusterConf struct {
	Data *MockClusterData
}

MockClusterConf is a mock ClusterConf provider.

func NewMockClusterConf
func NewMockClusterConf() *MockClusterConf

NewMockClusterConf creates a new MockClusterConf.

func (*MockClusterConf) BundleHeartbeat
func (c *MockClusterConf) BundleHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

BundleHeartbeat adds a mock bundle heartbeat.

func (*MockClusterConf) DatasetHeartbeat
func (c *MockClusterConf) DatasetHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

DatasetHeartbeat adds a mock dataset heartbeat.

func (*MockClusterConf) DeleteBundle
func (c *MockClusterConf) DeleteBundle(req *acomm.Request) (interface{}, *url.URL, error)

DeleteBundle removes a mock bundle.

func (*MockClusterConf) DeleteDataset
func (c *MockClusterConf) DeleteDataset(req *acomm.Request) (interface{}, *url.URL, error)

DeleteDataset removes a mock dataset.

func (*MockClusterConf) DeleteService
func (c *MockClusterConf) DeleteService(req *acomm.Request) (interface{}, *url.URL, error)

DeleteService removes a mock service.

func (*MockClusterConf) GetBundle
func (c *MockClusterConf) GetBundle(req *acomm.Request) (interface{}, *url.URL, error)

GetBundle retrieves a mock bundle.

func (*MockClusterConf) GetDHCP
func (c *MockClusterConf) GetDHCP(req *acomm.Request) (interface{}, *url.URL, error)

GetDHCP retrieves mock DHCP settings.

func (*MockClusterConf) GetDataset
func (c *MockClusterConf) GetDataset(req *acomm.Request) (interface{}, *url.URL, error)

GetDataset retrieves a mock dataset.

func (*MockClusterConf) GetDefaults
func (c *MockClusterConf) GetDefaults(req *acomm.Request) (interface{}, *url.URL, error)

GetDefaults retrieves the mock default values.

func (*MockClusterConf) GetNode
func (c *MockClusterConf) GetNode(req *acomm.Request) (interface{}, *url.URL, error)

GetNode retrieves a mock node.

func (*MockClusterConf) GetNodesHistory
func (c *MockClusterConf) GetNodesHistory(req *acomm.Request) (interface{}, *url.URL, error)

GetNodesHistory retrieves mock nodes history.

func (*MockClusterConf) GetService
func (c *MockClusterConf) GetService(req *acomm.Request) (interface{}, *url.URL, error)

GetService retrieves a mock service.

func (*MockClusterConf) ListBundleHeartbeats
func (c *MockClusterConf) ListBundleHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListBundleHeartbeats list all mock bundle heartbeats.

func (*MockClusterConf) ListBundles
func (c *MockClusterConf) ListBundles(req *acomm.Request) (interface{}, *url.URL, error)

ListBundles retrieves all mock bundles.

func (*MockClusterConf) ListDatasetHeartbeats
func (c *MockClusterConf) ListDatasetHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasetHeartbeats lists all mock dataset heartbeats.

func (*MockClusterConf) ListDatasets
func (c *MockClusterConf) ListDatasets(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasets lists all mock datasets.

func (*MockClusterConf) ListNodes
func (c *MockClusterConf) ListNodes(req *acomm.Request) (interface{}, *url.URL, error)

ListNodes lists all mock nodes.

func (*MockClusterConf) NodeHeartbeat
func (c *MockClusterConf) NodeHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

NodeHeartbeat adds a mock node heartbeat.

func (*MockClusterConf) RegisterTasks
func (c *MockClusterConf) RegisterTasks(server *provider.Server)

RegisterTasks registers all of MockClusterConf's tasks.

func (*MockClusterConf) SetDHCP
func (c *MockClusterConf) SetDHCP(req *acomm.Request) (interface{}, *url.URL, error)

SetDHCP updates mock DHCP settings.

func (*MockClusterConf) UpdateBundle
func (c *MockClusterConf) UpdateBundle(req *acomm.Request) (interface{}, *url.URL, error)

UpdateBundle updates a mock bundle.

func (*MockClusterConf) UpdateDataset
func (c *MockClusterConf) UpdateDataset(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDataset updates a mock dataset.

func (*MockClusterConf) UpdateDefaults
func (c *MockClusterConf) UpdateDefaults(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDefaults updates the mock default values.

func (*MockClusterConf) UpdateService
func (c *MockClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error)

UpdateService updates a mock service.

type MockClusterData
type MockClusterData struct {
	Services   map[string]*Service
	Bundles    map[uint64]*Bundle
	BundlesHB  map[uint64]BundleHeartbeats
	Datasets   map[string]*Dataset
	DatasetsHB map[string]map[string]DatasetHeartbeat
	Nodes      map[string]*Node
	History    NodesHistory
	Defaults   *Defaults
	DHCP       *DHCPConfig
}

MockClusterData is the in-memory data structure for a MockClusterConf.

type Node
type Node struct {
	ID          string       `json:"id"`
	Heartbeat   time.Time    `json:"heartbeat"`
	MemoryTotal uint64       `json:"memoryTotal"`
	MemoryFree  uint64       `json:"memoryFree"`
	CPUCores    int          `json:"cpuCores"`
	CPULoad     load.AvgStat `json:"cpuLoad"`
	DiskTotal   uint64       `json:"diskTotal"`
	DiskFree    uint64       `json:"diskFree"`
}

Node is current information about a hardware node.

type NodeHistory
type NodeHistory map[time.Time]*Node

NodeHistory is a set of historical information for a node.

type NodeHistoryArgs
type NodeHistoryArgs struct {
	IDs    []string  `json:"ids"`
	Before time.Time `json:"before"`
	After  time.Time `json:"after"`
}

NodeHistoryArgs are arguments for filtering the historical results for nodes.

type NodePayload
type NodePayload struct {
	Node *Node `json:"node"`
}

NodePayload can be used for task args or result when a node object needs to be sent.

type NodesHistory
type NodesHistory map[string]NodeHistory

NodesHistory is the historical information for multiple nodes.

type NodesHistoryResult
type NodesHistoryResult struct {
	History NodesHistory `json:"history"`
}

NodesHistoryResult is the result from the GetNodesHistory handler.

type ResourceLimits
type ResourceLimits struct {
	CPU       int   `json:"cpu"`
	Memory    int64 `json:"memory"`
	Processes int   `json:"processes"`
}

ResourceLimits is configuration for resource upper bounds.

type Service
type Service struct {
	ServiceConf

	// ModIndex should be treated as opaque, but passed back on updates
	ModIndex uint64 `json:"modIndex"`
}

Service is information about a service.

type ServiceConf
type ServiceConf struct {
	ID           string                 `json:"id"`
	Dataset      string                 `json:"dataset"`
	HealthChecks map[string]HealthCheck `json:"healthChecks"`
	Limits       ResourceLimits         `json:"limits"`
	Env          map[string]string      `json:"env"`
	Cmd          []string               `json:"cmd"`
}

ServiceConf is the configuration of a service.

type ServiceDataset
type ServiceDataset struct {
	Name       string `json:"name"`
	MountPoint string `json:"mountPoint"`
	ReadOnly   bool   `json:"readOnly"`
}

ServiceDataset is configuration for mounting a dataset for a bundle service.

type ServicePayload
type ServicePayload struct {
	Service *Service `json:"service"`
}

ServicePayload can be used for task args or result when a service object needs to be sent.

-- Generated with godocdown

Documentation

Index

Constants

View Source
const (
	RWZFS = iota
	TempZFS
	RAMDisk
)

Valid bundle dataset types

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	ID         uint64                   `json:"id"`
	Datasets   map[string]BundleDataset `json:"datasets"`
	Services   map[string]BundleService `json:"services"`
	Redundancy uint64                   `json:"redundancy"`
	Ports      BundlePorts              `json:"ports"`
	// ModIndex should be treated as opaque, but passed back on updates.
	ModIndex uint64 `json:"modIndex"`
	// contains filtered or unexported fields
}

Bundle is information about a bundle of services.

type BundleDataset

type BundleDataset struct {
	Name  string            `json:"name"`
	ID    string            `json:"id"`
	Type  BundleDatasetType `json:"type"`
	Quota uint64            `json:"type"`
}

BundleDataset is configuration for a dataset associated with a bundle.

type BundleDatasetType

type BundleDatasetType int

BundleDatasetType is the type of dataset to be used in a bundle.

type BundleHeartbeat

type BundleHeartbeat struct {
	IP           net.IP           `json:"ip"`
	HealthErrors map[string]error `json:"healthErrors"`
}

BundleHeartbeat is bundle heartbeat information.

func (BundleHeartbeat) MarshalJSON

func (b BundleHeartbeat) MarshalJSON() ([]byte, error)

MarshalJSON marshals BundleHeartbeat into a JSON map, converting error values to strings.

func (*BundleHeartbeat) UnmarshalJSON

func (b *BundleHeartbeat) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a BundleHeartbeat, converting string values to errors.

type BundleHeartbeatArgs

type BundleHeartbeatArgs struct {
	ID           uint64           `json:"id"`
	Serial       string           `json:"serial"`
	IP           net.IP           `json:"ip"`
	HealthErrors map[string]error `json:"healthErrors"`
}

BundleHeartbeatArgs are argumenst for updating a bundle heartbeat.

type BundleHeartbeatList

type BundleHeartbeatList struct {
	Heartbeats map[uint64]BundleHeartbeats `json:"heartbeats"`
}

BundleHeartbeatList is the result of a ListBundleHeartbeats.

func (BundleHeartbeatList) MarshalJSON

func (b BundleHeartbeatList) MarshalJSON() ([]byte, error)

MarshalJSON marshals BundleHeartbeatList into a JSON map, converting uint keys to strings. TODO: Needed until go 1.7 is released

func (*BundleHeartbeatList) UnmarshalJSON

func (b *BundleHeartbeatList) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a BundleHeartbeatList, converting string keys to uints. TODO: Needed until go 1.7 is released

type BundleHeartbeats

type BundleHeartbeats map[string]BundleHeartbeat

BundleHeartbeats are a set of bundle heartbeats for a node.

type BundleListResult

type BundleListResult struct {
	Bundles []*Bundle `json:"bundles"`
}

BundleListResult is the result from listing bundles.

type BundlePayload

type BundlePayload struct {
	Bundle *Bundle `json:"bundle"`
}

BundlePayload can be used for task args or result when a bundle object needs to be sent.

type BundlePort

type BundlePort struct {
	Port             int      `json:"port"`
	Public           bool     `json:"public"`
	ConnectedBundles []string `json:"connectedBundles"`
	ExternalPort     int      `json:"externalPort"`
}

BundlePort is configuration for a port associated with a bundle.

type BundlePorts

type BundlePorts map[int]BundlePort

BundlePorts is a map of port numbers to port information.

func (BundlePorts) MarshalJSON

func (p BundlePorts) MarshalJSON() ([]byte, error)

MarshalJSON marshals BundlePorts into a JSON map, converting int keys to strings.

func (BundlePorts) UnmarshalJSON

func (p BundlePorts) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a BundlePorts, converting string keys to ints.

type BundleService

type BundleService struct {
	ServiceConf
	Datasets map[string]ServiceDataset `json:"datasets"`
}

BundleService is configuration overrides for a service of a bundle and associated bundles.

type ClusterConf

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

ClusterConf is a provider of cluster configuration functionality.

func New

func New(config *Config, tracker *acomm.Tracker) *ClusterConf

New creates a new instance of ClusterConf

func (*ClusterConf) BundleHeartbeat

func (c *ClusterConf) BundleHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

BundleHeartbeat registers a new node heartbeat that is using the dataset.

func (*ClusterConf) DatasetHeartbeat

func (c *ClusterConf) DatasetHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

DatasetHeartbeat registers a new node heartbeat that is using the dataset.

func (*ClusterConf) DeleteBundle

func (c *ClusterConf) DeleteBundle(req *acomm.Request) (interface{}, *url.URL, error)

DeleteBundle deletes a bundle config.

func (*ClusterConf) DeleteDataset

func (c *ClusterConf) DeleteDataset(req *acomm.Request) (interface{}, *url.URL, error)

DeleteDataset deletes a dataset config.

func (*ClusterConf) DeleteService

func (c *ClusterConf) DeleteService(req *acomm.Request) (interface{}, *url.URL, error)

DeleteService deletes a service config.

func (*ClusterConf) GetBundle

func (c *ClusterConf) GetBundle(req *acomm.Request) (interface{}, *url.URL, error)

GetBundle retrieves a bundle.

func (*ClusterConf) GetDHCP

func (c *ClusterConf) GetDHCP(*acomm.Request) (interface{}, *url.URL, error)

GetDHCP retrieves the current cluster DHCP settings.

func (*ClusterConf) GetDataset

func (c *ClusterConf) GetDataset(req *acomm.Request) (interface{}, *url.URL, error)

GetDataset retrieves a dataset.

func (*ClusterConf) GetDefaults

func (c *ClusterConf) GetDefaults(req *acomm.Request) (interface{}, *url.URL, error)

GetDefaults retrieves the cluster config.

func (*ClusterConf) GetNode

func (c *ClusterConf) GetNode(req *acomm.Request) (interface{}, *url.URL, error)

GetNode returns the latest information about a node.

func (*ClusterConf) GetNodesHistory

func (c *ClusterConf) GetNodesHistory(req *acomm.Request) (interface{}, *url.URL, error)

GetNodesHistory gets the heartbeat history for one or more nodes.

func (*ClusterConf) GetService

func (c *ClusterConf) GetService(req *acomm.Request) (interface{}, *url.URL, error)

GetService retrieves a service.

func (*ClusterConf) ListBundleHeartbeats

func (c *ClusterConf) ListBundleHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListBundleHeartbeats returns a list of all active bundle heartbeats.

func (*ClusterConf) ListBundles

func (c *ClusterConf) ListBundles(req *acomm.Request) (interface{}, *url.URL, error)

ListBundles retrieves a list of all bundles.

func (*ClusterConf) ListDatasetHeartbeats

func (c *ClusterConf) ListDatasetHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasetHeartbeats returns a list of all active dataset heartbeats.

func (*ClusterConf) ListDatasets

func (c *ClusterConf) ListDatasets(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasets returns a list of all Datasets.

func (*ClusterConf) ListNodes

func (c *ClusterConf) ListNodes(req *acomm.Request) (interface{}, *url.URL, error)

ListNodes list all current nodes.

func (*ClusterConf) NodeHeartbeat

func (c *ClusterConf) NodeHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

NodeHeartbeat records a new node heartbeat.

func (*ClusterConf) RegisterTasks

func (c *ClusterConf) RegisterTasks(server *provider.Server)

RegisterTasks registers all of Systemd's task handlers with the server.

func (*ClusterConf) SetDHCP

func (c *ClusterConf) SetDHCP(req *acomm.Request) (interface{}, *url.URL, error)

SetDHCP updates the cluster DHCP settings.

func (*ClusterConf) UpdateBundle

func (c *ClusterConf) UpdateBundle(req *acomm.Request) (interface{}, *url.URL, error)

UpdateBundle creates or updates a bundle config. When updating, a Get should first be performed and the modified Bundle passed back.

func (*ClusterConf) UpdateDataset

func (c *ClusterConf) UpdateDataset(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDataset creates or updates a dataset config. When updating, a Get should first be performed and the modified Dataset passed back.

func (*ClusterConf) UpdateDefaults

func (c *ClusterConf) UpdateDefaults(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDefaults sets or updates

func (*ClusterConf) UpdateService

func (c *ClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error)

UpdateService creates or updates a service config. When updating, a Get should first be performed and the modified Service passed back.

type Config

type Config struct {
	*provider.Config
}

Config holds all configuration for the provider.

func NewConfig

func NewConfig(flagSet *pflag.FlagSet, v *viper.Viper) *Config

NewConfig creates a new instance of Config.

func (*Config) BundleTTL

func (c *Config) BundleTTL() time.Duration

BundleTTL returns the TTL for bundle node heartbeats.

func (*Config) DatasetTTL

func (c *Config) DatasetTTL() time.Duration

DatasetTTL returns the TTL for dataset node heartbeats.

func (*Config) LoadConfig

func (c *Config) LoadConfig() error

LoadConfig loads and validates the ClusterConf provider config.

func (*Config) NodeTTL

func (c *Config) NodeTTL() time.Duration

NodeTTL returns the TTL for node heartbeats.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns whether the config is valid, containing necessary values.

type ConfigData

type ConfigData struct {
	provider.ConfigData
	DatasetTTL string `json:"datasetTTL"`
	BundleTTL  string `json:"bundleTTL"`
	NodeTTL    string `json:"nodeTTL"`
}

ConfigData defines the structure of the config data (e.g. in the config file)

type DHCPConfig

type DHCPConfig struct {
	DNS      []string `json:"dns"`
	Duration string   `json:"duration"`
	Gateway  string   `json:"gateway"`
	Net      string   `json:"net"`
}

DHCPConfig represents the dhcp settings for the cluster.

func (*DHCPConfig) Validate

func (c *DHCPConfig) Validate() error

Validate validates the DHCPConfig settings.

type Dataset

type Dataset struct {
	ID                string `json:"id"`
	Parent            string `json:"parent"`
	ParentSameMachine bool   `json:"parentSameMachine"`
	ReadOnly          bool   `json:"readOnly"`
	NFS               bool   `json:"nfs"`
	Redundancy        uint64 `json:"redundancy"`
	Quota             uint64 `json:"quota"`
	// ModIndex should be treated as opaque, but passed back on updates.
	ModIndex uint64 `json:"modIndex"`
	// contains filtered or unexported fields
}

Dataset is information about a dataset.

type DatasetHeartbeat

type DatasetHeartbeat struct {
	IP    net.IP `json:"ip"`
	InUse bool   `json:"inUse"`
}

DatasetHeartbeat is dataset heartbeat information.

type DatasetHeartbeatArgs

type DatasetHeartbeatArgs struct {
	ID    string `json:"id"`
	IP    net.IP `json:"ip"`
	InUse bool   `json:"inUse"`
}

DatasetHeartbeatArgs are arguments for updating a dataset node heartbeat.

type DatasetHeartbeatList

type DatasetHeartbeatList struct {
	Heartbeats map[string]map[string]DatasetHeartbeat
}

DatasetHeartbeatList is the result of a ListDatasetHeartbeats.

type DatasetListResult

type DatasetListResult struct {
	Datasets []*Dataset `json:"datasets"`
}

DatasetListResult is the result for listing datasets.

type DatasetPayload

type DatasetPayload struct {
	Dataset *Dataset `json:"dataset"`
}

DatasetPayload can be used for task args or result when a dataset object needs to be sent.

type Defaults

type Defaults struct {
	DefaultsConf

	ModIndex uint64 `json:"modIndex"`
	// contains filtered or unexported fields
}

Defaults is information about the cluster configuration.

type DefaultsConf

type DefaultsConf struct {
	ZFSManual bool `json:"zfsManual"`
}

DefaultsConf is the configuration for the cluster.

type DefaultsPayload

type DefaultsPayload struct {
	Defaults *Defaults `json:"defaults"`
}

DefaultsPayload can be used for task args or result when a cluster object needs to be sent.

type DeleteBundleArgs

type DeleteBundleArgs struct {
	ID uint64 `json:"id"`
}

DeleteBundleArgs are args for bundle delete task.

type GetBundleArgs

type GetBundleArgs struct {
	ID              uint64 `json:"id"`
	CombinedOverlay bool   `json:"overlay"`
}

GetBundleArgs are args for retrieving a bundle.

type HealthCheck

type HealthCheck struct {
	ID   string      `json:"id"`
	Type string      `json:"type"`
	Args interface{} `json:"args"`
}

HealthCheck is configuration for performing a health check.

type IDArgs

type IDArgs struct {
	ID string `json:"id"`
}

IDArgs are arguments for operations requiring only an ID.

type ListBundleArgs

type ListBundleArgs struct {
	CombinedOverlay bool `json:"overlay"`
}

ListBundleArgs are args for retrieving a bundle list.

type ListNodesResult

type ListNodesResult struct {
	Nodes []Node `json:"nodes"`
}

ListNodesResult is the result of ListNodes.

type MockClusterConf

type MockClusterConf struct {
	Data *MockClusterData
}

MockClusterConf is a mock ClusterConf provider.

func NewMockClusterConf

func NewMockClusterConf() *MockClusterConf

NewMockClusterConf creates a new MockClusterConf.

func (*MockClusterConf) BundleHeartbeat

func (c *MockClusterConf) BundleHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

BundleHeartbeat adds a mock bundle heartbeat.

func (*MockClusterConf) DatasetHeartbeat

func (c *MockClusterConf) DatasetHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

DatasetHeartbeat adds a mock dataset heartbeat.

func (*MockClusterConf) DeleteBundle

func (c *MockClusterConf) DeleteBundle(req *acomm.Request) (interface{}, *url.URL, error)

DeleteBundle removes a mock bundle.

func (*MockClusterConf) DeleteDataset

func (c *MockClusterConf) DeleteDataset(req *acomm.Request) (interface{}, *url.URL, error)

DeleteDataset removes a mock dataset.

func (*MockClusterConf) DeleteService

func (c *MockClusterConf) DeleteService(req *acomm.Request) (interface{}, *url.URL, error)

DeleteService removes a mock service.

func (*MockClusterConf) GetBundle

func (c *MockClusterConf) GetBundle(req *acomm.Request) (interface{}, *url.URL, error)

GetBundle retrieves a mock bundle.

func (*MockClusterConf) GetDHCP

func (c *MockClusterConf) GetDHCP(req *acomm.Request) (interface{}, *url.URL, error)

GetDHCP retrieves mock DHCP settings.

func (*MockClusterConf) GetDataset

func (c *MockClusterConf) GetDataset(req *acomm.Request) (interface{}, *url.URL, error)

GetDataset retrieves a mock dataset.

func (*MockClusterConf) GetDefaults

func (c *MockClusterConf) GetDefaults(req *acomm.Request) (interface{}, *url.URL, error)

GetDefaults retrieves the mock default values.

func (*MockClusterConf) GetNode

func (c *MockClusterConf) GetNode(req *acomm.Request) (interface{}, *url.URL, error)

GetNode retrieves a mock node.

func (*MockClusterConf) GetNodesHistory

func (c *MockClusterConf) GetNodesHistory(req *acomm.Request) (interface{}, *url.URL, error)

GetNodesHistory retrieves mock nodes history.

func (*MockClusterConf) GetService

func (c *MockClusterConf) GetService(req *acomm.Request) (interface{}, *url.URL, error)

GetService retrieves a mock service.

func (*MockClusterConf) ListBundleHeartbeats

func (c *MockClusterConf) ListBundleHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListBundleHeartbeats list all mock bundle heartbeats.

func (*MockClusterConf) ListBundles

func (c *MockClusterConf) ListBundles(req *acomm.Request) (interface{}, *url.URL, error)

ListBundles retrieves all mock bundles.

func (*MockClusterConf) ListDatasetHeartbeats

func (c *MockClusterConf) ListDatasetHeartbeats(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasetHeartbeats lists all mock dataset heartbeats.

func (*MockClusterConf) ListDatasets

func (c *MockClusterConf) ListDatasets(req *acomm.Request) (interface{}, *url.URL, error)

ListDatasets lists all mock datasets.

func (*MockClusterConf) ListNodes

func (c *MockClusterConf) ListNodes(req *acomm.Request) (interface{}, *url.URL, error)

ListNodes lists all mock nodes.

func (*MockClusterConf) NodeHeartbeat

func (c *MockClusterConf) NodeHeartbeat(req *acomm.Request) (interface{}, *url.URL, error)

NodeHeartbeat adds a mock node heartbeat.

func (*MockClusterConf) RegisterTasks

func (c *MockClusterConf) RegisterTasks(server *provider.Server)

RegisterTasks registers all of MockClusterConf's tasks.

func (*MockClusterConf) SetDHCP

func (c *MockClusterConf) SetDHCP(req *acomm.Request) (interface{}, *url.URL, error)

SetDHCP updates mock DHCP settings.

func (*MockClusterConf) UpdateBundle

func (c *MockClusterConf) UpdateBundle(req *acomm.Request) (interface{}, *url.URL, error)

UpdateBundle updates a mock bundle.

func (*MockClusterConf) UpdateDataset

func (c *MockClusterConf) UpdateDataset(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDataset updates a mock dataset.

func (*MockClusterConf) UpdateDefaults

func (c *MockClusterConf) UpdateDefaults(req *acomm.Request) (interface{}, *url.URL, error)

UpdateDefaults updates the mock default values.

func (*MockClusterConf) UpdateService

func (c *MockClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error)

UpdateService updates a mock service.

type MockClusterData

type MockClusterData struct {
	Services   map[string]*Service
	Bundles    map[uint64]*Bundle
	BundlesHB  map[uint64]BundleHeartbeats
	Datasets   map[string]*Dataset
	DatasetsHB map[string]map[string]DatasetHeartbeat
	Nodes      map[string]*Node
	History    NodesHistory
	Defaults   *Defaults
	DHCP       *DHCPConfig
}

MockClusterData is the in-memory data structure for a MockClusterConf.

type Node

type Node struct {
	ID          string       `json:"id"`
	Heartbeat   time.Time    `json:"heartbeat"`
	MemoryTotal uint64       `json:"memoryTotal"`
	MemoryFree  uint64       `json:"memoryFree"`
	CPUCores    int          `json:"cpuCores"`
	CPULoad     load.AvgStat `json:"cpuLoad"`
	DiskTotal   uint64       `json:"diskTotal"`
	DiskFree    uint64       `json:"diskFree"`
	// contains filtered or unexported fields
}

Node is current information about a hardware node.

type NodeHistory

type NodeHistory map[time.Time]*Node

NodeHistory is a set of historical information for a node.

type NodeHistoryArgs

type NodeHistoryArgs struct {
	IDs    []string  `json:"ids"`
	Before time.Time `json:"before"`
	After  time.Time `json:"after"`
}

NodeHistoryArgs are arguments for filtering the historical results for nodes.

type NodePayload

type NodePayload struct {
	Node *Node `json:"node"`
}

NodePayload can be used for task args or result when a node object needs to be sent.

type NodesHistory

type NodesHistory map[string]NodeHistory

NodesHistory is the historical information for multiple nodes.

type NodesHistoryResult

type NodesHistoryResult struct {
	History NodesHistory `json:"history"`
}

NodesHistoryResult is the result from the GetNodesHistory handler.

type ResourceLimits

type ResourceLimits struct {
	CPU       int   `json:"cpu"`
	Memory    int64 `json:"memory"`
	Processes int   `json:"processes"`
}

ResourceLimits is configuration for resource upper bounds.

type Service

type Service struct {
	ServiceConf

	// ModIndex should be treated as opaque, but passed back on updates
	ModIndex uint64 `json:"modIndex"`
	// contains filtered or unexported fields
}

Service is information about a service.

type ServiceConf

type ServiceConf struct {
	ID           string                 `json:"id"`
	Dataset      string                 `json:"dataset"`
	HealthChecks map[string]HealthCheck `json:"healthChecks"`
	Limits       ResourceLimits         `json:"limits"`
	Env          map[string]string      `json:"env"`
	Cmd          []string               `json:"cmd"`
}

ServiceConf is the configuration of a service.

type ServiceDataset

type ServiceDataset struct {
	Name       string `json:"name"`
	MountPoint string `json:"mountPoint"`
	ReadOnly   bool   `json:"readOnly"`
}

ServiceDataset is configuration for mounting a dataset for a bundle service.

type ServicePayload

type ServicePayload struct {
	Service *Service `json:"service"`
}

ServicePayload can be used for task args or result when a service object needs to be sent.

Jump to

Keyboard shortcuts

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