driver

package
v0.0.0-...-a7fc55d Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDriverName is the default name of the driver.
	DefaultDriverName = "s3.csi.k8s.io"
	// ParamServer is the address of the minio server.
	ParamServer = "server"
	// ParamShare is the base directory of the NFS server to create volumes under.
	ParamShare = "share"
	// ParamSubDir is the subdirectory under the base directory to create volumes under.
	ParamSubDir = "subdir"
	// ParamOnDelete is the policy for handling volumes on delete.
	ParamOnDelete = "ondelete"
	// MountOptionsField is the field name for mount options.
	MountOptionsField = "mountoptions"
	// MountPermissionsField is the field name for mount permissions.
	MountPermissionsField = "mountpermissions"
	// PvcNameKey is the key for PVC name.
	PvcNameKey = "csi.storage.k8s.io/pvc/name"
	// PvcNamespaceKey is the key for PVC namespace.
	PvcNamespaceKey = "csi.storage.k8s.io/pvc/namespace"
	// PvNameKey is the key for PV name.
	PvNameKey = "csi.storage.k8s.io/pv/name"
	// PvcNameMetadata is the metadata for PVC name.
	PvcNameMetadata = "${pvc.metadata.name}"
	// PvcNamespaceMetadata is the metadata for PVC namespace.
	PvcNamespaceMetadata = "${pvc.metadata.namespace}"
	// PvNameMetadata is the metadata for PV name.
	PvNameMetadata = "${pv.metadata.name}"
)

Variables

This section is empty.

Functions

func IsCorruptDir

func IsCorruptDir(dir string) bool

IsCorruptDir checks if the directory is corrupt. 检查目录是否损坏

func NewControllerServiceCapability

func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability

NewControllerServiceCapability creates a new ControllerServiceCapability

Types

type ControllerServer

type ControllerServer struct {
	*common.DefaultControllerServer
}

func NewControllerServer

func NewControllerServer(d *common.CSIDriver) *ControllerServer

NewControllerServer creates a new controller server.

func (*ControllerServer) ControllerExpandVolume

ControllerExpandVolume implements csi.ControllerServer.

func (*ControllerServer) ControllerGetCapabilities

ControllerGetCapabilities implements csi.ControllerServer.

func (*ControllerServer) ControllerGetVolume

ControllerGetVolume implements csi.ControllerServer.

func (*ControllerServer) ControllerModifyVolume

ControllerModifyVolume implements csi.ControllerServer.

func (*ControllerServer) ControllerPublishVolume

ControllerPublishVolume implements csi.ControllerServer.

func (*ControllerServer) ControllerUnpublishVolume

ControllerUnpublishVolume implements csi.ControllerServer.

func (*ControllerServer) CreateSnapshot

CreateSnapshot implements csi.ControllerServer.

func (*ControllerServer) CreateVolume

CreateVolume implements csi.ControllerServer.

func (*ControllerServer) DeleteSnapshot

DeleteSnapshot implements csi.ControllerServer.

func (*ControllerServer) DeleteVolume

DeleteVolume implements csi.ControllerServer.

func (*ControllerServer) GetCapacity

GetCapacity implements csi.ControllerServer.

func (*ControllerServer) ListSnapshots

ListSnapshots implements csi.ControllerServer.

func (*ControllerServer) ListVolumes

ListVolumes implements csi.ControllerServer.

func (*ControllerServer) ValidateVolumeCapabilities

ValidateVolumeCapabilities implements csi.ControllerServer.

type Driver

type Driver struct {
	Name                            string                             // Name is the name of the driver.
	NodeID                          string                             // NodeID is the ID of the node where the driver is running.
	Version                         string                             // Version is the version of the driver.
	EndPoint                        string                             // EndPoint is the endpoint of the driver.
	MountPermissions                uint64                             // MountPermissions is the mount permissions for the driver.
	WorkingMountDir                 string                             // WorkingMountDir is the working directory for mount operations.
	DefaultOnDeletePolicy           string                             // DefaultOnDeletePolicy is the default policy for handling volumes on delete.
	NodeServer                      *NodeServer                        // NodeServer is the server for handling node service requests.
	ControllerServer                *ControllerServer                  // ControllerServer is the server for handling controller service requests.
	IdentityServer                  *IdentityServer                    // IdentityServer is the server for handling identity service requests.
	Driver                          *common.CSIDriver                  // Driver is the CSI driver.
	ControllerServiceCapability     []*csi.ControllerServiceCapability // ControllerServiceCapability represents the capabilities of the controller service.
	NodeServiceCapability           []*csi.NodeServiceCapability       // NodeServiceCapability represents the capabilities of the node service.
	VolumeLocks                     *utils.VolumeLocks                 // VolumeLocks is used for locking volumes during operations.
	VolumeStatsCache                cache.Resource                     // VolumeStatsCache is the cache for volume statistics.
	VolumeStatsCacheExpireInMinutes int                                // VolumeStatsCacheExpireInMinutes is the expiration time for volume statistics cache.
}

Driver represents the CSI driver.

func NewDriver

func NewDriver(options *DriverOptions) (*Driver, error)

NewDriver creates a new driver object.

func (*Driver) AddControllerServiceCapabilities

func (d *Driver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapability_RPC_Type)

AddControllerServiceCapabilities adds the given controller service capabilities to the driver.

func (*Driver) Run

func (d *Driver) Run(mode bool)

Run starts the driver in the specified mode.

type DriverOptions

type DriverOptions struct {
	DriverName                      string // DriverName is the name of the CSI driver.
	NodeID                          string // NodeID is the unique identifier of the node where the driver is running.
	EndPoint                        string // EndPoint is the CSI endpoint address.
	MountPermissions                uint64 // MountPermissions is the permission mode for mounting volumes.
	WorkingMountDir                 string // WorkingMountDir is the directory where volumes are mounted.
	VolumeStatsCacheExpireInMinutes int    // VolumeStatsCacheExpireInMinutes is the expiration time for volume statistics cache in minutes.
}

DriverOptions represents the options for creating a new driver.

type IdentityServer

type IdentityServer struct {
	*common.DefaultIdentityServer
}

func NewIdentityServer

func NewIdentityServer(d *common.CSIDriver) *IdentityServer

NewIdentityServer creates a new identity server.

func (*IdentityServer) GetPluginCapabilities

GetPluginCapabilities returns the capabilities of the plugin.

func (*IdentityServer) Probe

Probe detect whether the plugin is running. 探测检查插件是否正在运行, 此方法不需要返回任何内容, 而且截至目前,规范也没有规定该返回什么, so, 返回nil

type NodeServer

type NodeServer struct {
	*common.DefaultNodeServer
}

func NewNodeServer

func NewNodeServer(d *common.CSIDriver) *NodeServer

NewNodeServer creates a new node server.

func (*NodeServer) NodeExpandVolume

NodeExpandVolume implements csi.NodeServer.

func (*NodeServer) NodeGetCapabilities

NodeGetCapabilities implements csi.NodeServer. Returns the supported capabilities of the node server.

func (*NodeServer) NodeGetInfo

NodeGetInfo implements csi.NodeServer. Returns the supported capabilities of the node server.

func (*NodeServer) NodeGetVolumeStats

NodeGetVolumeStats implements csi.NodeServer.

func (*NodeServer) NodePublishVolume

NodePublishVolume implements csi.NodeServer. Mounts the volume.

func (*NodeServer) NodeStageVolume

NodeStageVolume implements csi.NodeServer.

func (*NodeServer) NodeUnpublishVolume

NodeUnpublishVolume implements csi.NodeServer. Unmounts the volume.

func (*NodeServer) NodeUnstageVolume

NodeUnstageVolume implements csi.NodeServer.

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start starts the gRPC server and blocks until the server exits.
	Start(endponit string, is csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, mode bool)
	// WaitForStop blocks until the server is stopped.
	Wait()
	// Stop stops the gRPC server.
	Stop()
	// ForceStop stops the gRPC server immediately.
	ForceStop()
}

type NonBlockingGRPCServerOptions

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

NonBlockingGRPCServerOptions contains the options for a non-blocking gRPC server.

func NewNonBlockingGRPCServerOptions

func NewNonBlockingGRPCServerOptions() *NonBlockingGRPCServerOptions

NewNonBlockingGRPCServerOptions returns a new NonBlockingGRPCServerOptions.

func (*NonBlockingGRPCServerOptions) ForceStop

func (s *NonBlockingGRPCServerOptions) ForceStop()

ForceStop stops the gRPC server immediately.

func (*NonBlockingGRPCServerOptions) Start

Start starts the gRPC server and blocks until the server exits.

func (*NonBlockingGRPCServerOptions) Stop

func (s *NonBlockingGRPCServerOptions) Stop()

Stop stops the gRPC server.

func (*NonBlockingGRPCServerOptions) Wait

func (s *NonBlockingGRPCServerOptions) Wait()

WaitForStop blocks until the server is stopped.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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