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

package utils

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

Index

Package Files

create.go deployment.go framework.go host_exec.go local.go utils.go

func CheckReadFromPath Uses

func CheckReadFromPath(f *framework.Framework, pod *v1.Pod, volMode v1.PersistentVolumeMode, path string, len int, seed int64)

CheckReadFromPath validate that file can be properly read.

func CheckReadWriteToPath Uses

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

CheckReadWriteToPath check that path can b e read and written

func CheckVolumeModeOfPath Uses

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

CheckVolumeModeOfPath check mode of volume

func CheckWriteToPath Uses

func CheckWriteToPath(f *framework.Framework, pod *v1.Pod, volMode v1.PersistentVolumeMode, path string, len int, seed int64)

CheckWriteToPath that file can be properly written.

func CreateFromManifests Uses

func CreateFromManifests(f *framework.Framework, patch func(item interface{}) error, files ...string) (func(), error)

CreateFromManifests is a combination of LoadFromManifests, PatchItems, patching with an optional custom function, and CreateItems.

func CreateItems Uses

func CreateItems(f *framework.Framework, items ...interface{}) (func(), error)

CreateItems creates the items. Each of them must be an API object of a type that is registered in Factory.

It returns either a cleanup function or an error, but never both.

Cleaning up after a test can be triggered in two ways: - the test invokes the returned cleanup function,

usually in an AfterEach

- the test suite terminates, potentially after

skipping the test's AfterEach (https://github.com/onsi/ginkgo/issues/222)

PatchItems has the some limitations as LoadFromManifests: - only some common items are supported, unknown ones trigger an error - only the latest stable API version for each item is supported

func FindVolumeGlobalMountPoints Uses

func FindVolumeGlobalMountPoints(hostExec HostExec, node *v1.Node) sets.String

FindVolumeGlobalMountPoints returns all volume global mount points on the node of given pod.

func KubeletCommand Uses

func KubeletCommand(kOp KubeletOpt, c clientset.Interface, pod *v1.Pod)

KubeletCommand performs `start`, `restart`, or `stop` on the kubelet running on the node of the target pod and waits for the desired statues.. - First issues the command via `systemctl` - If `systemctl` returns stderr "command not found, issues the command via `service` - If `service` also returns stderr "command not found", the test is aborted. Allowed kubeletOps are `KStart`, `KStop`, and `KRestart`

func LoadFromManifests Uses

func LoadFromManifests(files ...string) ([]interface{}, error)

LoadFromManifests loads .yaml or .json manifest files and returns all items that it finds in them. It supports all items for which there is a factory registered in factories and .yaml files with multiple items separated by "---". Files are accessed via the "testfiles" package, which means they can come from a file system or be built into the binary.

LoadFromManifests has some limitations: - aliases are not supported (i.e. use serviceAccountName instead of the deprecated serviceAccount,

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#podspec-v1-core)
and silently ignored

- the latest stable API version for each item is used, regardless of what

is specified in the manifest files

func LogResult Uses

func LogResult(result Result)

LogResult records result log

func PatchCSIDeployment Uses

func PatchCSIDeployment(f *framework.Framework, o PatchCSIOptions, object interface{}) error

PatchCSIDeployment modifies the CSI driver deployment: - replaces the provisioner name - forces pods onto a specific host

All of that is optional, see PatchCSIOptions. Just beware that not renaming the CSI driver deployment can be problematic: - when multiple tests deploy the driver, they need

to run sequentially

- might conflict with manual deployments

This function is written so that it works for CSI driver deployments that follow these conventions: - driver and provisioner names are identical - the driver binary accepts a --drivername parameter - the provisioner binary accepts a --provisioner parameter - the paths inside the container are either fixed

and don't need to be patch (for example, --csi-address=/csi/csi.sock is
okay) or are specified directly in a parameter (for example,
--kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock)

Driver deployments that are different will have to do the patching without this function, or skip patching entirely.

func PatchItems Uses

func PatchItems(f *framework.Framework, items ...interface{}) error

PatchItems modifies the given items in place such that each test gets its own instances, to avoid conflicts between different tests and between tests and normal deployments.

This is done by: - creating namespaced items inside the test's namespace - changing the name of non-namespaced items like ClusterRole

PatchItems has some limitations: - only some common items are supported, unknown ones trigger an error - only the latest stable API version for each item is supported

func PatchName Uses

func PatchName(f *framework.Framework, item *string)

PatchName makes the name of some item unique by appending the generated unique name.

func PatchNamespace Uses

func PatchNamespace(f *framework.Framework, item *string)

PatchNamespace moves the item into the test's namespace. Not all items can be namespaced. For those, the name also needs to be patched.

func PodExec Uses

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

PodExec runs f.ExecCommandInContainerWithFullOutput to execute a shell cmd in target pod

func PrettyPrint Uses

func PrettyPrint(item interface{}) string

PrettyPrint returns a human-readable representation of an item.

func PrivilegedTestPSPClusterRoleBinding Uses

func PrivilegedTestPSPClusterRoleBinding(client clientset.Interface,
    namespace string,
    teardown bool,
    saNames []string)

PrivilegedTestPSPClusterRoleBinding test Pod Security Policy Role bindings

func RunInPodWithVolume Uses

func RunInPodWithVolume(c clientset.Interface, ns, claimName, command string)

RunInPodWithVolume runs a command in a pod with given claim mounted to /mnt directory.

func SIGDescribe Uses

func SIGDescribe(text string, body func()) bool

SIGDescribe annotates the test with the SIG label.

func StartExternalProvisioner Uses

func StartExternalProvisioner(c clientset.Interface, ns string, externalPluginName string) *v1.Pod

StartExternalProvisioner create external provisioner pod

func TestKubeletRestartsAndRestoresMap Uses

func TestKubeletRestartsAndRestoresMap(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)

TestKubeletRestartsAndRestoresMap tests that a volume mapped to a pod remains mapped after a kubelet restarts

func TestKubeletRestartsAndRestoresMount Uses

func TestKubeletRestartsAndRestoresMount(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)

TestKubeletRestartsAndRestoresMount tests that a volume mounted to a pod remains mounted after a kubelet restarts

func TestVolumeUnmapsFromDeletedPod Uses

func TestVolumeUnmapsFromDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)

TestVolumeUnmapsFromDeletedPod tests that a volume unmaps if the client pod was deleted while the kubelet was down.

func TestVolumeUnmapsFromDeletedPodWithForceOption Uses

func TestVolumeUnmapsFromDeletedPodWithForceOption(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod, forceDelete bool)

TestVolumeUnmapsFromDeletedPodWithForceOption tests that a volume unmaps if the client pod was deleted while the kubelet was down. forceDelete is true indicating whether the pod is forcefully deleted.

func TestVolumeUnmapsFromForceDeletedPod Uses

func TestVolumeUnmapsFromForceDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)

TestVolumeUnmapsFromForceDeletedPod tests that a volume unmaps if the client pod was forcefully deleted while the kubelet was down.

func TestVolumeUnmountsFromDeletedPod Uses

func TestVolumeUnmountsFromDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)

TestVolumeUnmountsFromDeletedPod tests that a volume unmounts if the client pod was deleted while the kubelet was down.

func TestVolumeUnmountsFromDeletedPodWithForceOption Uses

func TestVolumeUnmountsFromDeletedPodWithForceOption(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod, forceDelete bool, checkSubpath bool)

TestVolumeUnmountsFromDeletedPodWithForceOption tests that a volume unmounts if the client pod was deleted while the kubelet was down. forceDelete is true indicating whether the pod is forcefully deleted. checkSubpath is true indicating whether the subpath should be checked.

func TestVolumeUnmountsFromForceDeletedPod Uses

func TestVolumeUnmountsFromForceDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)

TestVolumeUnmountsFromForceDeletedPod tests that a volume unmounts if the client pod was forcefully deleted while the kubelet was down.

func VerifyExecInPodFail Uses

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

VerifyExecInPodFail verifies shell cmd in target pod fail with certain exit code

func VerifyExecInPodSucceed Uses

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

VerifyExecInPodSucceed verifies shell cmd in target pod succeed

type HostExec Uses

type HostExec interface {
    Execute(cmd string, node *v1.Node) (Result, error)
    IssueCommandWithResult(cmd string, node *v1.Node) (string, error)
    IssueCommand(cmd string, node *v1.Node) error
    Cleanup()
}

HostExec represents interface we require to execute commands on remote host.

func NewHostExec Uses

func NewHostExec(framework *framework.Framework) HostExec

NewHostExec returns a HostExec

type ItemFactory Uses

type ItemFactory interface {
    // New returns a new empty item.
    New() runtime.Object

    // Create is responsible for creating the item. It returns an
    // error or a cleanup function for the created item.
    // If the item is of an unsupported type, it must return
    // an error that has errorItemNotSupported as cause.
    Create(f *framework.Framework, item interface{}) (func() error, error)
}

ItemFactory provides support for creating one particular item. The type gets exported because other packages might want to extend the set of pre-defined factories.

type KubeletOpt Uses

type KubeletOpt string

KubeletOpt type definition

const (
    // NodeStateTimeout defines Timeout
    NodeStateTimeout = 1 * time.Minute
    // KStart defines start value
    KStart KubeletOpt = "start"
    // KStop defines stop value
    KStop KubeletOpt = "stop"
    // KRestart defines restart value
    KRestart KubeletOpt = "restart"
)

type LocalTestResource Uses

type LocalTestResource struct {
    VolumeType LocalVolumeType
    Node       *v1.Node
    // Volume path, path to filesystem or block device on the node
    Path string
    // contains filtered or unexported fields
}

LocalTestResource represents test resource of a local volume.

type LocalTestResourceManager Uses

type LocalTestResourceManager interface {
    Create(node *v1.Node, volumeType LocalVolumeType, parameters map[string]string) *LocalTestResource
    Remove(ltr *LocalTestResource)
}

LocalTestResourceManager represents interface to create/destroy local test resources on node

func NewLocalResourceManager Uses

func NewLocalResourceManager(prefix string, hostExec HostExec, hostBase string) LocalTestResourceManager

NewLocalResourceManager returns a instance of LocalTestResourceManager

type LocalVolumeType Uses

type LocalVolumeType string

LocalVolumeType represents type of local volume, e.g. tmpfs, directory, block, etc.

const (
    // LocalVolumeDirectory reprensents a simple directory as local volume
    LocalVolumeDirectory LocalVolumeType = "dir"
    // LocalVolumeDirectoryLink is like LocalVolumeDirectory but it's a symbolic link to directory
    LocalVolumeDirectoryLink LocalVolumeType = "dir-link"
    // LocalVolumeDirectoryBindMounted is like LocalVolumeDirectory but bind mounted
    LocalVolumeDirectoryBindMounted LocalVolumeType = "dir-bindmounted"
    // LocalVolumeDirectoryLinkBindMounted is like LocalVolumeDirectory but it's a symbolic link to self bind mounted directory
    // Note that bind mounting at symbolic link actually mounts at directory it
    // links to
    LocalVolumeDirectoryLinkBindMounted LocalVolumeType = "dir-link-bindmounted"
    // LocalVolumeTmpfs represents a temporary filesystem to be used as local volume
    LocalVolumeTmpfs LocalVolumeType = "tmpfs"
    // LocalVolumeBlock represents a Block device, creates a local file, and maps it as a block device
    LocalVolumeBlock LocalVolumeType = "block"
    // LocalVolumeBlockFS represents a filesystem backed by a block device
    LocalVolumeBlockFS LocalVolumeType = "blockfs"
    // LocalVolumeGCELocalSSD represents a Filesystem backed by GCE Local SSD as local volume
    LocalVolumeGCELocalSSD LocalVolumeType = "gce-localssd-scsi-fs"
)

type PatchCSIOptions Uses

type PatchCSIOptions struct {
    // The original driver name.
    OldDriverName string
    // The driver name that replaces the original name.
    // Can be empty (not used at all) or equal to OldDriverName
    // (then it will be added were appropriate without renaming
    // in existing fields).
    NewDriverName string
    // The name of the container which has the CSI driver binary.
    // If non-empty, DriverContainerArguments are added to argument
    // list in container with that name.
    DriverContainerName string
    // List of arguments to add to container with
    // DriverContainerName.
    DriverContainerArguments []string
    // The name of the container which has the provisioner binary.
    // If non-empty, --provisioner with new name will be appended
    // to the argument list.
    ProvisionerContainerName string
    // The name of the container which has the snapshotter binary.
    // If non-empty, --snapshotter with new name will be appended
    // to the argument list.
    SnapshotterContainerName string
    // If non-empty, all pods are forced to run on this node.
    NodeName string
    // If not nil, the value to use for the CSIDriver.Spec.PodInfo
    // field *if* the driver deploys a CSIDriver object. Ignored
    // otherwise.
    PodInfo *bool
    // If not nil, the value to use for the CSIDriver.Spec.CanAttach
    // field *if* the driver deploys a CSIDriver object. Ignored
    // otherwise.
    CanAttach *bool
    // If not nil, the value to use for the CSIDriver.Spec.VolumeLifecycleModes
    // field *if* the driver deploys a CSIDriver object. Ignored
    // otherwise.
    VolumeLifecycleModes *[]storagev1beta1.VolumeLifecycleMode
}

PatchCSIOptions controls how PatchCSIDeployment patches the objects.

type Result Uses

type Result struct {
    Host   string
    Cmd    string
    Stdout string
    Stderr string
    Code   int
}

Result holds the execution result of remote execution command.

type What Uses

type What struct {
    Kind string `json:"kind"`
}

What is a subset of metav1.TypeMeta which (in contrast to metav1.TypeMeta itself) satisfies the runtime.Object interface.

func (*What) DeepCopy Uses

func (in *What) DeepCopy() *What

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new What.

func (*What) DeepCopyInto Uses

func (in *What) DeepCopyInto(out *What)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out.

func (*What) DeepCopyObject Uses

func (in *What) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*What) GetObjectKind Uses

func (in *What) GetObjectKind() schema.ObjectKind

GetObjectKind returns the ObjectKind schema

Package utils imports 36 packages (graph) and is imported by 158 packages. Updated 2019-11-21. Refresh now. Tools for package owners.