Documentation ¶
Index ¶
- Constants
- Variables
- func GetDeviceByMntPoint(targetPath string) string
- func GetDiskFormat(disk string) (string, string, error)
- func GetVolumeIDByDevice(device string) (volumeID string, err error)
- func NewControllerServer(d *csicommon.CSIDriver) csi.ControllerServer
- func NewGlobalConfig()
- func NewIdentityServer(d *csicommon.CSIDriver) csi.IdentityServer
- func NewNodeServer(d *csicommon.CSIDriver) csi.NodeServer
- type DiskParams
- type ENS
- type ENSClient
- func (ec *ENSClient) AttachVolume(diskID, instanceID string) error
- func (ec *ENSClient) CreateVolume(regionID, diskType, size string) (string, error)
- func (ec *ENSClient) DeleteVolume(diskID string)
- func (ec *ENSClient) DescribeInstance(instanceId string) ([]*ensCli.DescribeInstancesResponseBodyInstancesInstance, error)
- func (ec *ENSClient) DescribeVolume(diskID string) (*ensCli.DescribeDisksResponseBodyDisksDisks, error)
- func (ec *ENSClient) DetachVolume(diskID, instanceID string) error
- type GlobalConfig
Constants ¶
View Source
const ( // ens disk type CLOUD_EFFICIENCY = "cloud_efficiency" CLOUD_SSD = "cloud_ssd" LOCAL_HDD = "local_hdd" LOCAL_SSD = "local_ssd" ENS_DISK_AVAILABLE = "available" // NodeSchedueTag in annotations NodeSchedueTag = "volume.kubernetes.io/selected-node" // DiskNotAvailable error DiskNotAvailable = "InvalidDataDiskCategory.NotSupported" // DiskNotAvailableVer2 error DiskNotAvailableVer2 = "'DataDisk.n.Category' is not valid in this region." TopologyRegionKey = "topology." + driverName + "/region" TopologyMultiRegionPrefix = TopologyRegionKey + "-" )
View Source
const ( // MAX_VOLUMES_PERNODE defines default max volumes count pernode MAX_VOLUMES_PERNODE = 15 // MkfsOptions tag MKFS_OPTIONS = "mkfsOptions" // NOUUID is xfs fs mount opts NOUUID = "nouuid" // fsckErrorsCorrected tag FSCK_ERRORS_CORRECTED = 1 // fsckErrorsUncorrected tag FSCK_ERRORS_UNCORRECTED = 4 // SysConfigTag tag SYS_CONFIG_TAG = "sysConfig" // INPUT_OUTPUT_ERR tag INPUT_OUTPUT_ERR = "input/output error" )
View Source
const ( // LastApplyKey key LastApplyKey = "kubectl.kubernetes.io/last-applied-configuration" // PvNameKey key PvNameKey = "csi.storage.k8s.io/pv/name" // PvcNameKey key PvcNameKey = "csi.storage.k8s.io/pvc/name" // PvcNamespaceKey key PvcNamespaceKey = "csi.storage.k8s.io/pvc/namespace" // StorageProvisionerKey key StorageProvisionerKey = "volume.beta.kubernetes.io/storage-provisioner" // NsenterCmd run command on host NsenterCmd = "/nsenter --mount=/proc/1/ns/mnt" // VolumeDir volume dir VolumeDir = "/host/etc/kubernetes/volumes/disk/" // VolumeDirRemove volume dir remove VolumeDirRemove = "/host/etc/kubernetes/volumes/disk/remove" )
View Source
const ( DISK_IN_USE = "In_use" DISK_AVAILABLE = "Available" DISK_ATTACHING = "Attaching" DISK_DETACHING = "Detaching" DISK_CREATING = "Creating" DISK_REINITING = "ReIniting" )
disk status
Variables ¶
View Source
var ( // BLOCK_VOLUME_PREFIX block volume mount prefix BLOCK_VOLUME_PREFIX = filepath.Join(utils.KubeletRootDir, "/plugins/kubernetes.io/csi/volumeDevices/publish") )
Functions ¶
func GetDeviceByMntPoint ¶
GetDeviceByMntPoint return the device info from given mount point
func GetDiskFormat ¶
GetDiskFormat uses 'blkid' to see if the given disk is unformatted
func GetVolumeIDByDevice ¶
GetVolumeIDByDevice get volumeID by specific deivce name according to by-id dictionary
func NewControllerServer ¶
func NewControllerServer(d *csicommon.CSIDriver) csi.ControllerServer
func NewGlobalConfig ¶
func NewGlobalConfig()
func NewIdentityServer ¶
func NewIdentityServer(d *csicommon.CSIDriver) csi.IdentityServer
NewIdentityServer create identity server
func NewNodeServer ¶
func NewNodeServer(d *csicommon.CSIDriver) csi.NodeServer
Types ¶
type DiskParams ¶
type DiskParams struct { RegionID string FsType string DiskType string DiskTags string NodeSelected string ResourceGroupID string }
func ValidateCreateVolumeParams ¶
func ValidateCreateVolumeParams(params map[string]string) (*DiskParams, error)
type ENSClient ¶
type ENSClient struct {
// contains filtered or unexported fields
}
func (*ENSClient) AttachVolume ¶
func (*ENSClient) CreateVolume ¶
func (*ENSClient) DeleteVolume ¶
func (*ENSClient) DescribeInstance ¶
func (ec *ENSClient) DescribeInstance(instanceId string) ([]*ensCli.DescribeInstancesResponseBodyInstancesInstance, error)
func (*ENSClient) DescribeVolume ¶
func (ec *ENSClient) DescribeVolume(diskID string) (*ensCli.DescribeDisksResponseBodyDisksDisks, error)
func (*ENSClient) DetachVolume ¶
type GlobalConfig ¶
type GlobalConfig struct { RegionID string InstanceID string ClusterID string Attachable bool DetachBeforeAttach bool ControllerService bool EnableDiskPartition string EnableAttachDetachController string KClient kubernetes.Interface ENSCli ENSClient AttachMutex sync.RWMutex }
var ( GlobalConfigVar GlobalConfig ENSDiskTypeMap = map[string]string{CLOUD_EFFICIENCY: "4", CLOUD_SSD: "3", LOCAL_HDD: "2", LOCAL_SSD: "1"} )
Click to show internal directories.
Click to hide internal directories.