driver

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GiB = 1024 * 1024 * 1024
)
View Source
const (
	MountS3PathEnv = "MOUNT_S3_PATH"
)

Variables

This section is empty.

Functions

func GetVersionJSON

func GetVersionJSON() (string, error)

func MountS3Path

func MountS3Path() string

func ParseEndpoint added in v1.4.0

func ParseEndpoint(endpoint string) (string, string, error)

func ReplaceFile

func ReplaceFile(destPath string, sourcePath string, perm fs.FileMode) error

replaceFile safely replaces a file with a new file by copying to a temporary location first then renaming.

Types

type Driver

type Driver struct {
	Endpoint string
	Srv      *grpc.Server
	NodeID   string

	NodeServer *S3NodeServer
}

func NewDriver

func NewDriver(endpoint string, mpVersion string, nodeID string) *Driver

func (*Driver) ControllerGetVolume

func (*Driver) CreateSnapshot

func (*Driver) CreateVolume

func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)

func (*Driver) DeleteSnapshot

func (*Driver) DeleteVolume

func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)

func (*Driver) GetCapacity

func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)

func (*Driver) GetPluginInfo

func (d *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

func (*Driver) ListSnapshots

func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)

func (*Driver) ListVolumes

func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)

func (*Driver) Probe

func (d *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

func (*Driver) Run

func (d *Driver) Run() error

func (*Driver) Stop

func (d *Driver) Stop()

type FakeMounter added in v1.4.0

type FakeMounter struct{}

func (*FakeMounter) IsMountPoint added in v1.4.0

func (m *FakeMounter) IsMountPoint(target string) (bool, error)

func (*FakeMounter) Mount added in v1.4.0

func (m *FakeMounter) Mount(bucketName string, target string,
	credentials *MountCredentials, options []string) error

func (*FakeMounter) Unmount added in v1.4.0

func (m *FakeMounter) Unmount(target string) error

type Fs added in v1.4.0

type Fs interface {
	Stat(name string) (os.FileInfo, error)
	MkdirAll(path string, perm os.FileMode) error
	Remove(name string) error
}

type MountCredentials added in v1.4.0

type MountCredentials struct {
	AccessKeyID     string
	SecretAccessKey string
	Region          string
	DefaultRegion   string
	WebTokenPath    string
	StsEndpoints    string
	AwsRoleArn      string
}

func (*MountCredentials) Env added in v1.4.0

func (mc *MountCredentials) Env() []string

Get environment variables to pass to mount-s3 for authentication.

type MountLister added in v1.4.0

type MountLister interface {
	ListMounts() ([]mount.MountPoint, error)
}

type Mounter

type Mounter interface {
	Mount(bucketName string, target string, credentials *MountCredentials, options []string) error
	Unmount(target string) error
	IsMountPoint(target string) (bool, error)
}

Mounter is an interface for mount operations

type OsFs added in v1.4.0

type OsFs struct{}

func (OsFs) MkdirAll added in v1.4.0

func (OsFs) MkdirAll(path string, perm os.FileMode) error

func (OsFs) Remove added in v1.4.0

func (OsFs) Remove(path string) error

func (OsFs) Stat added in v1.4.0

func (OsFs) Stat(name string) (os.FileInfo, error)

type ProcMountLister added in v1.4.0

type ProcMountLister struct {
	ProcMountPath string
}

func (*ProcMountLister) ListMounts added in v1.4.0

func (pml *ProcMountLister) ListMounts() ([]mount.MountPoint, error)

type S3Mounter

type S3Mounter struct {
	Ctx         context.Context
	Runner      ServiceRunner
	Fs          Fs
	MountLister MountLister
	MpVersion   string
	MountS3Path string
}

func NewS3Mounter

func NewS3Mounter(mpVersion string) (*S3Mounter, error)

func (*S3Mounter) IsMountPoint

func (m *S3Mounter) IsMountPoint(target string) (bool, error)

func (*S3Mounter) Mount

func (m *S3Mounter) Mount(bucketName string, target string,
	credentials *MountCredentials, options []string) error

Mount the given bucket at the target path. Options will be passed through mostly unchanged, with the exception of the user agent prefix which will be added to the Mountpoint headers. This method will create the target path if it does not exist and if there is an existing corrupt mount, it will attempt an unmount before attempting the mount.

func (*S3Mounter) Unmount

func (m *S3Mounter) Unmount(target string) error

type S3NodeServer added in v1.4.0

type S3NodeServer struct {
	NodeID          string
	BaseCredentials *MountCredentials
	Mounter         Mounter
}

S3NodeServer is the implementation of the csi.NodeServer interface

func (*S3NodeServer) NodeExpandVolume added in v1.4.0

func (*S3NodeServer) NodeGetCapabilities added in v1.4.0

func (*S3NodeServer) NodeGetInfo added in v1.4.0

func (*S3NodeServer) NodeGetVolumeStats added in v1.4.0

func (*S3NodeServer) NodePublishVolume added in v1.4.0

func (*S3NodeServer) NodeStageVolume added in v1.4.0

func (*S3NodeServer) NodeUnpublishVolume added in v1.4.0

func (*S3NodeServer) NodeUnstageVolume added in v1.4.0

type ServiceRunner added in v1.4.0

type ServiceRunner interface {
	StartService(ctx context.Context, config *system.ExecConfig) (string, error)
	RunOneshot(ctx context.Context, config *system.ExecConfig) (string, error)
}

type Token added in v1.4.0

type Token struct {
	Token               string    `json:"token"`
	ExpirationTimestamp time.Time `json:"expirationTimestamp"`
}

type VersionInfo

type VersionInfo struct {
	DriverVersion string `json:"driverVersion"`
	GitCommit     string `json:"gitCommit"`
	BuildDate     string `json:"buildDate"`
	GoVersion     string `json:"goVersion"`
	Compiler      string `json:"compiler"`
	Platform      string `json:"platform"`
}

func GetVersion

func GetVersion() VersionInfo

Directories

Path Synopsis
Package mock_driver is a generated GoMock package.
Package mock_driver is a generated GoMock package.

Jump to

Keyboard shortcuts

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