qingcloud

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionFSType         = "kubernetes.io/fsType"
	OptionReadWrite      = "kubernetes.io/readwrite"
	OptionPVorVolumeName = "kubernetes.io/pvOrVolumeName"
	OptionVolumeID       = "volumeID"

	DefaultFSType  = "ext4"
	FSType         = "ext4"
	FlexDriverName = "qingcloud/flex-volume"

	DefaultQingCloudConfigPath = "/etc/qingcloud/client.yaml"
)
View Source
const (
	ProvisionerName = "qingcloud/volume-provisioner"

	// VolumeGidAnnotationKey is the key of the annotation on the PersistentVolume
	// object that specifies a supplemental GID.
	VolumeGidAnnotationKey = "pv.beta.kubernetes.io/gid"
)
View Source
const (
	VolumeTypeNone = VolumeType(-1)
	//https://docs.qingcloud.com/api/volume/describe_volumes.html
	//High Performance
	VolumeTypeHP = VolumeType(0)
	//High Capacity
	VolumeTypeHC = VolumeType(2)
	//Super High Performance
	VolumeTypeSHP = VolumeType(3)

	DefaultVolumeType = VolumeTypeHP

	//DefaultMaxQingCloudVolumes is the limit for volumes attached to an instance.
	DefaultMaxQingCloudVolumes = 10
	DriverDir                  = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"
)

Variables

View Source
var (
	VERSION     string = "dev"
	GIT_SHA1    string = "dev+git"
	BUILD_LABEL string = "please use make to generate build files"
)

Functions

func NewFlexVolumePlugin

func NewFlexVolumePlugin() (flex.VolumePlugin, error)

func NewProvisioner

func NewProvisioner(qcConfigPath string) (controller.Provisioner, error)

func PreDetach added in v1.3.2

func PreDetach(volumeID string) (int, error)

func RoundUpVolumeCapacity

func RoundUpVolumeCapacity(capacity resource.Quantity, volumeType VolumeType) (int, error)

RoundUpVolumeCapacity return volume size in GiB

Types

type VolumeManager

type VolumeManager interface {
	// Attach the disk to the specified instance
	// Returns the device (e.g. /dev/sdb) where we attached the volume
	// It checks if volume is already attached to node and succeeds in that case.
	AttachVolume(volumeID string, instanceID string) (string, error)

	// Detach the disk from the specified instance
	DetachVolume(volumeID string, instanceID string) error

	// Create a volume with the specified options
	CreateVolume(volumeOptions *VolumeOptions) (volumeID string, err error)

	// Delete the specified volume
	// Returns true if the volume was deleted
	// If the was not found, returns (false, nil)
	DeleteVolume(volumeID string) (bool, error)

	// UpdateVolume attribute by volumeID
	UpdateVolume(volumeID, volumeName string) error

	// Get volume id and related instance id by volume name
	GetVolumeInfoByName(volumeName string) (volumeID, instanceID string, err error)

	// Check if the volume is already attached to the instance
	VolumeIsAttached(volumeID string, instanceID string) (bool, error)
	// Check if the volume is already attached
	VolumeIsAttachedByID(volumeID string) (bool, error)
	// Check if a list of volumes are attached to the node with the specified NodeName
	DisksAreAttached(volumeIDs []string, instanceID string) (map[string]bool, error)

	GetDefaultVolumeType() VolumeType

	//GetDeviceByVolumeID
	GetDeviceByVolumeID(volumeID string) (string, error)
}

VolumeManager is an interface for managing cloud-provisioned volumes

type VolumeOptions

type VolumeOptions struct {
	CapacityGB int
	VolumeType VolumeType
	VolumeName string
}

VolumeOptions specifies capacity and type for a volume. See https://docs.qingcloud.com/api/volume/create_volumes.html

type VolumeType

type VolumeType int

Jump to

Keyboard shortcuts

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