Documentation ¶
Index ¶
- Constants
- Variables
- type ConnectionManager
- func (cm *ConnectionManager) APIVersion(vcenter string) (string, error)
- func (cm *ConnectionManager) Connect(ctx context.Context, vcenter string) error
- func (cm *ConnectionManager) ConnectByInstance(ctx context.Context, vsphereInstance *VSphereInstance) error
- func (cm *ConnectionManager) ListAllVCandDCPairs(ctx context.Context) ([]*ListDiscoveryInfo, error)
- func (cm *ConnectionManager) Logout()
- func (cm *ConnectionManager) LookupZoneByMoref(ctx context.Context, dataCenter *vclib.Datacenter, ...) (map[string]string, error)
- func (cm *ConnectionManager) Verify() error
- func (cm *ConnectionManager) VerifyWithContext(ctx context.Context) error
- func (cm *ConnectionManager) WhichVCandDCByFCDId(ctx context.Context, fcdID string) (*FcdDiscoveryInfo, error)
- func (cm *ConnectionManager) WhichVCandDCByNodeID(ctx context.Context, nodeID string, searchBy FindVM) (*VMDiscoveryInfo, error)
- func (cm *ConnectionManager) WhichVCandDCByZone(ctx context.Context, zoneLabel string, regionLabel string, zoneLooking string, ...) (*ZoneDiscoveryInfo, error)
- type FcdDiscoveryInfo
- type FindVM
- type ListDiscoveryInfo
- type VMDiscoveryInfo
- type VSphereInstance
- type ZoneDiscoveryInfo
Constants ¶
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 )
const ( ConnectionNotFoundErrMsg = "vCenter not found" MustHaveAtLeastOneVCDCErrMsg = "Must have at least one vCenter/Datacenter configured" MultiVCRequiresZonesErrMsg = "The use of multiple vCenters require the use of zones" MultiDCRequiresZonesErrMsg = "The use of multiple Datacenters within a vCenter require the use of zones" UnsupportedConfigurationErrMsg = "Unsupported configuration" )
Error Messages
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 ¶
var ( ErrConnectionNotFound = errors.New(ConnectionNotFoundErrMsg) ErrMustHaveAtLeastOneVCDC = errors.New(MustHaveAtLeastOneVCDCErrMsg) ErrMultiVCRequiresZones = errors.New(MultiVCRequiresZonesErrMsg) ErrMultiDCRequiresZones = errors.New(MultiDCRequiresZonesErrMsg) 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
NewConnectionManager returns a new ConnectionManager object.
func (*ConnectionManager) APIVersion ¶ added in v0.2.0
func (cm *ConnectionManager) APIVersion(vcenter string) (string, error)
APIVersion returns the version of the vCenter API
func (*ConnectionManager) Connect ¶
func (cm *ConnectionManager) Connect(ctx context.Context, vcenter string) error
Connect establishes a connection to the supplied vCenter.
func (*ConnectionManager) ConnectByInstance ¶
func (cm *ConnectionManager) ConnectByInstance(ctx context.Context, vsphereInstance *VSphereInstance) error
ConnectByInstance connects to vCenter with existing credentials If credentials are invalid:
- It will fetch credentials from credentialManager
- Update the credentials
- Connects again to vCenter with fetched credentials
func (*ConnectionManager) ListAllVCandDCPairs ¶ added in v0.2.0
func (cm *ConnectionManager) ListAllVCandDCPairs(ctx context.Context) ([]*ListDiscoveryInfo, error)
ListAllVCandDCPairs returns all VC/DC pairs
func (*ConnectionManager) Logout ¶
func (cm *ConnectionManager) Logout()
Logout closes existing connections to remote vCenter endpoints.
func (*ConnectionManager) LookupZoneByMoref ¶ added in v0.2.0
func (cm *ConnectionManager) LookupZoneByMoref(ctx context.Context, dataCenter *vclib.Datacenter, moRef types.ManagedObjectReference, zoneLabel string, regionLabel string) (map[string]string, error)
LookupZoneByMoref searches for a zone using the provided managed object reference.
func (*ConnectionManager) Verify ¶
func (cm *ConnectionManager) Verify() error
Verify validates the configuration by attempting to connect to the configured, remote vCenter endpoints.
func (*ConnectionManager) VerifyWithContext ¶
func (cm *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) WhichVCandDCByFCDId ¶
func (cm *ConnectionManager) WhichVCandDCByFCDId(ctx context.Context, fcdID string) (*FcdDiscoveryInfo, error)
WhichVCandDCByFCDId searches for an FCD using the provided ID.
func (*ConnectionManager) WhichVCandDCByNodeID ¶ added in v0.2.0
func (cm *ConnectionManager) WhichVCandDCByNodeID(ctx context.Context, nodeID string, searchBy FindVM) (*VMDiscoveryInfo, error)
WhichVCandDCByNodeID finds the VC/DC combo that owns a particular VM
func (*ConnectionManager) WhichVCandDCByZone ¶
func (cm *ConnectionManager) WhichVCandDCByZone(ctx context.Context, zoneLabel string, regionLabel string, zoneLooking string, regionLooking string) (*ZoneDiscoveryInfo, error)
WhichVCandDCByZone gets the corresponding VC+DC combo that supports the availability 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
FindVM is the type that represents the types of searches used to discover VMs.
type ListDiscoveryInfo ¶ added in v0.2.0
type ListDiscoveryInfo struct { VcServer string DataCenter *vclib.Datacenter }
ListDiscoveryInfo represents a VC/DC pair
type VMDiscoveryInfo ¶ added in v0.2.0
type VMDiscoveryInfo struct { DataCenter *vclib.Datacenter VM *vclib.VirtualMachine VcServer string UUID string NodeName string }
VMDiscoveryInfo contains VM info about a discovered VM
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 ZoneDiscoveryInfo ¶ added in v0.2.0
type ZoneDiscoveryInfo struct { DataCenter *vclib.Datacenter VcServer string }
ZoneDiscoveryInfo contains VC+DC info based on a given zone