nas

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MntRootPath                = "/mnt"
	SERVER                     = "server"
	ContainerNetworkFileSystem = "containerNetworkFileSystem"
	MODE                       = "mode"
	ModeType                   = "modeType"
	VolumeAs                   = "volumeAs"
	PATH                       = "path"
	ProtocolType               = "protocolType"
	FileSystemType             = "fileSystemType"
	EncryptType                = "encryptType"
	SnapshotID                 = "snapshotID"
	StorageType                = "storageType"
	ZoneID                     = "zoneId"
	DESCRIPTION                = "description"
	ZoneIDTag                  = "zone-id"
	NetworkType                = "networkType"
	VpcID                      = "vpcId"
	VSwitchID                  = "vSwitchId"
	AccessGroupName            = "accessGroupName"
	RegionID                   = "regionId"
	CnHangzhouFin              = "cn-hangzhou-finance"
	DeleteVolume               = "deleteVolume"
	// NASTAGKEY1 tag
	NASTAGKEY1 = "k8s.aliyun.com"
	// NASTAGVALUE1 value
	NASTAGVALUE1 = "true"
	// NASTAGKEY2 key
	NASTAGKEY2 = "createdby"
	// NASTAGVALUE2 value
	NASTAGVALUE2 = "alibabacloud-csi-plugin"
	// NASTAGKEY3 key
	NASTAGKEY3 = "ack.aliyun.com"
	// AddDefaultTagsError means that the add nas default tags error
	AddDefaultTagsError string = "AddDefaultTagsError"
	// MntTypeKey tag
	MntTypeKey = "mountType"
	// LosetupType tag
	LosetupType = "losetup"
	// SkipMountType tag
	SkipMountType = "skipmount"
)

resourcemode is selected by: subpath/filesystem

View Source
const (
	// NasTempMntPath used for create sub directory
	NasTempMntPath = "/mnt/acs_mnt/k8s_nas/temp"
	// NasPortnum is nas port
	NasPortnum = "2049"
	// NasMetricByPlugin tag
	NasMetricByPlugin = "NAS_METRIC_BY_PLUGIN"
	// MixRunTimeMode support both runc and runv
	MixRunTimeMode = "runc-runv"
	// RunvRunTimeMode tag
	RunvRunTimeMode = "runv"
	// NasMntPoint tag
	NasMntPoint = "/mnt/nasplugin.alibabacloud.com"
	// MountProtocolNFS common nfs protocol
	MountProtocolNFS = "nfs"
	// MountProtocolEFC common efc protocol
	MountProtocolEFC = "efc"
	// MountProtocolCPFS common cpfs protocol
	MountProtocolCPFS = "cpfs"
	// MountProtocolCPFSNFS cpfs-nfs protocol
	MountProtocolCPFSNFS = "cpfs-nfs"
	// MountProtocolCPFSNative cpfs-native protocol
	MountProtocolCPFSNative = "cpfs-native"
	// MountProtocolAliNas alinas protocal
	MountProtocolAliNas = "alinas"
	// MountProtocolTag tag
	MountProtocolTag = "mountProtocol"

	//EFCClient
	EFCClient = "efcclient"
	//NFSClient
	NFSClient = "nfsclient"
	//NativeClient
	NativeClient = "nativeclient"
)
View Source
const (
	// MetadataURL is metadata url
	MetadataURL = "http://100.100.100.200/latest/meta-data/"
	// RegionTag is region id
	RegionTag = "region-id"
	// NsenterCmd is nsenter mount command
	NsenterCmd = "nsenter --mount=/proc/1/ns/mnt"
	//Nsenter is nsenter binary command
	Nsenter = "nsenter"
	// LoopLockFile lock file for nas loopsetup
	LoopLockFile = "loopsetup.nas.csi.alibabacloud.com.lck"
	// LoopImgFile image file for nas loopsetup
	LoopImgFile = "loopsetup.nas.csi.alibabacloud.com.img"
	// Resize2fsFailedFilename ...
	Resize2fsFailedFilename = "resize2fs_failed.txt"
	// Resize2fsFailedFixCmd ...
	Resize2fsFailedFixCmd = "%s fsck -a %s"
)
View Source
const (

	// InstanceID is instance id
	InstanceID = "instance-id"
)

Variables

View Source
var (
	// VERSION should be updated by hand at each release
	VERSION = "v1.14.8"
	// 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.Nas-%s", VERSION)
)

Functions

func CheckNfsPathMounted added in v1.0.1

func CheckNfsPathMounted(mountpoint, path string) bool

CheckNfsPathMounted check whether the given nfs path was mounted

func CreateDest added in v1.0.1

func CreateDest(dest string) error

CreateDest create the target

func DetermineClientTypeAndMountProtocol added in v1.2.0

func DetermineClientTypeAndMountProtocol(cnfs *v1beta1.ContainerNetworkFileSystem, opt *Options) error

func DoMount added in v1.1.7

func DoMount(fsType, clientType, nfsProtocol, nfsServer, nfsPath, nfsVers, mountOptions, mountPoint, volumeID, podUID string) error

DoMount execute the mount command for nas dir

func GetFsIDByCpfsServer added in v1.1.7

func GetFsIDByCpfsServer(server string) string

GetFsIDByCpfsServer func is get fsID from serverName

func GetFsIDByNasServer added in v1.1.7

func GetFsIDByNasServer(server string) string

GetFsIDByNasServer func is get fsID from serverName

func GetMetaData added in v1.0.1

func GetMetaData(resource string) string

GetMetaData get host regionid, zoneid

func GetNfsDetails added in v1.0.1

func GetNfsDetails(nfsServersString string) (string, string)

GetNfsDetails get nfs server's details

func GlobalConfigSet added in v1.0.3

func GlobalConfigSet(serviceType string) *restclient.Config

GlobalConfigSet set global config

func NewControllerServer added in v1.0.1

func NewControllerServer(d *csicommon.CSIDriver, client *aliNas.Client, region, limit string, cfg *restclient.Config) csi.ControllerServer

NewControllerServer is to create controller server

func ParseMountFlags added in v1.0.2

func ParseMountFlags(mntOptions []string) (string, string)

ParseMountFlags parse mountOptions

func SetNasEndPoint added in v1.0.2

func SetNasEndPoint(regionID string)

SetNasEndPoint Set Endpoint for Nas

Types

type GlobalConfig added in v1.0.3

type GlobalConfig struct {
	Region             string
	NasTagEnable       bool
	ADControllerEnable bool
	MetricEnable       bool
	NasFakeProvision   bool
	RunTimeClass       string
	NodeID             string
	NodeIP             string
	ClusterID          string
	LosetupEnable      bool
	NasPortCheck       bool
	KubeClient         *kubernetes.Clientset
	DynamicClient      dynamic.Interface
	NasClient          *aliNas.Client
}

GlobalConfig save global values for plugin

var (

	// GlobalConfigVar Global Config
	GlobalConfigVar GlobalConfig
)

type NAS added in v1.0.1

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

NAS the NAS object

func NewDriver

func NewDriver(nodeID, endpoint, serviceType string) *NAS

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

func (*NAS) Run added in v1.0.1

func (d *NAS) Run()

Run start a new NodeServer

type Options added in v1.0.1

type Options struct {
	Server        string `json:"server"`
	Path          string `json:"path"`
	Vers          string `json:"vers"`
	Mode          string `json:"mode"`
	ModeType      string `json:"modeType"`
	Options       string `json:"options"`
	MountType     string `json:"mountType"`
	LoopLock      string `json:"loopLock"`
	MountProtocol string `json:"mountProtocol"`
	ClientType    string `json:"clientType"`
	FSType        string `json:"fsType"`
}

Options struct definition

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

type RunvNasOptions added in v1.0.4

type RunvNasOptions struct {
	Server     string `json:"server"`
	Path       string `json:"path"`
	Vers       string `json:"vers"`
	Mode       string `json:"mode"`
	ModeType   string `json:"modeType"`
	Options    string `json:"options"`
	RunTime    string `json:"runtime"`
	MountFile  string `json:"mountfile"`
	VolumeType string `json:"volumeType"`
}

RunvNasOptions struct definition

Jump to

Keyboard shortcuts

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