connectionmanager

package
v0.0.0-...-718960f Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FindVMByUUID finds VMs with the provided UUID.
	FindVMByUUID FindVM = iota // 0
	// FindVMByName finds VMs with the provided name.
	FindVMByName // 1
	// FindVMByIP finds VMs with the provided IP adress.
	FindVMByIP // 2

	// PoolSize is the number of goroutines used in parallel to find a VM.
	PoolSize int = 8

	// QueueSize is the size of the channel buffer used to find objects.
	// Only QueueSize objects may be placed into the queue before blocking.
	QueueSize int = PoolSize * 10

	// NumConnectionAttempts is the number of allowed connection attempts
	// before an error is returned.
	NumConnectionAttempts int = 3

	// RetryAttemptDelaySecs is the number of seconds to wait between
	// connection attempts.
	RetryAttemptDelaySecs int = 1
)
View Source
const (
	ConnectionNotFoundErrMsg       = "iCenter not found"
	MustHaveAtLeastOneICSDCErrMsg  = "Must have at least one iCenter/Datacenter configured"
	MultiICSRequiresZonesErrMsg    = "The use of multiple vCenters require the use of zones"
	MultiDCRequiresZonesErrMsg     = "The use of multiple Datacenters within a iCenter require the use of zones"
	UnsupportedConfigurationErrMsg = "Unsupported configuration"
	UnableToFindCredentialManager  = "Unable to find Credential Manager"
)

Error Messages

View Source
const (

	// ZoneLabel is the label for zones.
	ZoneLabel = "Zone"

	// RegionLabel is the label for regions.
	RegionLabel = "Region"
)

Well-known keys for k/v maps

Variables

View Source
var (
	ErrConnectionNotFound            = errors.New(ConnectionNotFoundErrMsg)
	ErrMustHaveAtLeastOneICSDC       = errors.New(MustHaveAtLeastOneICSDCErrMsg)
	ErrMultiICSRequiresZones         = errors.New(MultiICSRequiresZonesErrMsg)
	ErrMultiDCRequiresZones          = errors.New(MultiDCRequiresZonesErrMsg)
	ErrUnsupportedConfiguration      = errors.New(UnsupportedConfigurationErrMsg)
	ErrUnableToFindCredentialManager = errors.New(UnableToFindCredentialManager)
)

Error constants

Functions

This section is empty.

Types

type ConnectionManager

type ConnectionManager struct {
	sync.Mutex

	// Maps the ICS server to ICSInstance
	ICSInstanceMap map[string]*ICSInstance
	// contains filtered or unexported fields
}

ConnectionManager encapsulates iCenter connections

func NewConnectionManager

func NewConnectionManager(cfg *icfg.Config, informMgr *k8s.InformerManager, client clientset.Interface) *ConnectionManager

NewConnectionManager returns a new ConnectionManager object This function also initializes the Default/Global lister for secrets. In other words, If a single global secret is used for all VCs, the informMgr param will be used to obtain those secrets

func (*ConnectionManager) APIVersion

func (connMgr *ConnectionManager) APIVersion(icsInstance *ICSInstance) (string, error)

APIVersion returns the version of the iCenter API

func (*ConnectionManager) Connect

func (connMgr *ConnectionManager) Connect(ctx context.Context, icsInstance *ICSInstance) error

Connect connects to iCenter with existing credentials If credentials are invalid:

  1. It will fetch credentials from credentialManager
  2. Update the credentials
  3. Connects again to iCenter with fetched credentials

func (*ConnectionManager) InitializeSecretLister

func (connMgr *ConnectionManager) InitializeSecretLister()

InitializeSecretLister initializes the individual secret listers that are NOT handled through the Default/Global lister tied to the default service account.

func (*ConnectionManager) ListAllICSandDCPairs

func (cm *ConnectionManager) ListAllICSandDCPairs(ctx context.Context) ([]*ListDiscoveryInfo, error)

ListAllICSandDCPairs returns all ICS/DC pairs

func (*ConnectionManager) Logout

func (connMgr *ConnectionManager) Logout()

Logout closes existing connections to remote iCenter endpoints.

func (*ConnectionManager) LookupZoneByMoref

func (cm *ConnectionManager) LookupZoneByMoref(ctx context.Context, tenantRef string,
	hostRef string, zoneLabel string, regionLabel string) (map[string]string, error)

LookupZoneByMoref searches for a zone using the provided managed object reference.

func (*ConnectionManager) Verify

func (connMgr *ConnectionManager) Verify() error

Verify validates the configuration by attempting to connect to the configured, remote iCenter endpoints.

func (*ConnectionManager) VerifyWithContext

func (connMgr *ConnectionManager) VerifyWithContext(ctx context.Context) error

VerifyWithContext is the same as Verify but allows a Go Context to control the lifecycle of the connection event.

func (*ConnectionManager) WhichICSandDCByFCDId

func (cm *ConnectionManager) WhichICSandDCByFCDId(ctx context.Context, fcdID string) (*FcdDiscoveryInfo, error)

WhichICSandDCByFCDId searches for an FCD using the provided ID.

func (*ConnectionManager) WhichICSandDCByNodeID

func (cm *ConnectionManager) WhichICSandDCByNodeID(ctx context.Context, nodeID string, searchBy FindVM) (*VMDiscoveryInfo, error)

WhichICSandDCByNodeID finds the ICS/DC combo that owns a particular VM

func (*ConnectionManager) WhichICSandDCByZone

func (cm *ConnectionManager) WhichICSandDCByZone(ctx context.Context,
	zoneLabel string, regionLabel string, zoneLooking string, regionLooking string) (*ZoneDiscoveryInfo, error)

WhichICSandDCByZone gets the corresponding ICS+DC combo that supports the availability zone

type FcdDiscoveryInfo

type FcdDiscoveryInfo struct {
	TenantRef  string
	DataCenter *icslib.Datacenter
	FCDInfo    *icslib.FirstClassDiskInfo
	IcsServer  string
}

FcdDiscoveryInfo contains FCD info about a discovered FCD

type FindVM

type FindVM int

FindVM is the type that represents the types of searches used to discover VMs.

func (FindVM) String

func (f FindVM) String() string

String returns the string representation of the FindVM constant.

type ICSInstance

type ICSInstance struct {
	Conn *icsgo.ICSConnection
	Cfg  *icfg.ICSCenterConfig
}

ICSInstance represents a inCloud Sphere instance where one or more kubernetes nodes are running.

type ListDiscoveryInfo

type ListDiscoveryInfo struct {
	TenantRef  string
	IcsServer  string
	DataCenter *icslib.Datacenter
}

ListDiscoveryInfo represents a ICS/DC pair

type VMDiscoveryInfo

type VMDiscoveryInfo struct {
	TenantRef  string
	DataCenter *icslib.Datacenter
	VM         *icslib.VirtualMachine
	IcsServer  string
	UUID       string
	NodeName   string
}

VMDiscoveryInfo contains VM info about a discovered VM

type ZoneDiscoveryInfo

type ZoneDiscoveryInfo struct {
	TenantRef  string
	DataCenter *icslib.Datacenter
	IcsServer  string
}

ZoneDiscoveryInfo contains ICS+DC info based on a given zone

Jump to

Keyboard shortcuts

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