Documentation ¶
Overview ¶
Package cluster implements a cluster state machine. It relies on a cluster wide keyvalue store for coordinating the state of the cluster. It also stores the state of the cluster in this keyvalue store.
Index ¶
- Constants
- Variables
- func ExternalIp(config *config.ClusterConfig) (string, string, error)
- func Init(cfg config.ClusterConfig) error
- type ClusterManager
- func (c *ClusterManager) AddEventListener(listener cluster.ClusterListener) error
- func (c *ClusterManager) CreatePair(request *api.ClusterPairCreateRequest) (*api.ClusterPairCreateResponse, error)
- func (c *ClusterManager) DeleteNodeConf(nodeID string) error
- func (c *ClusterManager) DeletePair(id string) error
- func (c *ClusterManager) DisableUpdates() error
- func (c *ClusterManager) EnableUpdates() error
- func (c *ClusterManager) Enumerate() (api.Cluster, error)
- func (c *ClusterManager) EnumerateAlerts(ts, te time.Time, resource api.ResourceType) (*api.Alerts, error)
- func (c *ClusterManager) EnumerateNodeConf() (*osdconfig.NodesConfig, error)
- func (c *ClusterManager) EnumeratePairs() (*api.ClusterPairsEnumerateResponse, error)
- func (c *ClusterManager) EraseAlert(resource api.ResourceType, alertID int64) error
- func (c *ClusterManager) GetClusterConf() (*osdconfig.ClusterConfig, error)
- func (c *ClusterManager) GetData() (map[string]*api.Node, error)
- func (c *ClusterManager) GetGossipState() *cluster.ClusterState
- func (c *ClusterManager) GetNodeConf(nodeID string) (*osdconfig.NodeConfig, error)
- func (c *ClusterManager) GetNodeIdFromIp(idIp string) (string, error)
- func (c *ClusterManager) GetPair(id string) (*api.ClusterPairGetResponse, error)
- func (c *ClusterManager) GetPairToken(reset bool) (*api.ClusterPairTokenGetResponse, error)
- func (c *ClusterManager) HandleNotifications(culpritNodeId string, notification api.ClusterNotify) (string, error)
- func (c *ClusterManager) Inspect(nodeID string) (api.Node, error)
- func (c *ClusterManager) NodeRemoveDone(nodeID string, result error)
- func (c *ClusterManager) NodeStatus() (api.Status, error)
- func (c *ClusterManager) ObjectStoreCreate(volumeID string) (*api.ObjectstoreInfo, error)
- func (c *ClusterManager) ObjectStoreDelete(objectstoreID string) error
- func (c *ClusterManager) ObjectStoreInspect(objectstoreID string) (*api.ObjectstoreInfo, error)
- func (c *ClusterManager) ObjectStoreUpdate(objectstoreID string, enable bool) error
- func (c *ClusterManager) PeerStatus(listenerName string) (map[string]api.Status, error)
- func (c *ClusterManager) ProcessPairRequest(request *api.ClusterPairProcessRequest) (*api.ClusterPairProcessResponse, error)
- func (c *ClusterManager) RefreshPair(id string) error
- func (c *ClusterManager) Remove(nodes []api.Node, forceRemove bool) error
- func (c *ClusterManager) SchedPolicyCreate(name, sched string) error
- func (c *ClusterManager) SchedPolicyDelete(name string) error
- func (c *ClusterManager) SchedPolicyEnumerate() ([]*sched.SchedPolicy, error)
- func (c *ClusterManager) SchedPolicyGet(name string) (*sched.SchedPolicy, error)
- func (c *ClusterManager) SchedPolicyUpdate(name, sched string) error
- func (c *ClusterManager) SecretCheckLogin() error
- func (c *ClusterManager) SecretGet(secretKey string) (interface{}, error)
- func (c *ClusterManager) SecretGetDefaultSecretKey() (interface{}, error)
- func (c *ClusterManager) SecretLogin(secretType string, secretConfig map[string]string) error
- func (c *ClusterManager) SecretSet(secretKey string, secretValue interface{}) error
- func (c *ClusterManager) SecretSetDefaultSecretKey(secretKey string, override bool) error
- func (c *ClusterManager) SetClusterConf(config *osdconfig.ClusterConfig) error
- func (c *ClusterManager) SetNodeConf(config *osdconfig.NodeConfig) error
- func (c *ClusterManager) SetSize(size int) error
- func (c *ClusterManager) Shutdown() error
- func (c *ClusterManager) Start(clusterMaxSize int, nodeInitialized bool, gossipPort string) error
- func (c *ClusterManager) StartWithConfiguration(clusterMaxSize int, nodeInitialized bool, gossipPort string, ...) error
- func (c *ClusterManager) UpdateData(nodeData map[string]interface{}) error
- func (c *ClusterManager) UpdateLabels(nodeLabels map[string]string) error
- func (c *ClusterManager) UpdateSchedulerNodeName(schedulerNodeName string) error
- func (c *ClusterManager) Uuid() string
- func (c *ClusterManager) ValidatePair(id string) error
Constants ¶
const (
// ClusterDBKey is the key at which cluster info is store in kvdb
ClusterDBKey = "cluster/database"
)
const (
// ClusterPairKey is the key at which info about cluster pairs is stored in kvdb
ClusterPairKey = "cluster/pair"
)
Variables ¶
var ( // Inst returns an instance of an already instantiated cluster manager. // This function can be overridden for testing purposes Inst = func() (cluster.Cluster, error) { return clusterInst() } )
Functions ¶
func ExternalIp ¶
func ExternalIp(config *config.ClusterConfig) (string, string, error)
ExternalIp returns the mgmt and data ip based on the config
Types ¶
type ClusterManager ¶
type ClusterManager struct {
// contains filtered or unexported fields
}
ClusterManager implements the cluster interface
func (*ClusterManager) AddEventListener ¶
func (c *ClusterManager) AddEventListener(listener cluster.ClusterListener) error
AddEventListener adds a new listener
func (*ClusterManager) CreatePair ¶
func (c *ClusterManager) CreatePair( request *api.ClusterPairCreateRequest, ) (*api.ClusterPairCreateResponse, error)
CreatePair remote pairs this cluster with a remote cluster.
func (*ClusterManager) DeleteNodeConf ¶
func (c *ClusterManager) DeleteNodeConf(nodeID string) error
func (*ClusterManager) DeletePair ¶
func (c *ClusterManager) DeletePair( id string, ) error
func (*ClusterManager) DisableUpdates ¶
func (c *ClusterManager) DisableUpdates() error
DisableUpdates disables gossip updates
func (*ClusterManager) EnableUpdates ¶
func (c *ClusterManager) EnableUpdates() error
EnableUpdates enables gossip updates
func (*ClusterManager) Enumerate ¶
func (c *ClusterManager) Enumerate() (api.Cluster, error)
Enumerate lists all the nodes in the cluster.
func (*ClusterManager) EnumerateAlerts ¶
func (c *ClusterManager) EnumerateAlerts(ts, te time.Time, resource api.ResourceType) (*api.Alerts, error)
func (*ClusterManager) EnumerateNodeConf ¶
func (c *ClusterManager) EnumerateNodeConf() (*osdconfig.NodesConfig, error)
func (*ClusterManager) EnumeratePairs ¶
func (c *ClusterManager) EnumeratePairs() (*api.ClusterPairsEnumerateResponse, error)
func (*ClusterManager) EraseAlert ¶
func (c *ClusterManager) EraseAlert(resource api.ResourceType, alertID int64) error
func (*ClusterManager) GetClusterConf ¶
func (c *ClusterManager) GetClusterConf() (*osdconfig.ClusterConfig, error)
osdconfig.ConfigCaller compliance
func (*ClusterManager) GetData ¶
func (c *ClusterManager) GetData() (map[string]*api.Node, error)
GetData returns self node's data
func (*ClusterManager) GetGossipState ¶
func (c *ClusterManager) GetGossipState() *cluster.ClusterState
GetGossipState returns current gossip state
func (*ClusterManager) GetNodeConf ¶
func (c *ClusterManager) GetNodeConf(nodeID string) (*osdconfig.NodeConfig, error)
func (*ClusterManager) GetNodeIdFromIp ¶
func (c *ClusterManager) GetNodeIdFromIp(idIp string) (string, error)
GetNodeIdFromIp returns a Node Id given an IP.
func (*ClusterManager) GetPair ¶
func (c *ClusterManager) GetPair( id string, ) (*api.ClusterPairGetResponse, error)
func (*ClusterManager) GetPairToken ¶
func (c *ClusterManager) GetPairToken( reset bool, ) (*api.ClusterPairTokenGetResponse, error)
func (*ClusterManager) HandleNotifications ¶
func (c *ClusterManager) HandleNotifications(culpritNodeId string, notification api.ClusterNotify) (string, error)
HandleNotifications is a callback function used by the listeners
func (*ClusterManager) Inspect ¶
func (c *ClusterManager) Inspect(nodeID string) (api.Node, error)
Inspect inspects given node and returns the state
func (*ClusterManager) NodeRemoveDone ¶
func (c *ClusterManager) NodeRemoveDone(nodeID string, result error)
NodeRemoveDone is called from the listeners when their job of Node removal is done.
func (*ClusterManager) NodeStatus ¶
func (c *ClusterManager) NodeStatus() (api.Status, error)
NodeStatus returns the status of a node. It compares the status maintained by the cluster manager and the provided listener and returns the appropriate one
func (*ClusterManager) ObjectStoreCreate ¶
func (c *ClusterManager) ObjectStoreCreate(volumeID string) (*api.ObjectstoreInfo, error)
ObjectStoreCreate objectstore on specified volume
func (*ClusterManager) ObjectStoreDelete ¶
func (c *ClusterManager) ObjectStoreDelete(objectstoreID string) error
ObjectStoreDelete objectstore from cluster
func (*ClusterManager) ObjectStoreInspect ¶
func (c *ClusterManager) ObjectStoreInspect(objectstoreID string) (*api.ObjectstoreInfo, error)
ObjectStoreInspect returns status of objectstore
func (*ClusterManager) ObjectStoreUpdate ¶
func (c *ClusterManager) ObjectStoreUpdate(objectstoreID string, enable bool) error
ObjectStoreUpdate enable/disable objectstore
func (*ClusterManager) PeerStatus ¶
PeerStatus returns the status of a peer node as seen by us
func (*ClusterManager) ProcessPairRequest ¶
func (c *ClusterManager) ProcessPairRequest( request *api.ClusterPairProcessRequest, ) (*api.ClusterPairProcessResponse, error)
ProcessPairRequest handles a remote cluster's pair request
func (*ClusterManager) RefreshPair ¶
func (c *ClusterManager) RefreshPair( id string, ) error
func (*ClusterManager) Remove ¶
func (c *ClusterManager) Remove(nodes []api.Node, forceRemove bool) error
Remove node(s) from the cluster permanently.
func (*ClusterManager) SchedPolicyCreate ¶
func (c *ClusterManager) SchedPolicyCreate(name, sched string) error
SchedPolicyCreate creates a policy with given name and schedule.
func (*ClusterManager) SchedPolicyDelete ¶
func (c *ClusterManager) SchedPolicyDelete(name string) error
SchedPolicyDelete deletes a policy with given name.
func (*ClusterManager) SchedPolicyEnumerate ¶
func (c *ClusterManager) SchedPolicyEnumerate() ([]*sched.SchedPolicy, error)
SchedPolicyEnumerate enumerates all configured policies or the ones specified.
func (*ClusterManager) SchedPolicyGet ¶
func (c *ClusterManager) SchedPolicyGet(name string) (*sched.SchedPolicy, error)
SchedPolicyGet returns schedule policy matching given name.
func (*ClusterManager) SchedPolicyUpdate ¶
func (c *ClusterManager) SchedPolicyUpdate(name, sched string) error
SchedPolicyUpdate updates a policy with given name and schedule.
func (*ClusterManager) SecretCheckLogin ¶
func (c *ClusterManager) SecretCheckLogin() error
SecretCheckLogin validates session with secret store
func (*ClusterManager) SecretGet ¶
func (c *ClusterManager) SecretGet(secretKey string) (interface{}, error)
SecretGet retrieves the value/data for given key
func (*ClusterManager) SecretGetDefaultSecretKey ¶
func (c *ClusterManager) SecretGetDefaultSecretKey() (interface{}, error)
SecretGetDefaultSecretKey returns cluster wide secret key
func (*ClusterManager) SecretLogin ¶
func (c *ClusterManager) SecretLogin(secretType string, secretConfig map[string]string) error
SecretLogin create session with secret store
func (*ClusterManager) SecretSet ¶
func (c *ClusterManager) SecretSet(secretKey string, secretValue interface{}) error
SecretSet the given value/data against the key
func (*ClusterManager) SecretSetDefaultSecretKey ¶
func (c *ClusterManager) SecretSetDefaultSecretKey(secretKey string, override bool) error
SecretSetDefaultSecretKey sets the cluster wide secret key
func (*ClusterManager) SetClusterConf ¶
func (c *ClusterManager) SetClusterConf(config *osdconfig.ClusterConfig) error
func (*ClusterManager) SetNodeConf ¶
func (c *ClusterManager) SetNodeConf(config *osdconfig.NodeConfig) error
func (*ClusterManager) SetSize ¶
func (c *ClusterManager) SetSize(size int) error
SetSize sets the maximum number of nodes in a cluster.
func (*ClusterManager) Shutdown ¶
func (c *ClusterManager) Shutdown() error
Shutdown can be called when THIS node is gracefully shutting down.
func (*ClusterManager) Start ¶
func (c *ClusterManager) Start( clusterMaxSize int, nodeInitialized bool, gossipPort string, ) error
Start initiates the cluster manager and the cluster state machine
func (*ClusterManager) StartWithConfiguration ¶
func (c *ClusterManager) StartWithConfiguration( clusterMaxSize int, nodeInitialized bool, gossipPort string, snapshotPrefixes []string, config *cluster.ClusterServerConfiguration, ) error
func (*ClusterManager) UpdateData ¶
func (c *ClusterManager) UpdateData(nodeData map[string]interface{}) error
UpdateData updates self node data
func (*ClusterManager) UpdateLabels ¶
func (c *ClusterManager) UpdateLabels(nodeLabels map[string]string) error
func (*ClusterManager) UpdateSchedulerNodeName ¶
func (c *ClusterManager) UpdateSchedulerNodeName(schedulerNodeName string) error
func (*ClusterManager) Uuid ¶
func (c *ClusterManager) Uuid() string
Uuid returns the unique id of the cluster
func (*ClusterManager) ValidatePair ¶
func (c *ClusterManager) ValidatePair( id string, ) error