Documentation
¶
Index ¶
- Constants
- Variables
- func CheckIRODSVolume(id string) bool
- func GetDriverVersion() string
- func GetVersionJSON() (string, error)
- func IRODSMkdir(conn *IRODSConnectionInfo, path string) error
- func IRODSRmdir(conn *IRODSConnectionInfo, path string) error
- func IRODSTestConnection(conn *IRODSConnectionInfo) error
- func IsCorruptedMnt(err error) bool
- func IsValidIRODSClientType(client string) bool
- func ListProcMounts(mountFilePath string) ([]mount.MountPoint, error)
- func MakeDir(path string) error
- func MakeMountArgsSensitive(source, sourceMasked, target, fstype string, options []string, ...) (mountArgs []string, mountArgsLogStr string)
- func ParseEndpoint(endpoint string) (string, string, error)
- func PathExists(path string) (bool, error)
- func PutIRODSVolume(volume *IRODSVolume)
- func ReadIRODSSecrets(secretPath string) (map[string]string, error)
- func SearchMountPoints(hostSource, mountInfoPath string) ([]string, error)
- type ClientType
- type Config
- type Driver
- func (driver *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
- func (driver *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
- func (driver *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
- func (driver *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
- func (driver *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
- func (driver *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
- func (driver *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
- func (driver *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
- func (driver *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
- func (driver *Driver) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
- func (driver *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
- func (driver *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
- func (driver *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
- func (driver *Driver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
- func (driver *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (driver *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (driver *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
- func (driver *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (driver *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
- func (driver *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (driver *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
- func (driver *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)
- func (driver *Driver) Run() error
- func (driver *Driver) Stop()
- func (driver *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
- type IRODSConnectionInfo
- type IRODSFSConfig
- type IRODSFSPathMapping
- type IRODSNFSConnectionInfo
- type IRODSVolume
- type IRODSWebDAVConnectionInfo
- type MountInfo
- type Mounter
- type NodeMounter
- func (mounter *NodeMounter) GetDeviceName(mountPath string) (string, int, error)
- func (mounter *NodeMounter) GetMountRefs(pathname string) ([]string, error)
- func (mounter *NodeMounter) IsLikelyNotMountPoint(file string) (bool, error)
- func (mounter *NodeMounter) List() ([]mount.MountPoint, error)
- func (mounter *NodeMounter) Mount(source string, target string, fstype string, options []string) error
- func (mounter *NodeMounter) MountSensitive(source string, target string, fstype string, options []string, ...) error
- func (mounter *NodeMounter) MountSensitive2(source string, sourceMasked string, target string, fstype string, ...) error
- func (mounter *NodeMounter) Unmount(target string) error
- type VersionInfo
Constants ¶
const ( PortDefault int = 1247 PerFileBlockCacheMaxDefault int = 3 ConnectionMaxDefault int = 10 OperationTimeoutDefault time.Duration = 5 * time.Minute ConnectionIdleTimeoutDefault time.Duration = 5 * time.Minute CacheTimeoutDefault time.Duration = 5 * time.Minute CacheCleanupTimeDefault time.Duration = 5 * time.Minute )
Variables ¶
var ( // DefaultVolumeSize specifies default volume size in Bytes DefaultVolumeSize int64 = 100 * 1024 * 1024 * 1024 )
Functions ¶
func CheckIRODSVolume ¶ added in v0.2.0
CheckIRODSVolume returns presence of IRODSVolume with given id
func GetDriverVersion ¶
func GetDriverVersion() string
GetDriverVersion returns driver version in string
func GetVersionJSON ¶
GetVersionJSON returns VersionInfo object in JSON string
func IRODSMkdir ¶ added in v0.2.0
func IRODSMkdir(conn *IRODSConnectionInfo, path string) error
IRODSMkdir creates a new directory
func IRODSRmdir ¶ added in v0.2.0
func IRODSRmdir(conn *IRODSConnectionInfo, path string) error
IRODSRmdir deletes a directory
func IRODSTestConnection ¶ added in v0.3.0
func IRODSTestConnection(conn *IRODSConnectionInfo) error
IRODSTestConnection just test connection creation
func IsCorruptedMnt ¶
IsCorruptedMnt return true if err is about corrupted mount point
func IsValidIRODSClientType ¶ added in v0.2.0
IsValidIRODSClientType checks if given client string is valid
func ListProcMounts ¶
func ListProcMounts(mountFilePath string) ([]mount.MountPoint, error)
ListProcMounts is shared with NsEnterMounter
func MakeMountArgsSensitive ¶
func MakeMountArgsSensitive(source, sourceMasked, target, fstype string, options []string, sensitiveOptions []string) (mountArgs []string, mountArgsLogStr string)
MakeMountArgsSensitive makes the arguments to the mount(8) command. sensitiveOptions is an extension of options except they will not be logged (because they may contain sensitive material)
func ParseEndpoint ¶
ParseEndpoint parses endpoint string (TCP or UNIX)
func PathExists ¶
PathExists returns true if the specified path exists. TODO: clean this up to use pkg/util/file/FileExists
func PutIRODSVolume ¶ added in v0.2.0
func PutIRODSVolume(volume *IRODSVolume)
PutIRODSVolume puts IRODSVolume
func ReadIRODSSecrets ¶ added in v0.2.0
ReadIRODSSecrets reads secrets from secret volume mount
func SearchMountPoints ¶
SearchMountPoints finds all mount references to the source, returns a list of mountpoints. The source can be a mount point or a normal directory (bind mount). We didn't support device because there is no use case by now. Some filesystems may share a source name, e.g. tmpfs. And for bind mounting, it's possible to mount a non-root path of a filesystem, so we need to use root path and major:minor to represent mount source uniquely. This implementation is shared between Linux and NsEnterMounter
Types ¶
type ClientType ¶ added in v0.2.2
type ClientType string
ClientType is a mount client type
const ( // FuseType is for iRODS FUSE FuseType ClientType = "irodsfuse" // WebdavType is for WebDav client (Davfs2) WebdavType ClientType = "webdav" // NfsType is for NFS client NfsType ClientType = "nfs" )
mount driver (iRODS Client) types
func ExtractIRODSClientType ¶ added in v0.2.0
func ExtractIRODSClientType(params map[string]string, secrets map[string]string, defaultClient ClientType) ClientType
ExtractIRODSClientType extracts iRODS Client value from param map
func GetValidiRODSClientType ¶ added in v0.2.2
func GetValidiRODSClientType(client string, defaultClient ClientType) ClientType
GetValidiRODSClientType checks if given client string is valid
type Config ¶
type Config struct { Endpoint string // CSI endpoint NodeID string // node ID SecretPath string // Secret mount path }
Config holds the parameters list which can be configured
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver object contains configuration parameters, grpc server and mounter
func (*Driver) ControllerExpandVolume ¶ added in v0.2.0
func (driver *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
ControllerExpandVolume expands a volume
func (*Driver) ControllerGetCapabilities ¶ added in v0.2.0
func (driver *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
ControllerGetCapabilities returns capabilities
func (*Driver) ControllerPublishVolume ¶ added in v0.2.0
func (driver *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
ControllerPublishVolume handles persistent volume publish event in controller service
func (*Driver) ControllerUnpublishVolume ¶ added in v0.2.0
func (driver *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
ControllerUnpublishVolume handles persistent volume unpublish event in controller service
func (*Driver) CreateSnapshot ¶ added in v0.2.0
func (driver *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
CreateSnapshot creates a snapshot of a volume
func (*Driver) CreateVolume ¶ added in v0.2.0
func (driver *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
CreateVolume handles persistent volume creation event
func (*Driver) DeleteSnapshot ¶ added in v0.2.0
func (driver *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
DeleteSnapshot deletes a snapshot of a volume
func (*Driver) DeleteVolume ¶ added in v0.2.0
func (driver *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
DeleteVolume handles persistent volume deletion event
func (*Driver) GetCapacity ¶ added in v0.2.0
func (driver *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
GetCapacity returns volume capacity
func (*Driver) GetPluginCapabilities ¶
func (driver *Driver) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
GetPluginCapabilities returns plugin capabilities
func (*Driver) GetPluginInfo ¶
func (driver *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
GetPluginInfo returns plugin info
func (*Driver) ListSnapshots ¶ added in v0.2.0
func (driver *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
ListSnapshots returns a list of snapshots
func (*Driver) ListVolumes ¶ added in v0.2.0
func (driver *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
ListVolumes returns a list of volumes created
func (*Driver) NodeExpandVolume ¶
func (driver *Driver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
NodeExpandVolume expands volume
func (*Driver) NodeGetCapabilities ¶
func (driver *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
NodeGetCapabilities returns capabilities
func (*Driver) NodeGetInfo ¶
func (driver *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
NodeGetInfo returns node info
func (*Driver) NodeGetVolumeStats ¶
func (driver *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
NodeGetVolumeStats returns volume stats
func (*Driver) NodePublishVolume ¶
func (driver *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
NodePublishVolume handles persistent volume publish event in node service
func (*Driver) NodeStageVolume ¶
func (driver *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
NodeStageVolume handles persistent volume stage event in node service
func (*Driver) NodeUnpublishVolume ¶
func (driver *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
NodeUnpublishVolume handles persistent volume unpublish event in node service
func (*Driver) NodeUnstageVolume ¶
func (driver *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
NodeUnstageVolume handles persistent volume unstage event in node service
func (*Driver) Probe ¶
func (driver *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)
Probe returns probe response
func (*Driver) ValidateVolumeCapabilities ¶ added in v0.2.0
func (driver *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
ValidateVolumeCapabilities checks validity of volume capabilities
type IRODSConnectionInfo ¶ added in v0.3.0
type IRODSConnectionInfo struct { Hostname string Port int Zone string User string Password string ClientUser string // if this field has a value, user and password fields have proxy user info PathMappings []IRODSFSPathMapping }
IRODSConnectionInfo class
func ExtractIRODSConnectionInfo ¶ added in v0.3.0
func ExtractIRODSConnectionInfo(params map[string]string, secrets map[string]string) (*IRODSConnectionInfo, error)
ExtractIRODSConnectionInfo extracts IRODSConnectionInfo value from param map
func NewIRODSConnectionInfo ¶ added in v0.3.0
func NewIRODSConnectionInfo(hostname string, port int, zone string, user string, password string, clientUser string, pathMappings []IRODSFSPathMapping) *IRODSConnectionInfo
NewIRODSConnectionInfo returns a new instance of IRODSConnectionInfo
type IRODSFSConfig ¶ added in v0.3.0
type IRODSFSConfig struct { Host string `yaml:"host"` Port int `yaml:"port"` ProxyUser string `yaml:"proxy_user"` ClientUser string `yaml:"client_user"` Zone string `yaml:"zone"` Password string `yaml:"password"` PathMappings []IRODSFSPathMapping `yaml:"path_mappings"` PerFileBlockCacheMax int `yaml:"per_file_block_cache_max"` OperationTimeout time.Duration `yaml:"operation_timeout"` ConnectionIdleTimeout time.Duration `yaml:"connection_idle_timeout"` ConnectionMax int `yaml:"connection_max"` CacheTimeout time.Duration `yaml:"cache_timeout"` CacheCleanupTime time.Duration `yaml:"cache_cleanup_time"` LogPath string `yaml:"log_path,omitempty"` AllowOther bool `yaml:"allow_other,omitempty"` }
func NewDefaultIRODSFSConfig ¶ added in v0.3.0
func NewDefaultIRODSFSConfig() *IRODSFSConfig
NewDefaultIRODSFSConfig creates default IRODSFSConfig
type IRODSFSPathMapping ¶ added in v0.3.0
type IRODSFSPathMapping struct { IRODSPath string `yaml:"irods_path" json:"irods_path"` MappingPath string `yaml:"mapping_path" json:"mapping_path"` ResourceType string `yaml:"resource_type" json:"resource_type"` // file or dir CreateDir bool `yaml:"create_dir" json:"create_dir"` IgnoreNotExist bool `yaml:"ignore_not_exist" json:"ignore_not_exist"` }
PathMapping ...
type IRODSNFSConnectionInfo ¶ added in v0.3.0
IRODSNFSConnectionInfo class
func ExtractIRODSNFSConnectionInfo ¶ added in v0.3.0
func ExtractIRODSNFSConnectionInfo(params map[string]string, secrets map[string]string) (*IRODSNFSConnectionInfo, error)
ExtractIRODSNFSConnectionInfo extracts IRODSNFSConnectionInfo value from param map
func NewIRODSNFSConnectionInfo ¶ added in v0.3.0
func NewIRODSNFSConnectionInfo(hostname string, port int, path string) *IRODSNFSConnectionInfo
NewIRODSNFSConnectionInfo returns a new instance of IRODSNFSConnectionInfo
type IRODSVolume ¶ added in v0.2.0
type IRODSVolume struct { ID string Name string RootPath string Path string ConnectionInfo *IRODSConnectionInfo RetainData bool }
IRODSVolume class
func GetIRODSVolume ¶ added in v0.2.0
func GetIRODSVolume(id string) *IRODSVolume
GetIRODSVolume returns IRODSVolume with given id
func NewIRODSVolume ¶ added in v0.2.0
func NewIRODSVolume(id string, name string, rootPath string, path string, connInfo *IRODSConnectionInfo, retainData bool) *IRODSVolume
NewIRODSVolume returns a new instance of IRODSVolume
func PopIRODSVolume ¶ added in v0.2.0
func PopIRODSVolume(id string) *IRODSVolume
PopIRODSVolume returns IRODSVolume with given id and delete
type IRODSWebDAVConnectionInfo ¶ added in v0.3.0
IRODSWebDAVConnectionInfo class
func ExtractIRODSWebDAVConnectionInfo ¶ added in v0.3.0
func ExtractIRODSWebDAVConnectionInfo(params map[string]string, secrets map[string]string) (*IRODSWebDAVConnectionInfo, error)
ExtractIRODSWebDAVConnectionInfo extracts IRODSWebDAVConnectionInfo value from param map
func NewIRODSWebDAVConnectionInfo ¶ added in v0.3.0
func NewIRODSWebDAVConnectionInfo(url string, user string, password string) *IRODSWebDAVConnectionInfo
NewIRODSWebDAVConnectionInfo returns a new instance of IRODSWebDAVConnectionInfo
type MountInfo ¶
type MountInfo struct { // Unique ID for the mount (maybe reused after umount). ID int // The ID of the parent mount (or of self for the root of this mount namespace's mount tree). ParentID int // Major indicates one half of the device ID which identifies the device class // (parsed from `st_dev` for files on this filesystem). Major int // Minor indicates one half of the device ID which identifies a specific // instance of device (parsed from `st_dev` for files on this filesystem). Minor int // The pathname of the directory in the filesystem which forms the root of this mount. Root string // Mount source, filesystem-specific information. e.g. device, tmpfs name. Source string // Mount point, the pathname of the mount point. MountPoint string // Optional fieds, zero or more fields of the form "tag[:value]". OptionalFields []string // The filesystem type in the form "type[.subtype]". FsType string // Per-mount options. MountOptions []string // Per-superblock options. SuperOptions []string }
MountInfo represents a single line in /proc/<pid>/mountinfo.
func ParseMountInfo ¶
ParseMountInfo parses /proc/xxx/mountinfo.
type NodeMounter ¶
func (*NodeMounter) GetDeviceName ¶
func (mounter *NodeMounter) GetDeviceName(mountPath string) (string, int, error)
func (*NodeMounter) GetMountRefs ¶
func (mounter *NodeMounter) GetMountRefs(pathname string) ([]string, error)
GetMountRefs finds all mount references to pathname, returns a list of paths. Path could be a mountpoint or a normal directory (for bind mount).
func (*NodeMounter) IsLikelyNotMountPoint ¶
func (mounter *NodeMounter) IsLikelyNotMountPoint(file string) (bool, error)
IsLikelyNotMountPoint determines if a directory is not a mountpoint. It is fast but not necessarily ALWAYS correct. If the path is in fact a bind mount from one part of a mount to another it will not be detected. It also can not distinguish between mountpoints and symbolic links. mkdir /tmp/a /tmp/b; mount --bind /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b") will return true. When in fact /tmp/b is a mount point. If this situation is of interest to you, don't use this function...
func (*NodeMounter) List ¶
func (mounter *NodeMounter) List() ([]mount.MountPoint, error)
List returns a list of all mounted filesystems.
func (*NodeMounter) Mount ¶
func (mounter *NodeMounter) Mount(source string, target string, fstype string, options []string) error
Mount mounts source to target as fstype with given options. 'source' and 'fstype' must be an empty string in case it's not required, e.g. for remount, or for auto filesystem type, where kernel handles fstype for you. The mount 'options' is a list of options, currently come from mount(8), e.g. "ro", "remount", "bind", etc. If no more option is required, call Mount with an empty string list or nil.
func (*NodeMounter) MountSensitive ¶
func (mounter *NodeMounter) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error
MountSensitive is the same as Mount() but this method allows sensitiveOptions to be passed in a separate parameter from the normal mount options and ensures the sensitiveOptions are never logged. This method should be used by callers that pass sensitive material (like passwords) as mount options.
func (*NodeMounter) MountSensitive2 ¶
func (*NodeMounter) Unmount ¶
func (mounter *NodeMounter) Unmount(target string) error
Unmount unmounts the target.
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"` }
VersionInfo object contains version related info