volume

package
Version: v1.22.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 18 Imported by: 12

Documentation

Index

Constants

View Source
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
)

Variables

This section is empty.

Functions

func CheckVolumeModeOfPath added in v1.21.0

func CheckVolumeModeOfPath(f *framework.Framework, pod *v1.Pod, volMode v1.PersistentVolumeMode, path string)

CheckVolumeModeOfPath check mode of volume

func CreateStorageServer

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 GenerateReadFileCmd

func GenerateReadFileCmd(fullPath string) []string

GenerateReadFileCmd generates the corresponding command lines to read from a file with the given file path.

func InjectContent added in v1.16.0

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 PodExec added in v1.21.0

func PodExec(f *framework.Framework, pod *v1.Pod, shExec string) (string, string, error)

PodExec runs f.ExecCommandInContainerWithFullOutput to execute a shell cmd in target pod TODO: put this under e2epod once https://github.com/kubernetes/kubernetes/issues/81245 is resolved. Otherwise there will be dependency issue.

func TestServerCleanup added in v1.18.0

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

TestServerCleanup cleans server pod.

func TestVolumeClient

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 added in v1.18.0

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.

func VerifyExecInPodFail added in v1.21.0

func VerifyExecInPodFail(f *framework.Framework, pod *v1.Pod, shExec string, exitCode int)

VerifyExecInPodFail verifies shell cmd in target pod fail with certain exit code TODO: put this under e2epod once https://github.com/kubernetes/kubernetes/issues/81245 is resolved. Otherwise there will be dependency issue.

func VerifyExecInPodSucceed added in v1.21.0

func VerifyExecInPodSucceed(f *framework.Framework, pod *v1.Pod, shExec string)

VerifyExecInPodSucceed verifies shell cmd in target pod succeed TODO: put this under e2epod once https://github.com/kubernetes/kubernetes/issues/81245 is resolved. Otherwise there will be dependency issue.

Types

type SizeRange added in v1.17.0

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

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

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

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

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

NewNFSServer is a NFS-specific wrapper for CreateStorageServer.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL