disk

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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 tag
	SharedEnable = "shared"
	// MkfsOptions tag
	MkfsOptions = "mkfsOptions"
	// DiskTagedByPlugin tag
	DiskTagedByPlugin = "DISK_TAGED_BY_PLUGIN"
	// DiskMetricByPlugin tag
	DiskMetricByPlugin = "DISK_METRIC_BY_PLUGIN"
	// 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"
)
View Source
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 shared sdd disk type
	DiskSharedSSD = "san_ssd"
	// DiskSharedEfficiency shared efficiency disk type
	DiskSharedEfficiency = "san_efficiency"
	// MBSIZE tag
	MBSIZE = 1024 * 1024
	// DefaultRegion is the default region id
	DefaultRegion = "cn-hangzhou"
)
View Source
const (
	TopologyZoneKey = "topology." + driverName + "/zone"
)

PluginFolder defines the location of diskplugin

Variables

View Source
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)
)

Functions

func GetDefaultAK

func GetDefaultAK() (string, string, string)

GetDefaultAK read default ak from local file or from STS

func GetDeviceByMntPoint added in v1.0.1

func GetDeviceByMntPoint(targetPath string) string

GetDeviceByMntPoint return the device info from given mount point

func GetDeviceByVolumeID added in v1.0.3

func GetDeviceByVolumeID(volumeID string) (device string, err error)

GetDeviceByVolumeID Get device by volumeID, link file should be like: /dev/disk/by-id/virtio-wz9cu3ctp6aj1iagco4h -> ../../vdc

func GetDeviceMountNum

func GetDeviceMountNum(targetPath string) int

GetDeviceMountNum get the device mount number

func GetLocalAK

func GetLocalAK() (string, string)

GetLocalAK return if ak meta defined in env

func GetMetaData

func GetMetaData(resource string) string

GetMetaData get host regionid, zoneid

func GetSTSAK

func GetSTSAK() (string, string, string)

GetSTSAK get STS AK and token from ecs meta server

func GetVolumeDeviceName added in v1.0.3

func GetVolumeDeviceName(volumeID string) string

GetVolumeDeviceName get device name

func GlobalConfigSet added in v1.0.3

func GlobalConfigSet(client *ecs.Client, region string)

GlobalConfigSet set Global Config

func IsDeviceMappedDiskIDEnabled added in v1.0.3

func IsDeviceMappedDiskIDEnabled() bool

IsDeviceMappedDiskIDEnabled Device Mapping DiskID is in testing, not all user enable this feature /dev/disk/by-id/virtio-wz9cu3ctp6aj1iagco4h -> ../../vda

func IsDeviceUsedOthers added in v1.0.1

func IsDeviceUsedOthers(deviceName, volumeID string) (bool, error)

IsDeviceUsedOthers check if the given device attached by other instance

func IsDirEmpty added in v1.0.1

func IsDirEmpty(name string) (bool, error)

IsDirEmpty check whether the given directory is empty

func IsFileExisting

func IsFileExisting(filename string) bool

IsFileExisting check file exist in volume driver

func NewControllerServer

func NewControllerServer(d *csicommon.CSIDriver, client *ecs.Client, 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

func NewNodeServer(d *csicommon.CSIDriver, c *ecs.Client) csi.NodeServer

NewNodeServer creates node server

func SetEcsEndPoint added in v1.0.2

func SetEcsEndPoint(regionID string)

SetEcsEndPoint Set Endpoint for Ecs

Types

type DISK added in v1.0.1

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

DISK the DISK object

func NewDriver

func NewDriver(nodeID, endpoint string, runAsController bool) *DISK

NewDriver create the identity/node/controller server and disk driver

func (*DISK) Run added in v1.0.1

func (disk *DISK) Run()

Run start a new NodeServer

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
	AttachMutex        sync.RWMutex
	CanAttach          bool
	DiskTagEnable      bool
	ADControllerEnable bool
	MetricEnable       bool
}

GlobalConfig save global values for plugin

var (
	GlobalConfigVar GlobalConfig
)

define global variable

type RoleAuth added in v1.0.1

type RoleAuth struct {
	AccessKeyID     string
	AccessKeySecret string
	Expiration      time.Time
	SecurityToken   string
	LastUpdated     time.Time
	Code            string
}

RoleAuth define STS Token Response

Jump to

Keyboard shortcuts

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