csirclone

package
v0.0.0-...-35e6604 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDriverName     = "rclone.csi.k8s.io"
	DefaultDriverEndpoint = "unix:///tmp/csi.sock"
	DefaultMountType      = "mount2"
)

Variables

View Source
var (
	ErrNotFound          = errors.New("metadata file not found")
	ErrRemoteNotFound    = errors.New("didn't find section in config file")
	ErrMetaWrongID       = errors.New("different id found in metadata file")
	ErrMetaWrongCapacity = errors.New("different capacity found in metadata file")
)
View Source
var MetadataFilename = ".csi-metadata"

Functions

func GetVersionYAML

func GetVersionYAML(driverName string) (string, error)

GetVersionYAML returns the version information of the driver in YAML format

Types

type ControlServer

type ControlServer struct {
	*csicommon.ControlServer
	// contains filtered or unexported fields
}

ControlServer is responsible of controlling and managing the volumes, such as: creating, deleting, attaching/detaching, snapshotting, etc..

func NewControlServer

func NewControlServer(d *Driver) *ControlServer

NewControlServer returns a working control server.

func (*ControlServer) ControllerExpandVolume

ControllerExpandVolume

func (*ControlServer) ControllerGetCapabilities

ControllerGetCapabilities

func (*ControlServer) CreateVolume

CreateVolume

func (*ControlServer) DeleteVolume

DeleteVolume

func (*ControlServer) SetCapabilities

func (cs *ControlServer) SetCapabilities(caps []csi.ControllerServiceCapability_RPC_Type)

SetCapabilities

func (*ControlServer) ValidateVolumeCapabilities

ValidateVolumeCapabilities

type Driver

type Driver struct {
	*DriverOptions
	Version string
	WorkDir string
	Server  NonBlockingGRPCServer
	Locks   *VolumeLocks
}

func NewDriver

func NewDriver(opts *DriverOptions) (d *Driver)

func (*Driver) CopyFile

func (d *Driver) CopyFile(ctx context.Context, srcRemote, srcPath, destRemote, destPath string) error

func (*Driver) ExpandVolume

func (d *Driver) ExpandVolume(ctx context.Context, id string, capacity int64) error

func (*Driver) GetMountOpt

func (d *Driver) GetMountOpt() (string, error)

func (*Driver) GetVfsOpt

func (d *Driver) GetVfsOpt() (string, error)

func (*Driver) IsVolume

func (d *Driver) IsVolume(ctx context.Context, id string) (exist bool, err error)

func (*Driver) MountVolume

func (d *Driver) MountVolume(ctx context.Context, id, mountPoint string, parameters map[string]string) error

func (*Driver) MoveFile

func (d *Driver) MoveFile(ctx context.Context, srcRemote, srcPath, destRemote, destPath string) error

func (*Driver) PurgeVolume

func (d *Driver) PurgeVolume(ctx context.Context, id string) error

func (*Driver) RC

func (d *Driver) RC(ctx context.Context, path string, in rc.Params) (out rc.Params, err error)

mostly copied from rclone/cmd/rc.doCall()

func (*Driver) ReadVolume

func (d *Driver) ReadVolume(ctx context.Context, id string) (*Volume, error)

ReadVolume returns nil if no volume is found

func (*Driver) Start

func (d *Driver) Start()

func (*Driver) Stop

func (d *Driver) Stop()

func (*Driver) Wait

func (d *Driver) Wait()

func (*Driver) WriteVolume

func (d *Driver) WriteVolume(ctx context.Context, v *Volume) error

type DriverOptions

type DriverOptions struct {
	DriverName string
	NodeId     string
	Endpoint   string

	Address  string
	Username string
	Password string

	Remote    string
	MountType string

	MountOpt map[string]string
	VfsOpt   map[string]string
}

func (*DriverOptions) Validate

func (o *DriverOptions) Validate() (err error)

type IdentityServer

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

IdentityServer consists of basic methods, mainly for identifying the service, making sure it's healthy, and returning basic information about the plugin itself.

func NewIdentityServer

func NewIdentityServer(d *Driver) *IdentityServer

NewIdentityServer satisfies the csi.IdentityServer interface.

func (*IdentityServer) GetPluginCapabilities

GetPluginCapabilities returns the capabilities of the plugin. Currently it reports whether the plugin has the ability of serving the Controller interface. The CO calls the Controller interface methods depending on whether this method returns the capability or not.

func (*IdentityServer) GetPluginInfo

GetPluginInfo returns the name and version of the plugin.

func (*IdentityServer) Probe

Probe checks whether the plugin is running or not. This method does not need to return anything. Currently the spec does not dictate what you should return either. Hence, return an empty responsDrivere

type NodeServer

type NodeServer struct {
	*csicommon.NodeServer
	// contains filtered or unexported fields
}

NodeServer is responsible for managing the mounts and status of each node.

func NewNodeServer

func NewNodeServer(d *Driver) *NodeServer

NewNodeServer returns a working node server.

func (*NodeServer) NodeExpandVolume

NodeExpandVolume node expand volume

func (*NodeServer) NodeGetCapabilities

NodeGetCapabilities return the capabilities of the Node plugin

func (*NodeServer) NodeGetInfo

NodeGetInfo return info of the node on which this plugin is running

func (*NodeServer) NodeGetVolumeStats

NodeGetVolumeStats get volume stats

func (*NodeServer) NodePublishVolume

NodePublishVolume mount the volume from staging to target path

func (*NodeServer) NodeUnpublishVolume

NodeUnpublishVolume unmount the volume from the target path

func (*NodeServer) SetCapabilities

func (ns *NodeServer) SetCapabilities(caps []csi.NodeServiceCapability_RPC_Type)

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer)
	// Waits for the service to stop
	Wait()
	// Stops the service gracefully
	Stop()
	// Stops the service forcefully
	ForceStop()
}

Defines Non blocking GRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

type VersionInfo

type VersionInfo struct {
	DriverName    string `json:"Driver Name"`
	DriverVersion string `json:"Driver Version"`
	GitCommit     string `json:"Git Commit"`
	BuildDate     string `json:"Build Date"`
	GoVersion     string `json:"Go Version"`
	Compiler      string `json:"Compiler"`
	Platform      string `json:"Platform"`
}

VersionInfo holds the version information of the driver

func GetVersion

func GetVersion(driverName string) VersionInfo

GetVersion returns the version information of the driver

type Volume

type Volume struct {
	Remote   string `json:"remote"`
	Name     string `json:"name"`
	Capacity int64  `json:"capacity"`
	ID       string `json:"id"`
}

func NewVolume

func NewVolume(remote, name string, capacity int64) *Volume

func NewVolumeFromJSON

func NewVolumeFromJSON(metadata []byte) (*Volume, error)

func (*Volume) IsConflict

func (v *Volume) IsConflict(new *Volume) error

func (*Volume) Marshal

func (v *Volume) Marshal(indent bool) ([]byte, error)

func (*Volume) Unmarshal

func (v *Volume) Unmarshal(b []byte) error

type VolumeLocks

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

VolumeLocks implements a map with atomic operations. It stores a set of all volume IDs with an ongoing operation.

func NewVolumeLocks

func NewVolumeLocks() *VolumeLocks

func (*VolumeLocks) Release

func (l *VolumeLocks) Release(volumeID string)

Release the lock on the specified volumeID

func (*VolumeLocks) TryAcquire

func (l *VolumeLocks) TryAcquire(volumeID string) bool

TryAcquire tries to acquire the lock for operating on volumeID and returns true if successful. If another operation is already using volumeID, returns false.

Jump to

Keyboard shortcuts

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