connectionmanager

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FindVMByUUID FindVM = iota // 0
	FindVMByName               // 1

	POOL_SIZE  int = 8
	QUEUE_SIZE int = POOL_SIZE * 10

	// Error Messages
	ConnectionNotFoundErrMsg       = "vCenter not found"
	UnsupportedConfigurationErrMsg = "Unsupported configuration: Supports only a single VC/DC"
)

Variables

View Source
var (
	ErrConnectionNotFound       = errors.New(ConnectionNotFoundErrMsg)
	ErrUnsupportedConfiguration = errors.New(UnsupportedConfigurationErrMsg)
)

Error constants

Functions

This section is empty.

Types

type ConnectionManager

type ConnectionManager struct {
	// Maps the VC server to VSphereInstance
	VsphereInstanceMap map[string]*VSphereInstance
	// contains filtered or unexported fields
}

ConnectionManager encapsulates vCenter connections

func NewConnectionManager

func NewConnectionManager(config *vcfg.Config, secretLister v1.SecretLister) *ConnectionManager

func (*ConnectionManager) Connect

func (cm *ConnectionManager) Connect(ctx context.Context, vcenter string) error

func (*ConnectionManager) ConnectByInstance

func (cm *ConnectionManager) ConnectByInstance(ctx context.Context, vsphereInstance *VSphereInstance) error

ConnectByInstance connects to vCenter with existing credentials If credentials are invalid:

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

func (*ConnectionManager) Logout

func (cm *ConnectionManager) Logout()

func (*ConnectionManager) Verify

func (cm *ConnectionManager) Verify() error

func (*ConnectionManager) VerifyWithContext

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

func (*ConnectionManager) WhichVCandDCByFCDId

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

func (*ConnectionManager) WhichVCandDCByNodeId

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

func (*ConnectionManager) WhichVCandDCByZone

func (cm *ConnectionManager) WhichVCandDCByZone(ctx context.Context, zone string) (*DiscoveryInfo, error)

WhichVCandDCByZone gets the corresponding VC+DC combo that supports the availability zone TODO: we currently only support a single VC/DC combinations until we support availability zones *** Working Idea *** The current thinking is that Datacenters will be tagged with a "zone" value. This function will be passed the zone from the k8s cluster then "look up" the tag on datacenter using a method similar to what is done in the function WhichVCandDCByNodeId (aka in parallel) then return the DiscoveryInfo for that zone. This should handle non-unique DatastoreCluster and Datastore names between Datacenters. *** Working Idea ***

type DiscoveryInfo

type DiscoveryInfo struct {
	DataCenter *vclib.Datacenter
	VcServer   string
}

DiscoveryInfo contains VC+DC info based on a given zone

type FcdDiscoveryInfo

type FcdDiscoveryInfo struct {
	DataCenter *vclib.Datacenter
	FCDInfo    *vclib.FirstClassDiskInfo
	VcServer   string
}

FcdDiscoveryInfo contains FCD info about a discovered FCD

type FindVM

type FindVM int

type VSphereInstance

type VSphereInstance struct {
	Conn *vclib.VSphereConnection
	Cfg  *vcfg.VirtualCenterConfig
}

VSphereInstance represents a vSphere instance where one or more kubernetes nodes are running.

type VmDiscoveryInfo

type VmDiscoveryInfo struct {
	DataCenter *vclib.Datacenter
	VM         *vclib.VirtualMachine
	VcServer   string
	UUID       string
	NodeName   string
}

VmDiscoveryInfo contains VM info about a discovered VM

Jump to

Keyboard shortcuts

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