Documentation ¶
Index ¶
- Constants
- Variables
- func ExecCheckOutput(cmd string, args ...string) (io.Reader, error)
- func FindLines(reader io.Reader, keyword string) []string
- func GetDeviceByBdf(bdf string, enLog bool) (device string, err error)
- func GetDeviceByMntPoint(targetPath string) string
- func GetDeviceByVolumeID(volumeID string) (device string, err error)
- func GetDeviceMountNum(targetPath string) int
- func GetMetaData(resource string) string
- func GetRegionID() string
- func GetVolumeDeviceName(diskID string) string
- func GetVolumeIDByDevice(device string) (volumeID string, err error)
- func GlobalConfigSet(client *ecs.Client, region, nodeID string) *restclient.Config
- func IohubSriovBind(bdf string) error
- func IohubSriovUnbind(bdf string) error
- func IsDeviceUsedOthers(deviceName, volumeID string) (bool, error)
- func IsDirEmpty(name string) (bool, error)
- func IsFileExisting(filename string) bool
- func IsNoSuchDeviceErr(err error) bool
- func IsVFNode() bool
- func NewControllerServer(d *csicommon.CSIDriver, client *crd.Clientset, region string) csi.ControllerServer
- func NewIdentityServer(d *csicommon.CSIDriver) csi.IdentityServer
- func NewNodeServer(d *csicommon.CSIDriver, c *ecs.Client) csi.NodeServer
- func SetEcsEndPoint(regionID string)
- func UpdateNode(nodeID string, client *kubernetes.Clientset, c *ecs.Client)
- func VirtioPciBind(bdf string) error
- func VirtioPciUnbind(bdf string) error
- type BdfAttachInfo
- type DISK
- type DefaultOptions
- type GlobalConfig
- type PatchStringValue
- type QueryResponse
- type RoleAuth
Constants ¶
const ( // VfBar0Sz value VfBar0Sz = 0x1000 // DevIDOffsetInBar0 value DevIDOffsetInBar0 = 0x100 // MaxVfNum value MaxVfNum = 256 // BlkIDSz value BlkIDSz = 20 // InstanceStatusStopped ecs stopped status InstanceStatusStopped = "Stopped" // DiskBdfTagKey disk bdf tag DiskBdfTagKey = "bdf.csi.aliyun.com" )
const ( // PERFORMANCELEVELPL1 pl1 tag PERFORMANCELEVELPL1 = "PL1" // PERFORMANCELEVELPL2 pl2 tag PERFORMANCELEVELPL2 = "PL2" // PERFORMANCELEVELPL3 pl3 tag PERFORMANCELEVELPL3 = "PL3" // DISKTAGKEY1 tag DISKTAGKEY1 = "k8s.aliyun.com" // DISKTAGVALUE1 value DISKTAGVALUE1 = "true" // DISKTAGKEY2 key DISKTAGKEY2 = "createdby" // DISKTAGVALUE2 value DISKTAGVALUE2 = "alibabacloud-csi-plugin" // DISKTAGKEY3 key DISKTAGKEY3 = "ack.aliyun.com" // SNAPSHOTFORCETAG tag SNAPSHOTFORCETAG = "forceDelete" // SNAPSHOTTAGKEY1 tag SNAPSHOTTAGKEY1 = "force.delete.snapshot.k8s.aliyun.com" // SNAPSHOTTYPE ... SNAPSHOTTYPE = "snapshotType" // INSTANTACCESS ... INSTANTACCESS = "InstantAccess" // RETENTIONDAYS ... RETENTIONDAYS = "retentionDays" // INSTANTACCESSRETENTIONDAYS ... INSTANTACCESSRETENTIONDAYS = "instantAccessRetentionDays" )
const ( // DiskStatusInuse disk inuse status DiskStatusInuse = "In_use" // DiskStatusAttaching disk attaching status DiskStatusAttaching = "Attaching" // DiskStatusAvailable disk available status DiskStatusAvailable = "Available" // DiskStatusAttached disk attached status DiskStatusAttached = "attached" // DiskStatusDetached disk detached status DiskStatusDetached = "detached" SharedEnable = "shared" // SysConfigTag tag SysConfigTag = "sysConfig" // MkfsOptions tag MkfsOptions = "mkfsOptions" // DiskTagedByPlugin tag DiskTagedByPlugin = "DISK_TAGED_BY_PLUGIN" // DiskMetricByPlugin tag DiskMetricByPlugin = "DISK_METRIC_BY_PLUGIN" // DiskDetachDisable tag DiskDetachDisable = "DISK_DETACH_DISABLE" // DiskBdfEnable tag DiskBdfEnable = "DISK_BDF_ENABLE" // DiskDetachBeforeDelete tag DiskDetachBeforeDelete = "DISK_DETACH_BEFORE_DELETE" // DiskAttachByController tag DiskAttachByController = "DISK_AD_CONTROLLER" // DiskAttachedKey attached key DiskAttachedKey = "k8s.aliyun.com" // DiskAttachedValue attached value DiskAttachedValue = "true" // VolumeDir volume dir VolumeDir = "/host/etc/kubernetes/volumes/disk/" // VolumeDirRemove volume dir remove VolumeDirRemove = "/host/etc/kubernetes/volumes/disk/remove" // MixRunTimeMode support both runc and runv MixRunTimeMode = "runc-runv" // RunvRunTimeMode tag RunvRunTimeMode = "runv" // InputOutputErr tag InputOutputErr = "input/output error" // BLOCKVOLUMEPREFIX block volume mount prefix BLOCKVOLUMEPREFIX = "/var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/publish" // FileSystemLoseCapacityPercent is the env of container FileSystemLoseCapacityPercent = "FILE_SYSTEM_LOSE_PERCENT" )
const ( // KubernetesAlicloudDiskDriver driver name KubernetesAlicloudDiskDriver = "alicloud/disk" // MetadataURL metadata URL MetadataURL = "http://100.100.100.200/latest/meta-data/" // DocumentURL document URL DocumentURL = "http://100.100.100.200/latest/dynamic/instance-identity/document" // RegionIDTag region ID RegionIDTag = "region-id" // InstanceID instance ID InstanceID = "instance-id" // DiskConflict invalid operation type DiskConflict = "InvalidOperation.Conflict" // IncorrectDiskStatus incorrect disk status IncorrectDiskStatus = "IncorrectDiskStatus" // DiskCreatingSnapshot ... DiskCreatingSnapshot = "DiskCreatingSnapshot" // UserNotInTheWhiteList tag UserNotInTheWhiteList = "UserNotInTheWhiteList" // TagK8sPV tag TagK8sPV = "k8s-pv" // ZoneIDTag tag ZoneIDTag = "zone-id" // LogfilePrefix tag LogfilePrefix = "/var/log/alicloud/provisioner" // DiskNotAvailable tag DiskNotAvailable = "InvalidDataDiskCategory.NotSupported" // DiskSizeNotAvailable tag DiskSizeNotAvailable = "InvalidDiskSize.NotSupported" // DiskLimitExceeded tag DiskLimitExceeded = "InstanceDiskLimitExceeded" // DiskNotPortable tag DiskNotPortable = "DiskNotPortable" // DiskHighAvail tag DiskHighAvail = "available" // DiskCommon common disk type DiskCommon = "cloud" // DiskEfficiency efficiency disk type DiskEfficiency = "cloud_efficiency" // DiskSSD ssd disk type DiskSSD = "cloud_ssd" // DiskESSD essd disk type DiskESSD = "cloud_essd" DiskSharedSSD = "san_ssd" DiskSharedEfficiency = "san_efficiency" // MBSIZE tag MBSIZE = 1024 * 1024 // GBSIZE tag GBSIZE = 1024 * MBSIZE // DefaultRegion is the default region id DefaultRegion = "cn-hangzhou" // DiskUUIDPath tag DiskUUIDPath = "/host/etc/kubernetes/volumes/disk/uuid" // ZoneID ... ZoneID = "zoneId" // NodeSchedueTag in annotations NodeSchedueTag = "volume.kubernetes.io/selected-node" )
const (
TopologyZoneKey = "topology." + driverName + "/zone"
)
PluginFolder defines the location of diskplugin
Variables ¶
var ( // VERSION should be updated by hand at each release VERSION = "v1.14.6" // GITCOMMIT will be overwritten automatically by the build system GITCOMMIT = "HEAD" // KubernetesAlicloudIdentity is the system identity for ecs client request KubernetesAlicloudIdentity = fmt.Sprintf("Kubernetes.Alicloud/CsiProvision.Disk-%s", VERSION) // AvaliableDiskTypes ... AvaliableDiskTypes = []string{DiskCommon, DiskESSD, DiskEfficiency, DiskSSD, DiskSharedSSD, DiskSharedEfficiency} // CustomDiskTypes ... CustomDiskTypes = map[string]int{DiskESSD: 0, DiskSSD: 1, DiskEfficiency: 2} )
Functions ¶
func ExecCheckOutput ¶ added in v1.0.5
ExecCheckOutput check output
func GetDeviceByBdf ¶ added in v1.0.5
GetDeviceByBdf get device name by bdf
func GetDeviceByMntPoint ¶ added in v1.0.1
GetDeviceByMntPoint return the device info from given mount point
func GetDeviceByVolumeID ¶ added in v1.0.3
GetDeviceByVolumeID First try to find the device by serial If cannot find the device using the serial number, get device by volumeID, link file should be like: /dev/disk/by-id/virtio-wz9cu3ctp6aj1iagco4h -> ../../vdc
func GetDeviceMountNum ¶
GetDeviceMountNum get the device mount number
func GetRegionID ¶ added in v1.1.0
func GetRegionID() string
GetRegionID Get RegionID from Environment Variables or Metadata
func GetVolumeDeviceName ¶ added in v1.0.3
GetVolumeDeviceName get device name
func GetVolumeIDByDevice ¶ added in v1.1.0
GetVolumeIDByDevice get volumeID by specific deivce name according to by-id dictionary
func GlobalConfigSet ¶ added in v1.0.3
func GlobalConfigSet(client *ecs.Client, region, nodeID string) *restclient.Config
GlobalConfigSet set Global Config
func IohubSriovBind ¶ added in v1.0.5
IohubSriovBind io hub bind
func IohubSriovUnbind ¶ added in v1.0.5
IohubSriovUnbind io hub unbind
func IsDeviceUsedOthers ¶ added in v1.0.1
IsDeviceUsedOthers check if the given device attached by other instance
func IsDirEmpty ¶ added in v1.0.1
IsDirEmpty check whether the given directory is empty
func IsFileExisting ¶
IsFileExisting check file exist in volume driver
func IsNoSuchDeviceErr ¶ added in v1.0.5
IsNoSuchDeviceErr nd device error
func IsVFNode ¶ added in v1.0.6
func IsVFNode() bool
IsVFNode returns whether the current node is vf
func NewControllerServer ¶
func NewControllerServer(d *csicommon.CSIDriver, client *crd.Clientset, region string) csi.ControllerServer
NewControllerServer is to create controller server
func NewIdentityServer ¶
func NewIdentityServer(d *csicommon.CSIDriver) csi.IdentityServer
NewIdentityServer create identity server
func NewNodeServer ¶
NewNodeServer creates node server
func SetEcsEndPoint ¶ added in v1.0.2
func SetEcsEndPoint(regionID string)
SetEcsEndPoint Set Endpoint for Ecs
func UpdateNode ¶ added in v1.1.2
func UpdateNode(nodeID string, client *kubernetes.Clientset, c *ecs.Client)
UpdateNode ...
func VirtioPciUnbind ¶ added in v1.0.5
VirtioPciUnbind pci unbind
Types ¶
type BdfAttachInfo ¶ added in v1.0.5
type BdfAttachInfo struct { Depend bool `json:"depend"` LastAttachedNodeID string `json:"last_attached_node_id"` }
BdfAttachInfo type
type DISK ¶ added in v1.0.1
type DISK struct {
// contains filtered or unexported fields
}
DISK the DISK object
type DefaultOptions ¶
type DefaultOptions struct { Global struct { KubernetesClusterTag string AccessKeyID string `json:"accessKeyID"` AccessKeySecret string `json:"accessKeySecret"` Region string `json:"region"` } }
DefaultOptions is the struct for access key
type GlobalConfig ¶ added in v1.0.3
type GlobalConfig struct { EcsClient *ecs.Client Region string NodeID string AttachMutex sync.RWMutex CanAttach bool DiskTagEnable bool ADControllerEnable bool DetachDisabled bool MetricEnable bool RunTimeClass string DetachBeforeDelete bool DiskBdfEnable bool ClientSet *kubernetes.Clientset FilesystemLosePercent float64 ClusterID string }
GlobalConfig save global values for plugin
var (
GlobalConfigVar GlobalConfig
)
define global variable
type PatchStringValue ¶ added in v1.0.5
type PatchStringValue struct { Op string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
PatchStringValue type
type QueryResponse ¶ added in v1.0.4
type QueryResponse struct {
// contains filtered or unexported fields
}
QueryResponse response struct for query server