kubernetes: k8s.io/kubernetes/test/e2e/storage/vsphere Index | Files

package vsphere

import "k8s.io/kubernetes/test/e2e/storage/vsphere"

Index

Package 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

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"
    SecondSharedDatastore     = "VSPHERE_SECOND_SHARED_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.

func Bootstrap Uses

func Bootstrap(fw *framework.Framework)

Bootstrap takes care of initializing necessary test context for vSphere tests

func Connect Uses

func Connect(ctx context.Context, vs *VSphere) error

Connect makes connection to vSphere No actions are taken if a connection exists and alive. Otherwise, a new client will be created.

func GetAndExpectIntEnvVar Uses

func GetAndExpectIntEnvVar(varName string) int

func GetAndExpectStringEnvVar Uses

func GetAndExpectStringEnvVar(varName string) string

func GetVSphereInstances Uses

func GetVSphereInstances() (map[string]*VSphere, error)

GetVSphereInstances parses vsphere.conf and returns VSphere instances

func NewClient Uses

func NewClient(ctx context.Context, vs *VSphere) (*govmomi.Client, error)

NewClient creates a new client for vSphere connection

func PerformVolumeLifeCycleInParallel Uses

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 Uses

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

type Config Uses

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 Uses

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 Uses

type NodeInfo struct {
    Name              string
    DataCenterRef     types.ManagedObjectReference
    VirtualMachineRef types.ManagedObjectReference
    HostSystemRef     types.ManagedObjectReference
    VSphere           *VSphere
    Zones             []string
}

func GetReadySchedulableNodeInfos Uses

func GetReadySchedulableNodeInfos() []*NodeInfo

GetAllReadySchedulableNodeInfos returns NodeInfo objects for all nodes with Ready and schedulable state

func GetReadySchedulableRandomNodeInfo Uses

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 Uses

type NodeMapper struct {
}

func (*NodeMapper) GenerateNodeMap Uses

func (nm *NodeMapper) GenerateNodeMap(vSphereInstances map[string]*VSphere, nodeList v1.NodeList) error

GenerateNodeMap populates node name to node info map

func (*NodeMapper) GenerateZoneToDatastoreMap Uses

func (nm *NodeMapper) GenerateZoneToDatastoreMap() error

Generate zone to datastore mapping for easily verifying volume placement

func (*NodeMapper) GetDatastoresInZone Uses

func (nm *NodeMapper) GetDatastoresInZone(vc string, zone string) []string

Get all the datastores in the specified zone

func (*NodeMapper) GetNodeInfo Uses

func (nm *NodeMapper) GetNodeInfo(nodeName string) *NodeInfo

GetNodeInfo return NodeInfo for given nodeName

func (*NodeMapper) SetNodeInfo Uses

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 Uses

type NodeSelector struct {
    // contains filtered or unexported fields
}

NodeSelector holds

type VSphere Uses

type VSphere struct {
    Config *Config
    Client *govmomi.Client
}

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

func (*VSphere) CreateVolume Uses

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 Uses

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 Uses

func (vs *VSphere) GetAllDatacenter(ctx context.Context) ([]*object.Datacenter, error)

GetAllDatacenter returns all the DataCenter Objects

func (*VSphere) GetDatacenter Uses

func (vs *VSphere) GetDatacenter(ctx context.Context, datacenterPath string) (*object.Datacenter, error)

GetDatacenter returns the DataCenter Object for the given datacenterPath

func (*VSphere) GetDatacenterFromObjectReference Uses

func (vs *VSphere) GetDatacenterFromObjectReference(ctx context.Context, dc object.Reference) *object.Datacenter

GetDatacenter returns the DataCenter Object for the given datacenterPath

func (*VSphere) GetDatastoreRefFromName Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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.

type VolumeOptions Uses

type VolumeOptions struct {
    Name               string
    CapacityKB         int
    DiskFormat         string
    SCSIControllerType string
    Datastore          string
}

VolumeOptions specifies various options for a volume.

Package vsphere imports 49 packages (graph) and is imported by 30 packages. Updated 2019-11-12. Refresh now. Tools for package owners.