ens

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

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"
	// 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

func GetDeviceByMntPoint(targetPath string) string

GetDeviceByMntPoint return the device info from given mount point

func GetVolumeIDByDevice

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

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 ENS

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

func NewDriver

func NewDriver(nodeID, endpoint string) *ENS

func (*ENS) Run

func (ens *ENS) Run()

type ENSClient

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

func (*ENSClient) AttachVolume

func (ec *ENSClient) AttachVolume(diskID, instanceID string) error

func (*ENSClient) CreateVolume

func (ec *ENSClient) CreateVolume(regionID, diskType, size string) (string, error)

func (*ENSClient) DeleteVolume

func (ec *ENSClient) DeleteVolume(diskID string)

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

func (ec *ENSClient) DetachVolume(diskID, instanceID string) error

type GlobalConfig

type GlobalConfig struct {
	RegionID           string
	InstanceID         string
	ClusterID          string
	DetachBeforeAttach bool
	ControllerService  bool

	EnableDiskPartition          string
	EnableAttachDetachController string
	KClient                      kubernetes.Interface
	ENSCli                       ENSClient
	AttachMutex                  sync.Mutex
}
var (
	GlobalConfigVar GlobalConfig
	ENSDiskTypeMap  = map[string]string{CLOUD_EFFICIENCY: "4", CLOUD_SSD: "3", LOCAL_HDD: "2", LOCAL_SSD: "1"}
)

Jump to

Keyboard shortcuts

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