Documentation ¶
Index ¶
- func KubeletCommand(kOp KubeletOpt, c clientset.Interface, pod *v1.Pod)
- func PatchCSIDeployment(f *framework.Framework, o PatchCSIOptions, object interface{}) error
- func PodExec(pod *v1.Pod, bashExec string) (string, error)
- func PrivilegedTestPSPClusterRoleBinding(client clientset.Interface, namespace string, teardown bool, saNames []string)
- func RunInPodWithVolume(c clientset.Interface, ns, claimName, command string)
- func SIGDescribe(text string, body func()) bool
- func StartExternalProvisioner(c clientset.Interface, ns string, externalPluginName string) *v1.Pod
- func TestKubeletRestartsAndRestoresMount(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)
- func TestVolumeUnmountsFromDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)
- func TestVolumeUnmountsFromDeletedPodWithForceOption(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod, ...)
- func TestVolumeUnmountsFromForceDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)
- func VerifyExecInPodFail(pod *v1.Pod, bashExec string, exitCode int)
- func VerifyExecInPodSucceed(pod *v1.Pod, bashExec string)
- type KubeletOpt
- type PatchCSIOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KubeletCommand ¶
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 PatchCSIDeployment ¶ added in v1.13.0
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.
TODO (?): the storage.csi.image.version and storage.csi.image.registry settings are ignored. We could patch the image definitions or deprecate those options.
func PrivilegedTestPSPClusterRoleBinding ¶ added in v1.10.9
func RunInPodWithVolume ¶
RunInPodWithVolume runs a command in a pod with given claim mounted to /mnt directory.
func SIGDescribe ¶
func StartExternalProvisioner ¶ added in v1.12.0
func TestKubeletRestartsAndRestoresMount ¶
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 TestVolumeUnmountsFromDeletedPod ¶
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 ¶
func TestVolumeUnmountsFromDeletedPodWithForceOption(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod, forceDelete bool, checkSubpath bool)
TestVolumeUnmountsFromDeletedPod 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.
func TestVolumeUnmountsFromForceDeletedPod ¶
func TestVolumeUnmountsFromForceDeletedPod(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod)
TestVolumeUnmountsFromFoceDeletedPod tests that a volume unmounts if the client pod was forcefully deleted while the kubelet was down.
func VerifyExecInPodFail ¶ added in v1.12.0
VerifyExecInPodFail verifies bash cmd in target pod fail with certain exit code
func VerifyExecInPodSucceed ¶ added in v1.12.0
VerifyExecInPodSucceed verifies bash cmd in target pod succeed
Types ¶
type KubeletOpt ¶
type KubeletOpt string
const ( NodeStateTimeout = 1 * time.Minute KStart KubeletOpt = "start" KStop KubeletOpt = "stop" KRestart KubeletOpt = "restart" )
type PatchCSIOptions ¶ added in v1.13.0
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, --drivername with the new name will be // appended to the argument list. DriverContainerName 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 // If non-empty, all pods are forced to run on this node. NodeName string }
PatchCSIOptions controls how PatchCSIDeployment patches the objects.