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 ClearInst()
- 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) ClusterNotifyClusterDomainsUpdate(activeMap types.ClusterDomainsActiveMap) error
- func (c *ClusterManager) ClusterNotifyNodeDown(culpritNodeId string) (string, error)
- func (c *ClusterManager) Collect(ctx context.Context, in *api.SdkDiagsCollectRequest) (*api.SdkDiagsCollectResponse, error)
- func (c *ClusterManager) CordonAttachments(ctx context.Context, in *api.SdkNodeCordonAttachmentsRequest) (*api.SdkNodeCordonAttachmentsResponse, error)
- func (c *ClusterManager) CreatePair(request *api.ClusterPairCreateRequest) (*api.ClusterPairCreateResponse, error)
- func (c *ClusterManager) DeleteDomain(name string) error
- func (c *ClusterManager) DeleteNodeConf(nodeID string) error
- func (c *ClusterManager) DeletePair(id string) error
- func (c *ClusterManager) DisableUpdates() error
- func (c *ClusterManager) DrainAttachments(ctx context.Context, in *api.SdkNodeDrainAttachmentsRequest) (*api.SdkJobResponse, 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) EnumerateDomains() ([]*clusterdomain.ClusterDomainInfo, error)
- func (c *ClusterManager) EnumerateJobs(ctx context.Context, req *api.SdkEnumerateJobsRequest) (*api.SdkEnumerateJobsResponse, error)
- func (c *ClusterManager) EnumerateNodeConf() (*osdconfig.NodesConfig, error)
- func (c *ClusterManager) EnumeratePairs() (*api.ClusterPairsEnumerateResponse, error)
- func (c *ClusterManager) EnumerateRebalanceJobs(context context.Context, request *api.SdkEnumerateRebalanceJobsRequest) (*api.SdkEnumerateRebalanceJobsResponse, 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) GetGossipIntervals() types.GossipIntervals
- func (c *ClusterManager) GetGossipState() *cluster.ClusterState
- func (c *ClusterManager) GetJobStatus(ctx context.Context, req *api.SdkGetJobStatusRequest) (*api.SdkGetJobStatusResponse, error)
- 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) GetRebalanceJobStatus(context context.Context, request *api.SdkGetRebalanceJobStatusRequest) (*api.SdkGetRebalanceJobStatusResponse, error)
- func (c *ClusterManager) GetSelfDomain() (*clusterdomain.ClusterDomainInfo, error)
- func (c *ClusterManager) Inspect(nodeID string) (api.Node, error)
- func (c *ClusterManager) InspectDomain(name string) (*clusterdomain.ClusterDomainInfo, error)
- func (c *ClusterManager) NodeRemoveDone(nodeID string, result error) 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) Rebalance(context context.Context, request *api.SdkStorageRebalanceRequest) (*api.SdkStorageRebalanceResponse, error)
- func (c *ClusterManager) RefreshPair(id string) error
- func (c *ClusterManager) Remove(nodes []api.Node, forceRemove bool) error
- func (c *ClusterManager) Resize(context context.Context, request *api.SdkStoragePoolResizeRequest) (*api.SdkStoragePoolResizeResponse, 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(nodeInitialized bool, gossipPort string, selfClusterDomain string) error
- func (c *ClusterManager) StartWithConfiguration(nodeInitialized bool, gossipPort string, snapshotPrefixes []string, ...) error
- func (c *ClusterManager) UncordonAttachments(ctx context.Context, in *api.SdkNodeUncordonAttachmentsRequest) (*api.SdkNodeUncordonAttachmentsResponse, error)
- func (c *ClusterManager) UpdateData(nodeData map[string]interface{}) error
- func (c *ClusterManager) UpdateDomainState(name string, state types.ClusterDomainState) error
- func (c *ClusterManager) UpdateJobState(ctx context.Context, req *api.SdkUpdateJobRequest) (*api.SdkUpdateJobResponse, error)
- func (c *ClusterManager) UpdateLabels(nodeLabels map[string]string) error
- func (c *ClusterManager) UpdateRebalanceJobState(context context.Context, request *api.SdkUpdateRebalanceJobRequest) (*api.SdkUpdateRebalanceJobResponse, 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 ClearInst ¶
func ClearInst()
ClearInst is used to clear the singleton instance. Use in Tests only
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) ClusterNotifyClusterDomainsUpdate ¶
func (c *ClusterManager) ClusterNotifyClusterDomainsUpdate(activeMap types.ClusterDomainsActiveMap) error
func (*ClusterManager) ClusterNotifyNodeDown ¶
func (c *ClusterManager) ClusterNotifyNodeDown(culpritNodeId string) (string, error)
func (*ClusterManager) Collect ¶
func (c *ClusterManager) Collect(ctx context.Context, in *api.SdkDiagsCollectRequest) (*api.SdkDiagsCollectResponse, error)
func (*ClusterManager) CordonAttachments ¶
func (c *ClusterManager) CordonAttachments( ctx context.Context, in *api.SdkNodeCordonAttachmentsRequest, ) (*api.SdkNodeCordonAttachmentsResponse, error)
func (*ClusterManager) CreatePair ¶
func (c *ClusterManager) CreatePair( request *api.ClusterPairCreateRequest, ) (*api.ClusterPairCreateResponse, error)
CreatePair remote pairs this cluster with a remote cluster.
func (*ClusterManager) DeleteDomain ¶
func (c *ClusterManager) DeleteDomain(name string) error
DeleteDomain deletes a cluster domain entry
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) DrainAttachments ¶
func (c *ClusterManager) DrainAttachments(ctx context.Context, in *api.SdkNodeDrainAttachmentsRequest) (*api.SdkJobResponse, error)
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) EnumerateDomains ¶
func (c *ClusterManager) EnumerateDomains() ([]*clusterdomain.ClusterDomainInfo, error)
EnumerateDomains returns all the cluster domains in the cluster
func (*ClusterManager) EnumerateJobs ¶
func (c *ClusterManager) EnumerateJobs( ctx context.Context, req *api.SdkEnumerateJobsRequest, ) (*api.SdkEnumerateJobsResponse, error)
func (*ClusterManager) EnumerateNodeConf ¶
func (c *ClusterManager) EnumerateNodeConf() (*osdconfig.NodesConfig, error)
func (*ClusterManager) EnumeratePairs ¶
func (c *ClusterManager) EnumeratePairs() (*api.ClusterPairsEnumerateResponse, error)
func (*ClusterManager) EnumerateRebalanceJobs ¶
func (c *ClusterManager) EnumerateRebalanceJobs( context context.Context, request *api.SdkEnumerateRebalanceJobsRequest) (*api.SdkEnumerateRebalanceJobsResponse, 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) GetGossipIntervals ¶
func (c *ClusterManager) GetGossipIntervals() types.GossipIntervals
GetGossipIntervals returns the configured gossip intervals
func (*ClusterManager) GetGossipState ¶
func (c *ClusterManager) GetGossipState() *cluster.ClusterState
GetGossipState returns current gossip state
func (*ClusterManager) GetJobStatus ¶
func (c *ClusterManager) GetJobStatus( ctx context.Context, req *api.SdkGetJobStatusRequest, ) (*api.SdkGetJobStatusResponse, error)
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) GetRebalanceJobStatus ¶
func (c *ClusterManager) GetRebalanceJobStatus( context context.Context, request *api.SdkGetRebalanceJobStatusRequest) ( *api.SdkGetRebalanceJobStatusResponse, error)
func (*ClusterManager) GetSelfDomain ¶
func (c *ClusterManager) GetSelfDomain() (*clusterdomain.ClusterDomainInfo, error)
GetSelfDomain returns the cluster domain for this node
func (*ClusterManager) Inspect ¶
func (c *ClusterManager) Inspect(nodeID string) (api.Node, error)
Inspect inspects given node and returns the state
func (*ClusterManager) InspectDomain ¶
func (c *ClusterManager) InspectDomain(name string) (*clusterdomain.ClusterDomainInfo, error)
InspectDomain returns the cluster domain info for the provided argument.
func (*ClusterManager) NodeRemoveDone ¶
func (c *ClusterManager) NodeRemoveDone(nodeID string, result error) 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) Rebalance ¶
func (c *ClusterManager) Rebalance( context context.Context, request *api.SdkStorageRebalanceRequest) ( *api.SdkStorageRebalanceResponse, error)
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) Resize ¶
func (c *ClusterManager) Resize( context context.Context, request *api.SdkStoragePoolResizeRequest) ( *api.SdkStoragePoolResizeResponse, error)
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( nodeInitialized bool, gossipPort string, selfClusterDomain string, ) error
Start initiates the cluster manager and the cluster state machine
func (*ClusterManager) StartWithConfiguration ¶
func (c *ClusterManager) StartWithConfiguration( nodeInitialized bool, gossipPort string, snapshotPrefixes []string, selfClusterDomain string, config *cluster.ClusterServerConfiguration, ) error
func (*ClusterManager) UncordonAttachments ¶
func (c *ClusterManager) UncordonAttachments( ctx context.Context, in *api.SdkNodeUncordonAttachmentsRequest, ) (*api.SdkNodeUncordonAttachmentsResponse, error)
func (*ClusterManager) UpdateData ¶
func (c *ClusterManager) UpdateData(nodeData map[string]interface{}) error
UpdateData updates self node data
func (*ClusterManager) UpdateDomainState ¶
func (c *ClusterManager) UpdateDomainState(name string, state types.ClusterDomainState) error
UpdateDomainState sets the cluster domain info object into kvdb
func (*ClusterManager) UpdateJobState ¶
func (c *ClusterManager) UpdateJobState( ctx context.Context, req *api.SdkUpdateJobRequest, ) (*api.SdkUpdateJobResponse, error)
func (*ClusterManager) UpdateLabels ¶
func (c *ClusterManager) UpdateLabels(nodeLabels map[string]string) error
func (*ClusterManager) UpdateRebalanceJobState ¶
func (c *ClusterManager) UpdateRebalanceJobState( context context.Context, request *api.SdkUpdateRebalanceJobRequest) ( *api.SdkUpdateRebalanceJobResponse, 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