Documentation ¶
Index ¶
- Constants
- func Bootstrap(fw *framework.Framework)
- func Connect(ctx context.Context, vs *VSphere) error
- 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(f *framework.Framework, client clientset.Interface, namespace string, ...)
- func VolumeCreateAndAttach(client clientset.Interface, namespace string, sc []*storageV1.StorageClass, ...)
- type Config
- type ConfigFile
- 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 VSphereContext
- type VolumeOptions
Constants ¶
const ( DatacenterType = "Datacenter" ClusterComputeResourceType = "ClusterComputeResource" HostSystemType = "HostSystem" )
const ( VolDir = "kubevols" DefaultDiskCapacityKB = 2097152 DefaultDiskFormat = "thin" DefaultSCSIControllerType = "lsiLogic" VirtualMachineType = "VirtualMachine" )
const ( SPBMPolicyName = "VSPHERE_SPBM_POLICY_NAME" StorageClassDatastoreName = "VSPHERE_DATASTORE" KubernetesClusterName = "VSPHERE_KUBERNETES_CLUSTER" SPBMTagPolicy = "VSPHERE_SPBM_TAG_POLICY" )
const ( VCPClusterDatastore = "CLUSTER_DATASTORE" SPBMPolicyDataStoreCluster = "VSPHERE_SPBM_POLICY_DS_CLUSTER" )
const ( VCPScaleVolumeCount = "VCP_SCALE_VOLUME_COUNT" VCPScaleVolumesPerPod = "VCP_SCALE_VOLUME_PER_POD" VCPScaleInstances = "VCP_SCALE_INSTANCES" )
const ( VCPStressInstances = "VCP_STRESS_INSTANCES" VCPStressIterations = "VCP_STRESS_ITERATIONS" )
const ( VCPPerfVolumeCount = "VCP_PERF_VOLUME_COUNT" VCPPerfVolumesPerPod = "VCP_PERF_VOLUME_PER_POD" VCPPerfIterations = "VCP_PERF_ITERATIONS" )
const ( VCPZoneVsanDatastore1 = "VCP_ZONE_VSANDATASTORE1" VCPZoneVsanDatastore2 = "VCP_ZONE_VSANDATASTORE2" 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" )
const ( DummyDiskName = "kube-dummyDisk.vmdk" ProviderPrefix = "vsphere://" )
const ( InvalidDatastore = "invalidDatastore" DatastoreSCName = "datastoresc" )
const ( Ext4FSType = "ext4" Ext3FSType = "ext3" InvalidFSType = "ext10" ExecCommand = "/bin/df -T /mnt/volume1 | /bin/awk 'FNR == 2 {print $2}' > /mnt/volume1/fstype && while true ; do sleep 2 ; done" )
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 ( VmfsDatastore = "sharedVmfs-0" VsanDatastore = "vsanDatastore" Datastore = "datastore" Policy_DiskStripes = "diskStripes" Policy_HostFailuresToTolerate = "hostFailuresToTolerate" Policy_CacheReservation = "cacheReservation" Policy_ObjectSpaceReservation = "objectSpaceReservation" Policy_IopsLimit = "iopsLimit" DiskFormat = "diskformat" ThinDisk = "thin" SpbmStoragePolicy = "storagepolicyname" BronzeStoragePolicy = "bronze" HostFailuresToTolerateCapabilityVal = "0" CacheReservationCapabilityVal = "20" DiskStripesCapabilityVal = "1" ObjectSpaceReservationCapabilityVal = "30" IopsLimitCapabilityVal = "100" StripeWidthCapabilityVal = "2" DiskStripesCapabilityInvalidVal = "14" HostFailuresToTolerateCapabilityInvalidVal = "4" DummyVMPrefixName = "vsphere-k8s" DiskStripesCapabilityMaxVal = "11" )
const (
DiskSizeSCName = "disksizesc"
)
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.
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 GetAndExpectIntEnvVar ¶
func GetVSphereInstances ¶
GetVSphereInstances parses vsphere.conf and returns VSphere instances
func PerformVolumeLifeCycleInParallel ¶
func PerformVolumeLifeCycleInParallel(f *framework.Framework, client clientset.Interface, namespace string, instanceId string, sc *storageV1.StorageClass, iterations int, wg *sync.WaitGroup)
goroutine to perform volume lifecycle operations in parallel
func VolumeCreateAndAttach ¶
func VolumeCreateAndAttach(client clientset.Interface, 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"` } }
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 NodeInfo ¶
type NodeInfo struct { Name string DataCenterRef types.ManagedObjectReference VirtualMachineRef types.ManagedObjectReference HostSystemRef types.ManagedObjectReference VSphere *VSphere Zones []string }
func GetReadySchedulableNodeInfos ¶
func GetReadySchedulableNodeInfos() []*NodeInfo
GetAllReadySchedulableNodeInfos returns NodeInfo objects for all nodes with Ready and schedulable state
func GetReadySchedulableRandomNodeInfo ¶
func GetReadySchedulableRandomNodeInfo() *NodeInfo
GetReadySchedulableRandomNodeInfo returns NodeInfo object for one of the Ready and Schedulable Node. if multiple nodes are present with Ready and Scheduable state then one of the Node is selected randomly and it's associated NodeInfo object is returned.
type NodeMapper ¶
type NodeMapper struct { }
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
Generate zone to datastore mapping for easily verifying volume placement
func (*NodeMapper) GetDatastoresInZone ¶ added in v1.14.0
func (nm *NodeMapper) GetDatastoresInZone(vc string, zone string) []string
Get all the datastores in the specified zone
func (*NodeMapper) GetNodeInfo ¶
func (nm *NodeMapper) GetNodeInfo(nodeName string) *NodeInfo
GetNodeInfo return 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 ¶
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
GetDatacenter returns the DataCenter Object for the given datacenterPath
func (*VSphere) GetDatastoreRefFromName ¶ added in v1.14.0
func (vs *VSphere) GetDatastoreRefFromName(ctx context.Context, dc object.Reference, datastoreName string) (types.ManagedObjectReference, error)
Get 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
Get 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
Get 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 gets 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.
type VSphereContext ¶
type VSphereContext struct { NodeMapper *NodeMapper VSphereInstances map[string]*VSphere }
Context holds common information for vSphere tests
var TestContext VSphereContext
TestContext should be used by all tests to access common context data. It should be initialized only once, during bootstrapping the tests.
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