kubernetes: k8s.io/kubernetes/test/e2e/framework/volume Index | Files

package volume

import "k8s.io/kubernetes/test/e2e/framework/volume"

Index

Package Files

fixtures.go

Constants

const (
    // Kb is byte size of kilobyte
    Kb  int64 = 1000
    // Mb is byte size of megabyte
    Mb  int64 = 1000 * Kb
    // Gb is byte size of gigabyte
    Gb  int64 = 1000 * Mb
    // Tb is byte size of terabyte
    Tb  int64 = 1000 * Gb
    // KiB is byte size of kibibyte
    KiB int64 = 1024
    // MiB is byte size of mebibyte
    MiB int64 = 1024 * KiB
    // GiB is byte size of gibibyte
    GiB int64 = 1024 * MiB
    // TiB is byte size of tebibyte
    TiB int64 = 1024 * GiB

    // VolumeServerPodStartupTimeout is a waiting period for volume server (Ceph, ...) to initialize itself.
    VolumeServerPodStartupTimeout = 3 * time.Minute

    // PodCleanupTimeout is a waiting period for pod to be cleaned up and unmount its volumes so we
    // don't tear down containers with NFS/Ceph/Gluster server too early.
    PodCleanupTimeout = 20 * time.Second
)

func CreateStorageServer Uses

func CreateStorageServer(cs clientset.Interface, config TestConfig) (pod *v1.Pod, ip string)

CreateStorageServer is a wrapper for startVolumeServer(). A storage server config is passed in, and a pod pointer and ip address string are returned. Note: Expect() is called so no error is returned.

func GeneratePodSecurityContext Uses

func GeneratePodSecurityContext(fsGroup *int64, seLinuxOptions *v1.SELinuxOptions) *v1.PodSecurityContext

GeneratePodSecurityContext generates the corresponding pod security context with the given inputs If the Node OS is windows, currently we will ignore the inputs and return nil. TODO: Will modify it after windows has its own security context

func GenerateScriptCmd Uses

func GenerateScriptCmd(command string) []string

GenerateScriptCmd generates the corresponding command lines to execute a command. Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh

func GenerateSecurityContext Uses

func GenerateSecurityContext(privileged bool) *v1.SecurityContext

GenerateSecurityContext generates the corresponding container security context with the given inputs If the Node OS is windows, currently we will ignore the inputs and return nil. TODO: Will modify it after windows has its own security context

func GetTestImage Uses

func GetTestImage(image string) string

GetTestImage returns the image name with the given input If the Node OS is windows, currently we return Agnhost image for Windows node due to the issue of #https://github.com/kubernetes-sigs/windows-testing/pull/35.

func InjectContent Uses

func InjectContent(f *framework.Framework, config TestConfig, fsGroup *int64, fsType string, tests []Test)

InjectContent inserts index.html with given content into given volume. It does so by starting and auxiliary pod which writes the file there. The volume must be writable.

func TestServerCleanup Uses

func TestServerCleanup(f *framework.Framework, config TestConfig)

TestServerCleanup cleans server pod.

func TestVolumeClient Uses

func TestVolumeClient(f *framework.Framework, config TestConfig, fsGroup *int64, fsType string, tests []Test)

TestVolumeClient start a client pod using given VolumeSource (exported by startVolumeServer()) and check that the pod sees expected data, e.g. from the server pod. Multiple Tests can be specified to mount multiple volumes to a single pod. Timeout for dynamic provisioning (if "WaitForFirstConsumer" is set && provided PVC is not bound yet), pod creation, scheduling and complete pod startup (incl. volume attach & mount) is pod.podStartTimeout. It should be used for cases where "regular" dynamic provisioning of an empty volume is requested.

func TestVolumeClientSlow Uses

func TestVolumeClientSlow(f *framework.Framework, config TestConfig, fsGroup *int64, fsType string, tests []Test)

TestVolumeClientSlow is the same as TestVolumeClient except for its timeout. Timeout for dynamic provisioning (if "WaitForFirstConsumer" is set && provided PVC is not bound yet), pod creation, scheduling and complete pod startup (incl. volume attach & mount) is pod.slowPodStartTimeout. It should be used for cases where "special" dynamic provisioning is requested, such as volume cloning or snapshot restore.

type SizeRange Uses

type SizeRange struct {
    // Max quantity specified as a string including units. E.g "3Gi".
    // If the Max size is unset, It will be assign a default valid maximum size 10Ei,
    // which is defined in test/e2e/storage/testsuites/base.go
    Max string
    // Min quantity specified as a string including units. E.g "1Gi"
    // If the Min size is unset, It will be assign a default valid minimum size 1Ki,
    // which is defined in test/e2e/storage/testsuites/base.go
    Min string
}

SizeRange encapsulates a range of sizes specified as minimum and maximum quantity strings Both values are optional. If size is not set, it will assume there's not limitation and it may set a very small size (E.g. 1ki) as Min and set a considerable big size(E.g. 10Ei) as Max, which make it possible to calculate the intersection of given intervals (if it exists)

type Test Uses

type Test struct {
    Volume v1.VolumeSource
    Mode   v1.PersistentVolumeMode
    // Name of file to read/write in FileSystem mode
    File            string
    ExpectedContent string
}

Test contains a volume to mount into a client pod and its expected content.

type TestConfig Uses

type TestConfig struct {
    Namespace string
    // Prefix of all pods. Typically the test name.
    Prefix string
    // Name of container image for the server pod.
    ServerImage string
    // Ports to export from the server pod. TCP only.
    ServerPorts []int
    // Commands to run in the container image.
    ServerCmds []string
    // Arguments to pass to the container image.
    ServerArgs []string
    // Volumes needed to be mounted to the server container from the host
    // map <host (source) path> -> <container (dst.) path>
    // if <host (source) path> is empty, mount a tmpfs emptydir
    ServerVolumes map[string]string
    // Message to wait for before starting clients
    ServerReadyMessage string
    // Use HostNetwork for the server
    ServerHostNetwork bool
    // Wait for the pod to terminate successfully
    // False indicates that the pod is long running
    WaitForCompletion bool
    // ClientNodeSelection restricts where the client pod runs on.  Default is any node.
    ClientNodeSelection e2epod.NodeSelection
}

TestConfig is a struct for configuration of one tests. The test consist of: - server pod - runs serverImage, exports ports[] - client pod - does not need any special configuration

func NewGlusterfsServer Uses

func NewGlusterfsServer(cs clientset.Interface, namespace string) (config TestConfig, pod *v1.Pod, ip string)

NewGlusterfsServer is a GlusterFS-specific wrapper for CreateStorageServer. Also creates the gluster endpoints object.

func NewNFSServer Uses

func NewNFSServer(cs clientset.Interface, namespace string, args []string) (config TestConfig, pod *v1.Pod, host string)

NewNFSServer is a NFS-specific wrapper for CreateStorageServer.

Package volume imports 17 packages (graph) and is imported by 161 packages. Updated 2020-05-28. Refresh now. Tools for package owners.