node

package
v1.0.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNodeNotFound is returned when a node isn't found.
	ErrNodeNotFound = errors.New("node wasn't found")
	// ErrEmptyProviderID is returned when it is observed that provider id is not set on the kubernetes cluster
	ErrEmptyProviderID = errors.New("node with empty providerId present in the cluster")
)
View Source
var ErrNodeAlreadyExists = errors.New("another node with the same name exists")

ErrNodeAlreadyExists is returned if there's exists a node with the same name but different UUID.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// DeleteNodeByUUID deletes a node entry by its UUID and returns its current name.
	DeleteNodeByUUID(nodeUUID string) (string, error)
	// DeleteNodeByName deletes a node entry by its name and returns its current UUID.
	DeleteNodeByName(nodeName string) (string, error)
	// LoadNodeNameByUUID returns a node's name given its UUID.
	LoadNodeNameByUUID(nodeUUID string) (string, error)
	// LoadNodeUUIDByName returns a node's UUID given its name.
	LoadNodeUUIDByName(nodeName string) (string, error)
	// Range calls f sequentially for each node entry.
	Range(f func(nodeUUID, nodeName string) bool)
	// Store associates the node UUID with its name. If the node UUID already
	// exists in the Cache, the name associated with it is updated.
	Store(nodeUUID, nodeName string) error
}

Cache provides thread-safe functionality to cache node information. Note that node names are handled in a case sensitive manner, and must be unique.

func GetCache

func GetCache() Cache

GetCache returns the Cache singleton.

type Manager

type Manager interface {
	// SetKubernetesClient sets kubernetes client for node manager
	SetKubernetesClient(clientset.Interface)
	// RegisterNode registers a node given its UUID, name.
	RegisterNode(nodeUUID string, nodeName string) error
	// DiscoverNode discovers a registered node given its UUID. This method
	// scans all virtual centers registered on the VirtualCenterManager for a
	// virtual machine with the given UUID.
	DiscoverNode(nodeUUID string) error
	// GetNode refreshes and returns the VirtualMachine for a registered node
	// given its UUID.
	GetNode(nodeUUID string) (*vsphere.VirtualMachine, error)
	// GetNodeByName refreshes and returns the VirtualMachine for a registered node
	// given its name.
	GetNodeByName(nodeName string) (*vsphere.VirtualMachine, error)
	// GetAllNodes refreshes and returns VirtualMachine for all registered
	// nodes. If nodes are added or removed concurrently, they may or may not be
	// reflected in the result of a call to this method.
	GetAllNodes() ([]*vsphere.VirtualMachine, error)
	// UnregisterNode unregisters a registered node given its name.
	UnregisterNode(nodeName string) error
}

Manager provides functionality to manage nodes.

func GetManager

func GetManager() Manager

GetManager returns the Manager singleton.

type Metadata

type Metadata interface{}

Metadata represents node metadata.

Jump to

Keyboard shortcuts

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