volume

package
v1.18.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 16 Imported by: 40

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 CleanUpVolumeServer

func CleanUpVolumeServer(f *framework.Framework, serverPod *v1.Pod)

CleanUpVolumeServer is a wrapper of cleanup function for volume server without secret created by specific CreateStorageServer function.

func CleanUpVolumeServerWithSecret

func CleanUpVolumeServerWithSecret(f *framework.Framework, serverPod *v1.Pod, secret *v1.Secret)

CleanUpVolumeServerWithSecret is a wrapper of cleanup function for volume server with secret created by specific CreateStorageServer function.

func CreateGCEVolume

func CreateGCEVolume() (*v1.PersistentVolumeSource, string)

CreateGCEVolume creates PersistentVolumeSource for GCEVolume.

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 GeneratePodSecurityContext

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

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

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 GenerateWriteandExecuteScriptFileCmd

func GenerateWriteandExecuteScriptFileCmd(content, fileName, filePath string) []string

GenerateWriteandExecuteScriptFileCmd generates the corresponding command lines to write a file with the given file path and also execute this file. Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh

func GetTestImage

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 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 StartVolumeServer

func StartVolumeServer(client clientset.Interface, config TestConfig) *v1.Pod

StartVolumeServer starts a container specified by config.serverImage and exports all config.serverPorts from it. The returned pod should be used to get the server IP address and create appropriate VolumeSource.

func TestCleanup

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

TestCleanup cleans both server and client pods.

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.

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
	// ServerNodeName is the spec.nodeName to run server pod on.  Default is any node.
	ServerNodeName string
	// ClientNodeName is the spec.nodeName to run client pod on.  Default is any node.
	ClientNodeName string
	// NodeSelector to use in pod spec (server, client and injector pods).
	NodeSelector map[string]string
}

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 NewISCSIServer

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

NewISCSIServer is an iSCSI-specific wrapper for CreateStorageServer.

func NewNFSServer

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

NewNFSServer is a NFS-specific wrapper for CreateStorageServer.

func NewRBDServer

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

NewRBDServer is a CephRBD-specific wrapper for CreateStorageServer.

Jump to

Keyboard shortcuts

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