Documentation ¶
Index ¶
- Constants
- func Bootstrap(fw *framework.Framework)
- func Connect(ctx context.Context, vs *VSphere) error
- func GetAndExpectBoolEnvVar(varName string) bool
- func GetAndExpectIntEnvVar(varName string) int
- func GetAndExpectStringEnvVar(varName string) string
- func GetVSphereInstances() (map[string]*VSphere, error)
- func NewClient(ctx context.Context, vs *VSphere) (*govmomi.Client, error)
- func PerformVolumeLifeCycleInParallel(ctx context.Context, f *framework.Framework, client clientset.Interface, ...)
- func VolumeCreateAndAttach(ctx context.Context, client clientset.Interface, ...)
- type Config
- type ConfigFile
- type Context
- type NodeInfo
- type NodeMapper
- func (nm *NodeMapper) GenerateNodeMap(vSphereInstances map[string]*VSphere, nodeList v1.NodeList) error
- func (nm *NodeMapper) GenerateZoneToDatastoreMap() error
- func (nm *NodeMapper) GetDatastoresInZone(vc string, zone string) []string
- func (nm *NodeMapper) GetNodeInfo(nodeName string) *NodeInfo
- func (nm *NodeMapper) SetNodeInfo(nodeName string, nodeInfo *NodeInfo)
- type NodeSelector
- type VSphere
- func (vs *VSphere) CreateVolume(volumeOptions *VolumeOptions, dataCenterRef types.ManagedObjectReference) (string, error)
- func (vs *VSphere) DeleteVolume(volumePath string, dataCenterRef types.ManagedObjectReference) error
- func (vs *VSphere) GetAllDatacenter(ctx context.Context) ([]*object.Datacenter, error)
- func (vs *VSphere) GetDatacenter(ctx context.Context, datacenterPath string) (*object.Datacenter, error)
- func (vs *VSphere) GetDatacenterFromObjectReference(ctx context.Context, dc object.Reference) *object.Datacenter
- func (vs *VSphere) GetDatastoreRefFromName(ctx context.Context, dc object.Reference, datastoreName string) (types.ManagedObjectReference, error)
- func (vs *VSphere) GetDatastoresMountedOnHost(ctx context.Context, host types.ManagedObjectReference) []types.ManagedObjectReference
- func (vs *VSphere) GetFolderByPath(ctx context.Context, dc object.Reference, folderPath string) (vmFolderMor types.ManagedObjectReference, err error)
- func (vs *VSphere) GetHostFromVMReference(ctx context.Context, vm types.ManagedObjectReference) types.ManagedObjectReference
- func (vs *VSphere) GetVMByUUID(ctx context.Context, vmUUID string, dc object.Reference) (object.Reference, error)
- func (vs *VSphere) IsVMPresent(vmName string, dataCenterRef types.ManagedObjectReference) (isVMPresent bool, err error)
- type VolumeOptions
Constants ¶
const ( SPBMPolicyName = "VSPHERE_SPBM_POLICY_NAME" StorageClassDatastoreName = "VSPHERE_DATASTORE" KubernetesClusterName = "VSPHERE_KUBERNETES_CLUSTER" SPBMTagPolicy = "VSPHERE_SPBM_TAG_POLICY" VCPClusterDatastore = "CLUSTER_DATASTORE" SPBMPolicyDataStoreCluster = "VSPHERE_SPBM_POLICY_DS_CLUSTER" )
environment variables related to datastore parameters
const ( VCPScaleVolumeCount = "VCP_SCALE_VOLUME_COUNT" VCPScaleVolumesPerPod = "VCP_SCALE_VOLUME_PER_POD" VCPScaleInstances = "VCP_SCALE_INSTANCES" )
environment variables used for scaling tests
const ( VCPStressInstances = "VCP_STRESS_INSTANCES" VCPStressIterations = "VCP_STRESS_ITERATIONS" )
environment variables used for stress tests
const ( VCPPerfVolumeCount = "VCP_PERF_VOLUME_COUNT" VCPPerfVolumesPerPod = "VCP_PERF_VOLUME_PER_POD" VCPPerfIterations = "VCP_PERF_ITERATIONS" )
environment variables used for performance tests
const ( VCPZoneVsanDatastore1 = "VCP_ZONE_VSANDATASTORE1" VCPZoneVsanDatastore2 = "VCP_ZONE_VSANDATASTORE2" VCPZoneLocalDatastore = "VCP_ZONE_LOCALDATASTORE" VCPZoneCompatPolicyName = "VCP_ZONE_COMPATPOLICY_NAME" VCPZoneNonCompatPolicyName = "VCP_ZONE_NONCOMPATPOLICY_NAME" VCPZoneA = "VCP_ZONE_A" VCPZoneB = "VCP_ZONE_B" VCPZoneC = "VCP_ZONE_C" VCPZoneD = "VCP_ZONE_D" VCPInvalidZone = "VCP_INVALID_ZONE" )
environment variables used for zone tests
const ( Datastore = "datastore" PolicyDiskStripes = "diskStripes" PolicyHostFailuresToTolerate = "hostFailuresToTolerate" PolicyCacheReservation = "cacheReservation" PolicyObjectSpaceReservation = "objectSpaceReservation" PolicyIopsLimit = "iopsLimit" DiskFormat = "diskformat" SpbmStoragePolicy = "storagepolicyname" )
storage class parameters
const ( ThinDisk = "thin" BronzeStoragePolicy = "bronze" HostFailuresToTolerateCapabilityVal = "0" CacheReservationCapabilityVal = "20" DiskStripesCapabilityVal = "1" ObjectSpaceReservationCapabilityVal = "30" IopsLimitCapabilityVal = "100" StripeWidthCapabilityVal = "2" DiskStripesCapabilityInvalidVal = "14" HostFailuresToTolerateCapabilityInvalidVal = "4" )
test values for storage class parameters
const ( SCSIUnitsAvailablePerNode = 55 CreateOp = "CreateOp" AttachOp = "AttachOp" DetachOp = "DetachOp" DeleteOp = "DeleteOp" )
This test calculates latency numbers for volume lifecycle operations
1. Create 4 type of storage classes 2. Read the total number of volumes to be created and volumes per pod 3. Create total PVCs (number of volumes) 4. Create Pods with attached volumes per pod 5. Verify access to the volumes 6. Delete pods and wait for volumes to detach 7. Delete the PVCs
const (
NodeLabelKey = "vsphere_e2e_label"
)
Perform vsphere volume life cycle management at scale based on user configurable value for number of volumes. The following actions will be performed as part of this test.
1. Create Storage Classes of 4 Categories (Default, SC with Non Default Datastore, SC with SPBM Policy, SC with VSAN Storage Capabilities.) 2. Read VCP_SCALE_VOLUME_COUNT, VCP_SCALE_INSTANCES, VCP_SCALE_VOLUMES_PER_POD, VSPHERE_SPBM_POLICY_NAME, VSPHERE_DATASTORE from System Environment. 3. Launch VCP_SCALE_INSTANCES goroutine for creating VCP_SCALE_VOLUME_COUNT volumes. Each goroutine is responsible for create/attach of VCP_SCALE_VOLUME_COUNT/VCP_SCALE_INSTANCES volumes. 4. Read VCP_SCALE_VOLUMES_PER_POD from System Environment. Each pod will be have VCP_SCALE_VOLUMES_PER_POD attached to it. 5. Once all the go routines are completed, we delete all the pods and volumes.
const VSphereCSIMigrationEnabled = "VSPHERE_CSI_MIGRATION_ENABLED"
VSphereCSIMigrationEnabled is the environment variables to help determine test verification flow.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect makes connection to vSphere No actions are taken if a connection exists and alive. Otherwise, a new client will be created.
func GetAndExpectBoolEnvVar ¶ added in v1.19.0
GetAndExpectBoolEnvVar returns the bool value of an environment variable if environment variable is not set return false
func GetAndExpectIntEnvVar ¶
GetAndExpectIntEnvVar returns the integer value of an environment variable or fails if the variable is not set
func GetAndExpectStringEnvVar ¶
GetAndExpectStringEnvVar returns the string value of an environment variable or fails if the variable is not set
func GetVSphereInstances ¶
GetVSphereInstances parses vsphere.conf and returns VSphere instances
func PerformVolumeLifeCycleInParallel ¶
func PerformVolumeLifeCycleInParallel(ctx context.Context, f *framework.Framework, client clientset.Interface, namespace string, instanceID string, sc *storagev1.StorageClass, iterations int, wg *sync.WaitGroup)
PerformVolumeLifeCycleInParallel performs volume lifecycle operations Called as a go routine to perform operations in parallel
func VolumeCreateAndAttach ¶
func VolumeCreateAndAttach(ctx context.Context, client clientset.Interface, timeouts *framework.TimeoutContext, namespace string, sc []*storagev1.StorageClass, volumeCountPerInstance int, volumesPerPod int, nodeSelectorList []*NodeSelector, nodeVolumeMapChan chan map[string][]string)
VolumeCreateAndAttach peforms create and attach operations of vSphere persistent volumes at scale
Types ¶
type Config ¶
type Config struct { Username string Password string Hostname string Port string Datacenters string RoundTripperCount uint DefaultDatastore string Folder string }
Config represents vSphere configuration
type ConfigFile ¶
type ConfigFile struct { Global struct { // vCenter username. User string `gcfg:"user"` // vCenter password in clear text. Password string `gcfg:"password"` // vCenter port. VCenterPort string `gcfg:"port"` // True if vCenter uses self-signed cert. InsecureFlag bool `gcfg:"insecure-flag"` // Datacenter in which VMs are located. Datacenters string `gcfg:"datacenters"` // Soap round tripper count (retries = RoundTripper - 1) RoundTripperCount uint `gcfg:"soap-roundtrip-count"` } VirtualCenter map[string]*Config Network struct { // PublicNetwork is name of the network the VMs are joined to. PublicNetwork string `gcfg:"public-network"` } Disk struct { // SCSIControllerType defines SCSI controller to be used. SCSIControllerType string `dcfg:"scsicontrollertype"` } // Endpoint used to create volumes Workspace struct { VCenterIP string `gcfg:"server"` Datacenter string `gcfg:"datacenter"` Folder string `gcfg:"folder"` DefaultDatastore string `gcfg:"default-datastore"` ResourcePoolPath string `gcfg:"resourcepool-path"` } // Tag categories and tags which correspond to "built-in node labels: zones and region" Labels struct { Zone string `gcfg:"zone"` Region string `gcfg:"region"` } }
ConfigFile represents the content of vsphere.conf file. Users specify the configuration of one or more vSphere instances in vsphere.conf where the Kubernetes master and worker nodes are running.
type Context ¶ added in v1.18.0
type Context struct { NodeMapper *NodeMapper VSphereInstances map[string]*VSphere }
Context holds common information for vSphere tests
var TestContext Context
TestContext should be used by all tests to access common context data. It should be initialized only once, during bootstrapping the tests.
type NodeInfo ¶
type NodeInfo struct { Name string DataCenterRef types.ManagedObjectReference VirtualMachineRef types.ManagedObjectReference HostSystemRef types.ManagedObjectReference VSphere *VSphere Zones []string }
NodeInfo contains information about vcenter nodes
func GetReadySchedulableNodeInfos ¶
GetReadySchedulableNodeInfos returns NodeInfo objects for all nodes with Ready and schedulable state
func GetReadySchedulableRandomNodeInfo ¶
GetReadySchedulableRandomNodeInfo returns NodeInfo object for one of the Ready and Schedulable Node. if multiple nodes are present with Ready and Schedulable state then one of the Node is selected randomly and it's associated NodeInfo object is returned.
type NodeMapper ¶
type NodeMapper struct {
// contains filtered or unexported fields
}
NodeMapper contains information to generate nameToNodeInfo and vcToZoneDatastore maps
func NewNodeMapper ¶ added in v1.27.6
func NewNodeMapper() *NodeMapper
NewNodeMapper returns a new NodeMapper
func (*NodeMapper) GenerateNodeMap ¶
func (nm *NodeMapper) GenerateNodeMap(vSphereInstances map[string]*VSphere, nodeList v1.NodeList) error
GenerateNodeMap populates node name to node info map
func (*NodeMapper) GenerateZoneToDatastoreMap ¶ added in v1.14.0
func (nm *NodeMapper) GenerateZoneToDatastoreMap() error
GenerateZoneToDatastoreMap generates a mapping of zone to datastore for easily verifying volume placement
func (*NodeMapper) GetDatastoresInZone ¶ added in v1.14.0
func (nm *NodeMapper) GetDatastoresInZone(vc string, zone string) []string
GetDatastoresInZone returns all the datastores in the specified zone
func (*NodeMapper) GetNodeInfo ¶
func (nm *NodeMapper) GetNodeInfo(nodeName string) *NodeInfo
GetNodeInfo returns NodeInfo for given nodeName
func (*NodeMapper) SetNodeInfo ¶
func (nm *NodeMapper) SetNodeInfo(nodeName string, nodeInfo *NodeInfo)
SetNodeInfo sets NodeInfo for given nodeName. This function is not thread safe. Users need to handle concurrency.
type NodeSelector ¶
type NodeSelector struct {
// contains filtered or unexported fields
}
NodeSelector holds
type VSphere ¶
VSphere represents a vSphere instance where one or more kubernetes nodes are running.
func (*VSphere) CreateVolume ¶
func (vs *VSphere) CreateVolume(volumeOptions *VolumeOptions, dataCenterRef types.ManagedObjectReference) (string, error)
CreateVolume creates a vsphere volume using given volume parameters specified in VolumeOptions. If volume is created successfully the canonical disk path is returned else error is returned.
func (*VSphere) DeleteVolume ¶
func (vs *VSphere) DeleteVolume(volumePath string, dataCenterRef types.ManagedObjectReference) error
DeleteVolume deletes the vmdk file specified in the volumePath. if an error is encountered while deleting volume, error is returned.
func (*VSphere) GetAllDatacenter ¶
GetAllDatacenter returns all the DataCenter Objects
func (*VSphere) GetDatacenter ¶
func (vs *VSphere) GetDatacenter(ctx context.Context, datacenterPath string) (*object.Datacenter, error)
GetDatacenter returns the DataCenter Object for the given datacenterPath
func (*VSphere) GetDatacenterFromObjectReference ¶
func (vs *VSphere) GetDatacenterFromObjectReference(ctx context.Context, dc object.Reference) *object.Datacenter
GetDatacenterFromObjectReference returns the DataCenter Object for the given datacenter reference
func (*VSphere) GetDatastoreRefFromName ¶ added in v1.14.0
func (vs *VSphere) GetDatastoreRefFromName(ctx context.Context, dc object.Reference, datastoreName string) (types.ManagedObjectReference, error)
GetDatastoreRefFromName returns the datastore reference of the specified datastore
func (*VSphere) GetDatastoresMountedOnHost ¶ added in v1.14.0
func (vs *VSphere) GetDatastoresMountedOnHost(ctx context.Context, host types.ManagedObjectReference) []types.ManagedObjectReference
GetDatastoresMountedOnHost returns the datastore references of all the datastores mounted on the specified host
func (*VSphere) GetFolderByPath ¶
func (vs *VSphere) GetFolderByPath(ctx context.Context, dc object.Reference, folderPath string) (vmFolderMor types.ManagedObjectReference, err error)
GetFolderByPath gets the Folder Object Reference from the given folder path folderPath should be the full path to folder
func (*VSphere) GetHostFromVMReference ¶ added in v1.14.0
func (vs *VSphere) GetHostFromVMReference(ctx context.Context, vm types.ManagedObjectReference) types.ManagedObjectReference
GetHostFromVMReference returns host object reference of the host on which the specified VM resides
func (*VSphere) GetVMByUUID ¶
func (vs *VSphere) GetVMByUUID(ctx context.Context, vmUUID string, dc object.Reference) (object.Reference, error)
GetVMByUUID returns the VM object Reference from the given vmUUID
func (*VSphere) IsVMPresent ¶
func (vs *VSphere) IsVMPresent(vmName string, dataCenterRef types.ManagedObjectReference) (isVMPresent bool, err error)
IsVMPresent checks if VM with the name specified in the vmName argument, is present in the vCenter inventory. if VM is present, function returns true else false.
Source Files ¶
- bootstrap.go
- config.go
- connection.go
- context.go
- nodemapper.go
- persistent_volumes-vsphere.go
- pv_reclaimpolicy.go
- pvc_label_selector.go
- vsphere.go
- vsphere_common.go
- vsphere_scale.go
- vsphere_statefulsets.go
- vsphere_stress.go
- vsphere_utils.go
- vsphere_volume_cluster_ds.go
- vsphere_volume_datastore.go
- vsphere_volume_diskformat.go
- vsphere_volume_disksize.go
- vsphere_volume_fstype.go
- vsphere_volume_master_restart.go
- vsphere_volume_node_delete.go
- vsphere_volume_node_poweroff.go
- vsphere_volume_ops_storm.go
- vsphere_volume_perf.go
- vsphere_volume_placement.go
- vsphere_volume_vpxd_restart.go
- vsphere_volume_vsan_policy.go
- vsphere_zone_support.go