remote

package
v1.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDriverArchive

func CreateDriverArchive(archiveName, pkgPath, binPath string) (string, error)

func GetComputeClient

func GetComputeClient(ctx context.Context, computeEndpoint string) (*compute.Service, error)

func GetFileClient added in v0.3.1

func GetFileClient(ctx context.Context, filestoreEndpoint string) (*filev1beta1.Service, error)

func NewWorkspaceDir

func NewWorkspaceDir(workspaceDirPrefix string) string

func TeardownDriverAndClient

func TeardownDriverAndClient(context *TestContext) error

TeardownDriverAndClient closes the CSI Client connection, closes the SSH tunnel Kills the driver process on the GCE instance, and cleans up the remote driver workspace

Types

type ClientConfig

type ClientConfig struct {
	// Absolute path of the package
	PkgPath string
	// Absolute path of the driver binary to copy remotely
	BinPath string
	// Path on remote instance workspace
	WorkspaceDir string
	// Command to run on remote instance to start the driver
	RunDriverCmd string
	// Port to use as SSH tunnel on both remote and local side.
	Port string
}

ClientConfig contains all the parameters required to package a new driver and run it remotely on a GCE Instance

type CsiClient

type CsiClient struct {
	// contains filtered or unexported fields
}

func CreateCSIClient

func CreateCSIClient(endpoint string) *CsiClient

func (*CsiClient) AssertCSIConnection

func (c *CsiClient) AssertCSIConnection() error

func (*CsiClient) CloseConn

func (c *CsiClient) CloseConn() error

func (*CsiClient) ControllerExpandVolume added in v0.3.1

func (c *CsiClient) ControllerExpandVolume(volumeID string, sizeBytes int64) error

func (*CsiClient) ControllerExpandVolumeWithLimit added in v0.3.1

func (c *CsiClient) ControllerExpandVolumeWithLimit(volumeID string, sizeBytes, limitBytes int64) error

func (*CsiClient) CreateSnapshot added in v0.3.1

func (c *CsiClient) CreateSnapshot(snapshotName, sourceVolumeId string) (string, error)

func (*CsiClient) CreateVolume

func (c *CsiClient) CreateVolume(volName, zone, snapshotID string, parameters map[string]string) (*csipb.Volume, error)

func (*CsiClient) DeleteSnapshot added in v0.3.1

func (c *CsiClient) DeleteSnapshot(snapshotID string) error

func (*CsiClient) DeleteVolume

func (c *CsiClient) DeleteVolume(volId string) error

func (*CsiClient) NodeGetInfo

func (c *CsiClient) NodeGetInfo() (*csipb.NodeGetInfoResponse, error)

func (*CsiClient) NodeGetVolumeStats added in v1.2.1

func (c *CsiClient) NodeGetVolumeStats(volumeID, volumePath string) (available, capacity, used, inodesFree, inodes, inodesUsed int64, err error)

func (*CsiClient) NodePublishVolume

func (c *CsiClient) NodePublishVolume(volumeId, stageDir, publishDir string, volumeAttrs map[string]string) error

func (*CsiClient) NodeStageVolume added in v0.3.1

func (c *CsiClient) NodeStageVolume(volumeId, stageDir string, volumeAttrs map[string]string) error

func (*CsiClient) NodeUnpublishVolume

func (c *CsiClient) NodeUnpublishVolume(volumeId, publishDir string) error

func (*CsiClient) NodeUnstageVolume added in v0.3.1

func (c *CsiClient) NodeUnstageVolume(volumeId, stageDir string) error

type InstanceInfo

type InstanceInfo struct {
	// contains filtered or unexported fields
}

func CreateInstanceInfo

func CreateInstanceInfo(project, instanceZone, name string, cs *compute.Service) (*InstanceInfo, error)

func SetupInstance

func SetupInstance(instanceProject, instanceZone, instanceName, instanceServiceAccount string, cs *compute.Service) (*InstanceInfo, error)

SetupInstance sets up the specified GCE Instance for E2E testing and returns a handle to the instance object for future use.

func (*InstanceInfo) CreateOrGetInstance

func (i *InstanceInfo) CreateOrGetInstance(serviceAccount string) error

Provision a gce instance using image

func (*InstanceInfo) CreateSSHTunnel

func (i *InstanceInfo) CreateSSHTunnel(localPort, serverPort string) (int, error)

func (*InstanceInfo) DeleteInstance

func (i *InstanceInfo) DeleteInstance()

func (*InstanceInfo) GetIdentity

func (i *InstanceInfo) GetIdentity() (string, string, string)

func (*InstanceInfo) GetName

func (i *InstanceInfo) GetName() string

func (*InstanceInfo) GetSSHTarget

func (i *InstanceInfo) GetSSHTarget() string

GetHostnameOrIP converts hostname into ip and apply user if necessary.

func (*InstanceInfo) SSH

func (i *InstanceInfo) SSH(cmd ...string) (string, error)

SSH executes ssh command with runSSHCommand as root. The `sudo` makes sure that all commands are executed by root, so that there won't be permission mismatch between different commands.

func (*InstanceInfo) SSHCheckAlive

func (i *InstanceInfo) SSHCheckAlive() (string, error)

SSHCheckAlive just pings the server quickly to check whether it is reachable by SSH

func (*InstanceInfo) SSHNoSudo

func (i *InstanceInfo) SSHNoSudo(cmd ...string) (string, error)

SSHNoSudo executes ssh command with runSSHCommand as normal user. Sometimes we need this, for example creating a directory that we'll copy files there with scp.

func (*InstanceInfo) UploadAndRun

func (i *InstanceInfo) UploadAndRun(archivePath, remoteWorkspace, driverRunCmd string) (int, error)

type TestContext

type TestContext struct {
	Instance *InstanceInfo
	Client   *CsiClient
	// contains filtered or unexported fields
}

TestContext holds the CSI Client handle to a remotely connected Driver as well as a handle to the Instance that the driver is running on

func SetupNewDriverAndClient

func SetupNewDriverAndClient(instance *InstanceInfo, config *ClientConfig) (*TestContext, error)

SetupNewDriverAndClient gets the driver binary, runs it on the provided instance and connects a CSI client to it through SSH tunnelling. It returns a TestContext with both a handle to the instance that the driver is on and the CSI Client object to make CSI calls to the remote driver.

Jump to

Keyboard shortcuts

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