manager

package
v8.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

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

View Source
const (
	// ClusterDBKey is the key at which cluster info is store in kvdb
	ClusterDBKey = "cluster/database"
)
View Source
const (
	// ClusterPairKey is the key at which info about cluster pairs is stored in kvdb
	ClusterPairKey = "cluster/pair"
)

Variables

View Source
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

func Init

func Init(cfg config.ClusterConfig) error

Init instantiates a new cluster manager.

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) CreatePair

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) 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) 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) 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)

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

func (c *ClusterManager) PeerStatus(listenerName string) (map[string]api.Status, error)

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,
	selfClusterDomain 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,
	selfClusterDomain string,
	config *cluster.ClusterServerConfiguration,
) 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) 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

type ErrNewNodeOverMaxCapacity

type ErrNewNodeOverMaxCapacity int

ErrNewNodeOverMaxCapacity used when a new node (not yet part of the cluster) triggers max #nodes capacity. NOTE: For validations, please use err.(type) rather than the value.

func (ErrNewNodeOverMaxCapacity) Error

Error returns a string descriptor for ErrNewNodeOverMaxCapacity

type ErrOldNodeOverMaxCapacity

type ErrOldNodeOverMaxCapacity int

ErrOldNodeOverMaxCapacity used when a OLD node (already part of the cluster) triggers max #nodes capacity. NOTE: For validations, please use err.(type) rather than the value.

func (ErrOldNodeOverMaxCapacity) Error

Error returns a string descriptor for ErrOldNodeOverMaxCapacity

Jump to

Keyboard shortcuts

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