remote

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 24 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 GetComputeAlphaClient added in v1.0.0

func GetComputeAlphaClient() (*computealpha.Service, error)

func GetComputeClient

func GetComputeClient() (*compute.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.6.0

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

func (*CsiClient) ControllerPublishVolume

func (c *CsiClient) ControllerPublishVolume(volId, nodeId string) error

func (*CsiClient) ControllerUnpublishVolume

func (c *CsiClient) ControllerUnpublishVolume(volId, nodeId string) error

func (*CsiClient) CreateSnapshot

func (c *CsiClient) CreateSnapshot(snapshotName, sourceVolumeId string, params map[string]string) (string, error)

func (*CsiClient) CreateVolume

func (c *CsiClient) CreateVolume(volName string, params map[string]string, sizeInGb int64, topReq *csipb.TopologyRequirement) (string, error)

func (*CsiClient) CreateVolumeWithCaps added in v1.0.0

func (c *CsiClient) CreateVolumeWithCaps(volName string, params map[string]string, sizeInGb int64, topReq *csipb.TopologyRequirement, caps []*csipb.VolumeCapability) (string, error)

func (*CsiClient) DeleteSnapshot

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

func (*CsiClient) DeleteVolume

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

func (*CsiClient) ListVolumes added in v0.7.0

func (c *CsiClient) ListVolumes() (map[string]([]string), error)

func (*CsiClient) NodeExpandVolume added in v0.6.0

func (c *CsiClient) NodeExpandVolume(volumeID, volumePath string, sizeGb int64) (*csipb.NodeExpandVolumeResponse, error)

func (*CsiClient) NodeGetInfo

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

func (*CsiClient) NodeGetVolumeStats added in v0.7.0

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

func (*CsiClient) NodePublishBlockVolume added in v0.6.0

func (c *CsiClient) NodePublishBlockVolume(volumeID, stageDir, publishDir string) error

func (*CsiClient) NodePublishVolume

func (c *CsiClient) NodePublishVolume(volumeID, stageDir, publishDir string) error

func (*CsiClient) NodeStageBlockVolume added in v0.6.0

func (c *CsiClient) NodeStageBlockVolume(volId, stageDir string) error

func (*CsiClient) NodeStageExt4Volume added in v0.6.0

func (c *CsiClient) NodeStageExt4Volume(volId, stageDir string) error

func (*CsiClient) NodeStageVolume

func (c *CsiClient) NodeStageVolume(volId, stageDir string, volumeCap *csipb.VolumeCapability) error

func (*CsiClient) NodeUnpublishVolume

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

func (*CsiClient) NodeUnstageVolume

func (c *CsiClient) NodeUnstageVolume(volId, 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) GetNodeID

func (i *InstanceInfo) GetNodeID() 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 SHH 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