pkg

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Gi          uint64 = 1024 * 1024 * 1024
	Mi          uint64 = 1024 * 1024
	DefaultPort int32  = 23000

	StrategyBinpack StrategyType = "binpack"
	StrategySpread  StrategyType = "spread"

	EnvSchedulerExtenderServiceIP   = "EXTENDER_SVC_IP"
	EnvSchedulerExtenderServicePort = "EXTENDER_SVC_PORT"

	AgentName           string = "open-local-agent"
	ProvisionerNameYoda string = "yodaplugin.csi.alibabacloud.com"
	ProvisionerName     string = "local.csi.aliyun.com"
	SchedulerName       string = "open-local-scheduler"

	KubernetesNodeIdentityKey = "kubernetes.io/hostname"
	VolumeTypeKey             = "volumeType"
	VolumeFSTypeKey           = "fsType"
	VolumeMediaType           = "mediaType"
	VolumeFSTypeExt4          = "ext4"
	VolumeFSTypeExt3          = "ext3"
	VolumeFSTypeXFS           = "xfs"
	VolumeIOPS                = "iops"
	VolumeBPS                 = "bps"

	BPSReadFile   = "blkio.throttle.read_bps_device"
	BPSWriteFile  = "blkio.throttle.write_bps_device"
	IOPSReadFile  = "blkio.throttle.read_iops_device"
	IOPSWriteFile = "blkio.throttle.write_iops_device"

	PVName       = "csi.storage.k8s.io/pv/name"
	PVCName      = "csi.storage.k8s.io/pvc/name"
	PVCNameSpace = "csi.storage.k8s.io/pvc/namespace"
	Ephemeral    = "csi.storage.k8s.io/ephemeral"
	VGName       = "vgName"
	MPName       = "MountPoint"
	DeviceName   = "Device"

	DefaultSnapshotInitialSize   = 4 * 1024 * 1024 * 1024
	DefaultSnapshotThreshold     = 0.5
	DefaultSnapshotExpansionSize = 1 * 1024 * 1024 * 1024
	ParamSnapshotInitialSize     = "csi.aliyun.com/snapshot-initial-size"
	ParamSnapshotThreshold       = "csi.aliyun.com/snapshot-expansion-threshold"
	ParamSnapshotExpansionSize   = "csi.aliyun.com/snapshot-expansion-size"

	// VolumeType MUST BE case sensitive
	VolumeTypeMountPoint VolumeType = "MountPoint"
	VolumeTypeLVM        VolumeType = "LVM"
	VolumeTypeDevice     VolumeType = "Device"
	VolumeTypeQuota      VolumeType = "Quota"
	VolumeTypeUnknown    VolumeType = "Unknown"
	MediaTypeSSD         MediaType  = "ssd"
	MediaTypeHDD         MediaType  = "hdd"
	MediaTypeUnspecified MediaType  = "Unspecified"

	// This annotation is added to a PVC that has been triggered by scheduler to
	// be dynamically provisioned. Its value is the name of the selected node.
	AnnoSelectedNode                     = "volume.kubernetes.io/selected-node"
	LabelReschduleTimestamp              = "csi.aliyun.com/reschdule-timestamp"
	EnvForceCreateVG                     = "Force_Create_VG"
	PendingWithoutScheduledFieldSelector = "status.phase=Pending,spec.nodeName="
	TriggerPendingPodCycle               = time.Second * 300

	ParamSnapshotID       = "csi.aliyun.com/snapshot-id"
	ParamReadonly         = "csi.aliyun.com/readonly"
	ParamSourceVolumeID   = "csi.aliyun.com/source-volume-id"
	ParamVGName           = "vgName"
	ParamLVSize           = "size"
	EnvSnapshotPrefix     = "SNAPSHOT_PREFIX"
	EnvExpandSnapInterval = "Expand_Snapshot_Interval"
	DefaultSnapshotPrefix = "snap"

	EnvMNTDoubleCheck = "MNT_Double_Check"

	Separator = "<:SEP:>"

	// lv tags
	Lvm2LVNameTag        = "LVM2_LV_NAME"
	Lvm2LVSizeTag        = "LVM2_LV_SIZE"
	Lvm2LVKernelMajorTag = "LVM2_LV_KERNEL_MAJOR"
	Lvm2LVKernelMinorTag = "LVM2_LV_KERNEL_MINOR"
	Lvm2LVAttrTag        = "LVM2_LV_ATTR"
	Lvm2LVUuidTag        = "LVM2_LV_UUID"
	Lvm2CopyPercentTag   = "LVM2_COPY_PERCENT"
	Lvm2LVTagsTag        = "LVM2_LV_TAGS"

	// vg tags
	Lvm2VGNameTag  = "LVM2_VG_NAME"
	Lvm2VGSizeTag  = "LVM2_VG_SIZE"
	Lvm2VGFreeTag  = "LVM2_VG_FREE"
	Lvm2VGUuidTag  = "LVM2_VG_UUID"
	Lvm2VGTagsTag  = "LVM2_VG_TAGS"
	Lvm2PVCountTag = "LVM2_PV_COUNT"

	// pv tags
	Lvm2PVUuidTag = "LVM2_PV_UUID"
	Lvm2PVNameTag = "LVM2_PV_NAME"
	Lvm2PVSizeTag = "LVM2_PV_SIZE"
	Lvm2PVFreeTag = "LVM2_PV_FREE"
	Lvm2PVTagsTag = "LVM2_PV_TAGS"

	// EVENT
	EventCreateVGFailed = "CreateVGFailed"

	NsenterCmd = "nsenter --mount=/proc/1/ns/mnt --ipc=/proc/1/ns/ipc --net=/proc/1/ns/net --uts=/proc/1/ns/uts "

	/*
		record: PVC->VG mapper
		- update by schedulerFramework prebind
		- read by schedulerFramework eventHandlers onPodAdd/Update
	*/
	AnnotationPodPVCAllocatedNeedMigrateKey = "csi.aliyun.com/pod-pvc-migrate"

	/*
		record: vgName to PV
		- update by nsl controller
		- read by csi: nodeServer publishVolume
	*/
	AnnotationPVAllocatedInfoKey = "csi.aliyun.com/pv-allocated"

	AnnDeletionSecretRefName      = "snapshot.storage.kubernetes.io/deletion-secret-name"
	AnnDeletionSecretRefNamespace = "snapshot.storage.kubernetes.io/deletion-secret-namespace"
	ParamSnapshotSecretName       = "csi.storage.k8s.io/snapshotter-secret-name"
	ParamSnapshotSecretNamespace  = "csi.storage.k8s.io/snapshotter-secret-namespace"
)

Variables

View Source
var (
	ValidProvisionerNames = []string{
		ProvisionerNameYoda,
		ProvisionerName,
	}
	ValidVolumeType = []VolumeType{
		VolumeTypeMountPoint,
		VolumeTypeLVM,
		VolumeTypeDevice,
		VolumeTypeQuota,
	}
	SupportedFS       = []string{VolumeFSTypeExt3, VolumeFSTypeExt4, VolumeFSTypeXFS}
	SchedulerStrategy = StrategyBinpack

	S3_URL            = "s3URL"
	S3_AK             = "s3AK"
	S3_SK             = "s3SK"
	S3_Token          = "s3Token"
	S3_Region         = "s3REGION"
	S3_ForcePathStyle = "s3ForcePathStyle"
	S3_DisableSSL     = "s3DisableSSL"
)

Functions

func GetAllocateInfoJSONFromPod added in v0.6.0

func GetAllocateInfoJSONFromPod(pod *corev1.Pod) string

Types

type BindingInfo added in v0.6.0

type BindingInfo struct {
	// node is the name of selected node
	Node string `json:"node"`
	// path for mount point
	Disk string `json:"disk"`
	// VgName is the name of selected volume group
	VgName string `json:"vgName"`
	// Device is the name for raw block device: /dev/vdb
	Device string `json:"device"`
	// [lvm] or [disk] or [device] or [quota]
	VolumeType string `json:"volumeType"`

	// PersistentVolumeClaim is the metakey for pvc: {namespace}/{name}
	PersistentVolumeClaim string `json:"persistentVolumeClaim"`
}

BindingInfo represents the pvc and disk/lvm mapping

type MediaType

type MediaType string

type NodeAntiAffinityWeight

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

func NewNodeAntiAffinityWeight

func NewNodeAntiAffinityWeight() *NodeAntiAffinityWeight

func (*NodeAntiAffinityWeight) Get

func (w *NodeAntiAffinityWeight) Get(volumeType VolumeType) int

func (*NodeAntiAffinityWeight) Items

func (w *NodeAntiAffinityWeight) Items(copy bool) map[VolumeType]int

func (*NodeAntiAffinityWeight) Put

func (w *NodeAntiAffinityWeight) Put(volumeType VolumeType, weight int)

type PVAllocatedInfo added in v0.6.0

type PVAllocatedInfo struct {
	VGName     string `json:"vgName"`
	DeviceName string `json:"deviceName"`
	VolumeType string `json:"volumeType"`
}

func GetAllocatedInfoFromPVAnnotation added in v0.6.0

func GetAllocatedInfoFromPVAnnotation(pv *corev1.PersistentVolume) (*PVAllocatedInfo, error)

type PVCAllocateInfo added in v0.6.0

type PVCAllocateInfo struct {
	PVCName         string `json:"pvcName"`
	PVCNameSpace    string `json:"pvcNameSpace"`
	PVAllocatedInfo `json:",inline"`
}

type PodPVCAllocateInfo added in v0.6.0

type PodPVCAllocateInfo struct {
	PvcAllocates map[string]PVCAllocateInfo `json:"pvcAllocates"`
}

func GetAllocateInfoFromPod added in v0.6.0

func GetAllocateInfoFromPod(pod *corev1.Pod) (*PodPVCAllocateInfo, error)

type StorageSpecUpdateStatus

type StorageSpecUpdateStatus struct {
	Status   UpdateStatus                          `json:"status"`
	Reason   string                                `json:"reason"`
	SpecHash uint64                                `json:"specHash"`
	NewSpec  nodelocalstorage.NodeLocalStorageSpec `json:"newSpec"`
}

type StrategyType

type StrategyType string

type UpdateStatus

type UpdateStatus string
var (
	UpdateStatusPending  UpdateStatus = "pending"
	UpdateStatusAccepted UpdateStatus = "accepted"
	UpdateStatusFailed   UpdateStatus = "failed"
)

type VolumeType

type VolumeType string

func VolumeTypeFromString

func VolumeTypeFromString(s string) (VolumeType, error)

Directories

Path Synopsis
agent
apis
storage/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
csi
lib
generated
clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/storage/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/storage/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
scheduler
lvm
spdk
Package jsonrpc implements a JSON-RPC 1.0 ClientCodec and ServerCodec for the rpc package.
Package jsonrpc implements a JSON-RPC 1.0 ClientCodec and ServerCodec for the rpc package.

Jump to

Keyboard shortcuts

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