Documentation ¶
Overview ¶
Package vc ...
Package vc ...
Package vc ...
Index ¶
- Constants
- func FindMatchingVirtualMachineTemplate(vms []*tkgtypes.VSphereVirtualMachine, ovaVersions []string) (matchedTemplateVMs []*tkgtypes.VSphereVirtualMachine, nonTemplateVMs []string)
- func GetDuplicateNetworks(networks []*models.VSphereNetwork) map[string]bool
- func GetVCThumbprint(host string) (string, error)
- func ValidateAndGetVirtualMachineTemplateForTKRVersion(vcClient Client, tkrVersion string, ovaVersions []string, ...) (*tkgtypes.VSphereVirtualMachine, error)
- type Client
- type DefaultClient
- func (c *DefaultClient) AcquireTicket() (string, error)
- func (c *DefaultClient) CheckUserSessionActive() (bool, error)
- func (c *DefaultClient) DetectPacific(ctx context.Context) (bool, error)
- func (c *DefaultClient) FindDataCenter(ctx context.Context, path string) (string, error)
- func (c *DefaultClient) FindDatastore(ctx context.Context, path, dcPath string) (string, error)
- func (c *DefaultClient) FindFolder(ctx context.Context, path, dcPath string) (string, error)
- func (c *DefaultClient) FindNetwork(ctx context.Context, path, dcPath string) (string, error)
- func (c *DefaultClient) FindResourcePool(ctx context.Context, path, dcPath string) (string, error)
- func (c *DefaultClient) FindVirtualMachine(ctx context.Context, path, dcPath string) (string, error)
- func (c *DefaultClient) GetAndValidateVirtualMachineTemplate(ovaVersions []string, tkrVersion string, templateName, dc string, ...) (*tkgtypes.VSphereVirtualMachine, error)
- func (c *DefaultClient) GetComputeResources(ctx context.Context, datacenterMOID string) ([]*models.VSphereManagementObject, error)
- func (c *DefaultClient) GetDataCenterMOID(ctx context.Context, dcName string) (string, error)
- func (c *DefaultClient) GetDatacenters(ctx context.Context) ([]*models.VSphereDatacenter, error)
- func (c *DefaultClient) GetDatastores(ctx context.Context, datacenterMOID string) ([]*models.VSphereDatastore, error)
- func (c *DefaultClient) GetFolders(ctx context.Context, datacenterMOID string) ([]*models.VSphereFolder, error)
- func (c *DefaultClient) GetNetworks(ctx context.Context, datacenterMOID string) ([]*models.VSphereNetwork, error)
- func (c *DefaultClient) GetPath(ctx context.Context, moid string) (string, []*models.VSphereManagementObject, error)
- func (c *DefaultClient) GetResourcePools(ctx context.Context, datacenterMOID string) ([]*models.VSphereResourcePool, error)
- func (c *DefaultClient) GetVSphereVersion() (string, string, error)
- func (c *DefaultClient) GetVirtualMachineImages(ctx context.Context, datacenterMOID string) ([]*tkgtypes.VSphereVirtualMachine, error)
- func (c *DefaultClient) GetVirtualMachines(ctx context.Context, datacenterMOID string) ([]*models.VSphereVirtualMachine, error)
- func (c *DefaultClient) Login(ctx context.Context, user, password string) (string, error)
Constants ¶
const ( K8SVmPropertyID = "KUBERNETES_SEMVER" OVAVersionPropertyID = "VERSION" DistroNamePropertyID = "DISTRO_NAME" DistroVersionPropertyID = "DISTRO_VERSION" DistroArchPropertyID = "DISTRO_ARCH" VMPropertyCategoryCAPI = "Cluster API Provider (CAPI)" VMGuestInfoUserDataKey = "guestinfo.userdata" VCDefaultPort = "443" )
VSphere resource tags for tkg resource
const ( TypeCluster = "ClusterComputeResource" TypeComputeResource = "ComputeResource" TypeHostGroup = "HostGroup" TypeResourcePool = "ResourcePool" TypeDatacenter = "Datacenter" TypeFolder = "Folder" TypeDatastore = "Datastore" TypeHost = "HostSystem" TypeNetwork = "Network" TypeDvpg = "DistributedVirtualPortgroup" TypeDvs = "VmwareDistributedVirtualSwitch" TypeOpaqueNetwork = "OpaqueNetwork" TypeVirtualMachine = "VirtualMachine" )
vCenter Managed Object Type Names
Variables ¶
This section is empty.
Functions ¶
func FindMatchingVirtualMachineTemplate ¶
func FindMatchingVirtualMachineTemplate( vms []*tkgtypes.VSphereVirtualMachine, ovaVersions []string, ) (matchedTemplateVMs []*tkgtypes.VSphereVirtualMachine, nonTemplateVMs []string)
FindMatchingVirtualMachineTemplate finds a virtual machine template that matches the ova versions
func GetDuplicateNetworks ¶ added in v0.11.0
func GetDuplicateNetworks(networks []*models.VSphereNetwork) map[string]bool
GetDuplicateNetworks return a map of duplicate networks from the available networks.
func GetVCThumbprint ¶
GetVCThumbprint gets the vc thumbprint
func ValidateAndGetVirtualMachineTemplateForTKRVersion ¶
func ValidateAndGetVirtualMachineTemplateForTKRVersion(vcClient Client, tkrVersion string, ovaVersions []string, templateName, dc string, k8sVMTemplates []*tkgtypes.VSphereVirtualMachine) (*tkgtypes.VSphereVirtualMachine, error)
ValidateAndGetVirtualMachineTemplateForTKRVersion gets a virtual machine for the given TKR version and validates it
Types ¶
type Client ¶
type Client interface { // Login authenticates with Virtual Center using user/password Login(ctx context.Context, user, password string) (string, error) // AcquireTicket acquires a new session ticket for the user associated with // the authenticated client. AcquireTicket() (string, error) // CheckUserSessionActive check if a user session is Active CheckUserSessionActive() (bool, error) // GetDatastores returns a list of datastores for the given datacenter GetDatastores(ctx context.Context, datacenterMOID string) ([]*models.VSphereDatastore, error) // GetDatacenters returns a list of all datacenters in the vSphere inventory. GetDatacenters(ctx context.Context) ([]*models.VSphereDatacenter, error) // GetDataCenterMOID returns the MOID of the datacenter GetDataCenterMOID(ctx context.Context, dcName string) (string, error) // GetNetworks returns list of network in the given datacenter GetNetworks(ctx context.Context, datacenterMOID string) ([]*models.VSphereNetwork, error) // GetResourcePools returns list of resource pools in the given datacenter GetResourcePools(ctx context.Context, datacenterMOID string) ([]*models.VSphereResourcePool, error) // GetVSphereVersion returns the vSphere version, and the build number GetVSphereVersion() (string, string, error) // GetVirtualMachine gets vms under given datacenter GetVirtualMachines(ctx context.Context, datacenterMOID string) ([]*models.VSphereVirtualMachine, error) // GetVirtualMachineImages gets vm templates for kubernetes GetVirtualMachineImages(ctx context.Context, datacenterMOID string) ([]*tkgtypes.VSphereVirtualMachine, error) // DetectPacific detects if project pacific is enabled on vSphere DetectPacific(ctx context.Context) (bool, error) // GetFolders gets all folders under a datacenter GetFolders(ctx context.Context, datacenterMOID string) ([]*models.VSphereFolder, error) // GetComputeResources gets resource pools and their ancestors GetComputeResources(ctx context.Context, datacenterMOID string) ([]*models.VSphereManagementObject, error) // FindResourcePool find the vSphere resource pool from path, return moid FindResourcePool(ctx context.Context, path, dcPath string) (string, error) // FindFolder find the vSphere folder from path, return moid FindFolder(ctx context.Context, path, dcPath string) (string, error) // FindVirtualMachine find the vSphere virtual machine from path, return moid FindVirtualMachine(ctx context.Context, path, dcPath string) (string, error) // FindDataCenter find the vSphere datacenter from path, return moid FindDataCenter(ctx context.Context, path string) (string, error) // FindDatastore find the vSphere datastore from path, return moid FindDatastore(ctx context.Context, path, dcPath string) (string, error) // FindNetwork finds the vSphere network from path, return moid FindNetwork(ctx context.Context, path, dcPath string) (string, error) // GetAndValidateVirtualMachineTemplateForK8sVersion validates and returns valid virtual machine template GetAndValidateVirtualMachineTemplate(ovaVersions []string, tkrName string, templateName, dc string, tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter) (*tkgtypes.VSphereVirtualMachine, error) // GetPath returns the full path of a valid vSphere resource GetPath(ctx context.Context, moid string) (string, []*models.VSphereManagementObject, error) }
Client represents a vCenter client
type DefaultClient ¶
type DefaultClient struct {
// contains filtered or unexported fields
}
DefaultClient dafaults vc client
func (*DefaultClient) AcquireTicket ¶
func (c *DefaultClient) AcquireTicket() (string, error)
AcquireTicket acquires a new session ticket for the user associated with the authenticated client.
func (*DefaultClient) CheckUserSessionActive ¶
func (c *DefaultClient) CheckUserSessionActive() (bool, error)
CheckUserSessionActive checks if a user session is Active
func (*DefaultClient) DetectPacific ¶
func (c *DefaultClient) DetectPacific(ctx context.Context) (bool, error)
DetectPacific detects if vcenter is a Pacific cluster
func (*DefaultClient) FindDataCenter ¶
FindDataCenter find the vsphere datacenter from path, return moid
func (*DefaultClient) FindDatastore ¶
FindDatastore find the vsphere datastore from path, return moid
func (*DefaultClient) FindFolder ¶
FindFolder find the vsphere folder from path, return moid
func (*DefaultClient) FindNetwork ¶ added in v0.11.2
FindNetwork finds the vSphere network from path, return moid
func (*DefaultClient) FindResourcePool ¶
FindResourcePool find the vsphere resource pool from path, return moid
func (*DefaultClient) FindVirtualMachine ¶
func (c *DefaultClient) FindVirtualMachine(ctx context.Context, path, dcPath string) (string, error)
FindVirtualMachine find the vsphere virtual machine from path, return moid
func (*DefaultClient) GetAndValidateVirtualMachineTemplate ¶
func (c *DefaultClient) GetAndValidateVirtualMachineTemplate( ovaVersions []string, tkrVersion string, templateName, dc string, tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter) (*tkgtypes.VSphereVirtualMachine, error)
GetAndValidateVirtualMachineTemplate gets the vm template for specified k8s version if not provided if provided, it validates the k8s version
func (*DefaultClient) GetComputeResources ¶
func (c *DefaultClient) GetComputeResources(ctx context.Context, datacenterMOID string) ([]*models.VSphereManagementObject, error)
GetComputeResources gets resource pools and their ancestors
func (*DefaultClient) GetDataCenterMOID ¶
GetDataCenterMOID return the MOID of the data center
func (*DefaultClient) GetDatacenters ¶
func (c *DefaultClient) GetDatacenters(ctx context.Context) ([]*models.VSphereDatacenter, error)
GetDatacenters returns a list of all datacenters in the vSphere inventory.
func (*DefaultClient) GetDatastores ¶
func (c *DefaultClient) GetDatastores(ctx context.Context, datacenterMOID string) ([]*models.VSphereDatastore, error)
GetDatastores returns a list of Datastores for the given datacenter
func (*DefaultClient) GetFolders ¶
func (c *DefaultClient) GetFolders(ctx context.Context, datacenterMOID string) ([]*models.VSphereFolder, error)
GetFolders gets all folders under a datacenter
func (*DefaultClient) GetNetworks ¶
func (c *DefaultClient) GetNetworks(ctx context.Context, datacenterMOID string) ([]*models.VSphereNetwork, error)
GetNetworks gets list of network for the given datacenter
func (*DefaultClient) GetPath ¶ added in v0.11.2
func (c *DefaultClient) GetPath(ctx context.Context, moid string) (string, []*models.VSphereManagementObject, error)
GetPath takes in the MOID of a vsphere resource and returns a fully qualified path
func (*DefaultClient) GetResourcePools ¶
func (c *DefaultClient) GetResourcePools(ctx context.Context, datacenterMOID string) ([]*models.VSphereResourcePool, error)
GetResourcePools gets resourcepools for the given datacenter
func (*DefaultClient) GetVSphereVersion ¶
func (c *DefaultClient) GetVSphereVersion() (string, string, error)
GetVSphereVersion returns the vSphere version, and the build number
func (*DefaultClient) GetVirtualMachineImages ¶
func (c *DefaultClient) GetVirtualMachineImages(ctx context.Context, datacenterMOID string) ([]*tkgtypes.VSphereVirtualMachine, error)
GetVirtualMachineImages gets vm templates for kubernetes
func (*DefaultClient) GetVirtualMachines ¶
func (c *DefaultClient) GetVirtualMachines(ctx context.Context, datacenterMOID string) ([]*models.VSphereVirtualMachine, error)
GetVirtualMachines gets vms under given datacenter