Documentation ¶
Index ¶
- func AppendBytesToFile(filePath string, bytes []byte) error
- func ArchiveServiceLogs(cs clientset.Interface, reportPath string) error
- func ContainsString(data []string, val string) bool
- func CreatePVCFromStorageClass(f *e2eframework.Framework, name string, claimSize string, ...) (*corev1.PersistentVolumeClaim, error)
- func GetBeegfsDriverInUse(dc dynamic.Interface) *beegfsv1.BeegfsDriver
- func GetConfigMapInUse(cs clientset.Interface) corev1.ConfigMap
- func GetPluginConfigInUse(cs clientset.Interface, dc dynamic.Interface) beegfsv1.PluginConfigFromFile
- func GetRunningControllerPod(cs clientset.Interface) (corev1.Pod, error)
- func GetRunningControllerPodOrFail(cs clientset.Interface) corev1.Pod
- func GetRunningNodePods(cs clientset.Interface) ([]corev1.Pod, error)
- func GetRunningNodePodsOrFail(cs clientset.Interface) []corev1.Pod
- func GetUnusedPoolId(configuredPools []string) string
- func UpdatePluginConfigInUse(cs clientset.Interface, dc dynamic.Interface, ...)
- func VerifyDirectoryModeUidGidInPod(f *e2eframework.Framework, ...)
- func VerifyNoOrphanedMounts(cs clientset.Interface)
- type FSExec
- func (e *FSExec) Cleanup() error
- func (e *FSExec) GetVolumeHostMountInfo() (mount, cfgFile string, err error)
- func (e *FSExec) GetVolumeSHA256Checksum() (checksum string)
- func (e *FSExec) IssueCommandWithBeegfsPaths(cmdFmtString string, beegfsPaths ...string) (string, error)
- func (e *FSExec) IssueCommandWithResult(cmd string) (string, error)
- func (e *FSExec) IssueCtlCommandWithBeegfsPathArgs(cmdFmtString string, beegfsPaths ...string) (string, error)
- type FSMountData
- type FindmntData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBytesToFile ¶ added in v1.2.2
AppendBytesToFile appends to a file if it already exists or creates it if it does not. AppendBytesToFile returns an error instead of failing if the write doesn't work in case the caller wants to proceed anyway.
func ArchiveServiceLogs ¶ added in v1.2.1
ArchiveServiceLogs collects the logs on the node and controller service pods and writes them in the specified report path. Logs will be collected from beegfs and csi-provisioner containers. This should typically be called after the test suite completes. It may also make sense to call it if a test will intentionally redeploy pods (as this action results in a reset of container logs). ArchiveServiceLogs returns the first error it generates instead of failing in case the caller wants to proceed anyway.
func ContainsString ¶ added in v1.3.0
The ContainsString function returns true if the passed in data slice contains an element with the value val. If the value is not found in the slice then false is returned.
func CreatePVCFromStorageClass ¶ added in v1.3.0
func CreatePVCFromStorageClass( f *e2eframework.Framework, name string, claimSize string, sc *storagev1.StorageClass, volMode corev1.PersistentVolumeMode, accessModes []corev1.PersistentVolumeAccessMode, claimProvisionTimeout time.Duration, ) (*corev1.PersistentVolumeClaim, error)
CreatePVCFromStorageClass is based on createPVCPVFromDynamicProvisionSC which is part of the kubernetes e2e/storage/framework/volume_resource. The purpose of this function is to create a PVC from a given storage class without the built in assertions of the framework's CreateVolumeResource function and it's related functions. This function does not handle cleanup. Be warned!
func GetBeegfsDriverInUse ¶ added in v1.2.2
func GetBeegfsDriverInUse(dc dynamic.Interface) *beegfsv1.BeegfsDriver
GetBeegfsDriverInUse returns a pointer to a BeegfsDriver if one and only one exists on the cluster. Consuming tests fail if:
- The cluster knows about the BeegfsDriver resource but has non.
- The cluster has more than one BeegfsDriver.
- The attempt to list BeegfsDrivers fails for an unknown reason.
GetBeegfsDriverInUse returns nil if the cluster doesn't know about BeegfsDriver resources.
func GetConfigMapInUse ¶ added in v1.2.2
GetConfigMapInUse returns the ConfigMap being used to configure the BeeGFS CSI driver. Consuming tests fail if:
- The BeeGFS CSI driver controller service isn't using a ConfigMap (this is virtually impossible).
- The ConfigMap can't be retrieved.
func GetPluginConfigInUse ¶ added in v1.2.2
func GetPluginConfigInUse(cs clientset.Interface, dc dynamic.Interface) beegfsv1.PluginConfigFromFile
GetPluginConfigInUse returns a PluginConfigFromFile from the BeegfsDriver if a cluster is operator-enabled or the ConfigMap otherwise. Consuming tests fail if this isn't possible.
func GetRunningControllerPod ¶ added in v1.2.2
GetRunningControllerPod waits PodStartTimeout for exactly one controller service Pod to be running (in any namespace) and returns it or an error.
func GetRunningControllerPodOrFail ¶ added in v1.2.2
GetRunningControllerPodOrFail waits PodStartTimeout for exactly one controller service Pod to be running (in any namespace) and returns it or fails.
func GetRunningNodePods ¶ added in v1.2.2
GetRunningNodePods waits PodStartTimeout for at least one node service Pod to be running (in any namespace) and returns all node service pods it finds or an error.
func GetRunningNodePodsOrFail ¶ added in v1.2.2
GetRunningNodePodsOrFail waits PodStartTimeout for at least one node service Pod to be running (in any namespace) and returns all node service pods it finds or an error.
func GetUnusedPoolId ¶ added in v1.3.0
GetUnusedPoolID will return a string representing a pool id that is not in the list of existing configured pool ids. If no such string can be found then an empty string is returned.
func UpdatePluginConfigInUse ¶ added in v1.2.2
func UpdatePluginConfigInUse(cs clientset.Interface, dc dynamic.Interface, config beegfsv1.PluginConfigFromFile)
UpdatePluginConfigInUse updates the BeegfsDriver (if it exists) or the ConfigMap with a new PluginConfigFromFile. Consuming tests fail if this does not work.
func VerifyDirectoryModeUidGidInPod ¶
func VerifyDirectoryModeUidGidInPod(f *e2eframework.Framework, directory, expectedMode, expectedUID, expectedGID string, pod *corev1.Pod)
VerifyDirectoryModeUidGidInPod verifies expected mode, UID, and GID of the target directory This implementation is similar to [`VerifyFilePathGidInPod`](https://github.com/kubernetes/kubernetes/blob/v1.21.0/test/e2e/storage/utils/utils.go#L709).
func VerifyNoOrphanedMounts ¶ added in v1.2.1
VerifyNoOrphanedMounts uses SSH to access all cluster nodes and verify that none of them have a BeeGFS file system mounted by the CSI driver. VerifyNoOrphanedMounts could be used within a single test case, but mounts are orphaned intermittently and it would be unlikely to catch an orphan mount without including an extremely long stress test within the case. It is currently preferred to use VerifyNoOrphanedMounts before and after an entire suite of tests runs to ensure none of the tests within the suite causes a mount to be orphaned.
Types ¶
type FSExec ¶
type FSExec struct { Resource *storageframework.VolumeResource // Export for easy inspection. // contains filtered or unexported fields }
FSExec makes it easy to execute commands on a node that has a BeeGFS file system mounted. FSExec handles creating a volume resource, creating a pod to mount it, and tracking the node that has it mounted. This frees the caller to worry only about what command to execute.
func NewFSExec ¶
func NewFSExec(cfg *storageframework.PerTestConfig, driver *driver.BeegfsDriver, sizeRange e2evolume.SizeRange) FSExec
NewFSExec initializes an FSExec.
func (*FSExec) GetVolumeHostMountInfo ¶ added in v1.3.0
GetVolumeHostMountInfo will return the path of the BeeGFS filesystem mount related to the volume associated with this FSExec. This assumes that there is a single volume associated with the FSExec.
func (*FSExec) GetVolumeSHA256Checksum ¶ added in v1.3.0
GetVolumeSHA256Checksum will return the SHA256 checksum of the volumeHandle for the volume associated with this FSExec. This assumes that there is a single volume associated with the FSExec. Starting in Kubernetes 1.24 this checksum is now used in CSI staging paths.
func (*FSExec) IssueCommandWithBeegfsPaths ¶
func (e *FSExec) IssueCommandWithBeegfsPaths(cmdFmtString string, beegfsPaths ...string) (string, error)
IssueCommandWithBeegfsPaths takes a format string (like the ones passed to fmt.Printf, fmt.Sprintf, etc.) and any number of BeeGFS relative paths. It converts the relative paths to absolute paths on the host that will execute a command. e.g. IssueCommandWithBeegfsPaths("rm -rf %s", "e2e-test/delete/some-name") executes "rm -rf /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-058ae06f/globalmount/mount/e2e-test/delete/some-name"
func (*FSExec) IssueCommandWithResult ¶
IssueCommandWithResult works exactly like hostExec.IssueCommandWithResult, except that it identifies the correct node (the one with our BeeGFS file system mounted) on which to execute the passed command automatically.
func (*FSExec) IssueCtlCommandWithBeegfsPathArgs ¶ added in v1.3.0
func (e *FSExec) IssueCtlCommandWithBeegfsPathArgs(cmdFmtString string, beegfsPaths ...string) (string, error)
IssueCtlCommandWithBeegfsPathArgs takes a format string (like the ones passed to fmt.Printf, fmt.Sprintf, etc.) and any number of BeeGFS relative paths. The format string should consist of valid beegfs-ctl command arguments. It converts the relative paths to absolute paths on the host that will execute the beegfs-ctl command and ensures it executes using the appropriate beegfs-client.conf file. e.g. IssueCtlCommandWithBeegfsPathArgs(--getentryinfo %s", "e2e-test/dynamic/pvc-058ae06f") executes "beegfs-ctl --cfgFile=/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-058ae06f/globalmount/beegfs-client.conf --getentryinfo /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-058ae06f/globalmount/mount/e2e-test/dynamic/pvc-058ae06f"
type FSMountData ¶ added in v1.3.0
FSMountData is a type to represent the JSON object returned by findmnt -J. Each object represents one of the objects that exist within the filesystems list. Example: {"filesystems": [FSMountData1, FSMountData2]}
type FindmntData ¶ added in v1.3.0
type FindmntData struct {
Filesystems []FSMountData
}
FindmntData represents the top level JSON object returned by 'findmnt -J'.