Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDest(dest string) error
- func GetDefaultAK() (string, string, string)
- func GetFileContent(fileName string) string
- func GetLocalAK() (string, string)
- func GetMetaData(resource string) (string, error)
- func GetMetrics(path string) (*csi.NodeGetVolumeStatsResponse, error)
- func GetPodRunTime(req *csi.NodePublishVolumeRequest, clientSet *kubernetes.Clientset) string
- func GetRegionAndInstanceID() (string, string, error)
- func GetRegionIDAndInstanceID(nodeName string) (string, string, error)
- func GetSTSAK() (string, string, string)
- func IsDir(path string) bool
- func IsDirEmpty(name string) (bool, error)
- func IsFileExisting(filename string) bool
- func IsMountPointRunv(mountPoint string) bool
- func IsMounted(mountPath string) bool
- func NewEcsClient(accessKeyID, accessKeySecret, accessToken string) (ecsClient *ecs.Client)
- func ReadJSONFile(file string) (map[string]string, error)
- func Run(cmd string) (string, error)
- func Umount(mountPath string) bool
- func WriteJSONFile(obj interface{}, file string) error
- func WriteJosnFile(obj interface{}, file string) error
- type DefaultOptions
- type Mounter
- type Result
- type RoleAuth
Constants ¶
const ( // UserAKID is user AK ID UserAKID = "/etc/.volumeak/akId" // UserAKSecret is user AK Secret UserAKSecret = "/etc/.volumeak/akSecret" // MetadataURL is metadata url MetadataURL = "http://100.100.100.200/latest/meta-data/" // RegionIDTag is region id RegionIDTag = "region-id" // InstanceIDTag is instance id InstanceIDTag = "instance-id" // DefaultRegion is default region DefaultRegion = "cn-hangzhou" // CsiPluginRunTimeFlagFile tag CsiPluginRunTimeFlagFile = "../alibabacloudcsiplugin.json" // RuncRunTimeTag tag RuncRunTimeTag = "runc" // RunvRunTimeTag tag RunvRunTimeTag = "runv" )
Variables ¶
var KubernetesAlicloudIdentity = fmt.Sprintf("Kubernetes.Alicloud/CsiPlugin")
KubernetesAlicloudIdentity set a identity label
Functions ¶
func GetDefaultAK ¶
GetDefaultAK read default ak from local file or from STS
func GetFileContent ¶ added in v1.0.4
GetFileContent get file content
func GetLocalAK ¶
GetLocalAK read ossfs ak from local or from secret file
func GetMetaData ¶
GetMetaData get metadata from ecs meta-server
func GetMetrics ¶ added in v1.0.3
func GetMetrics(path string) (*csi.NodeGetVolumeStatsResponse, error)
GetMetrics get path metric
func GetPodRunTime ¶ added in v1.0.4
func GetPodRunTime(req *csi.NodePublishVolumeRequest, clientSet *kubernetes.Clientset) string
GetPodRunTime Get Pod runtimeclass config Default as runc.
func GetRegionAndInstanceID ¶ added in v1.0.1
GetRegionAndInstanceID get region and instanceID object
func GetRegionIDAndInstanceID ¶ added in v1.0.1
GetRegionIDAndInstanceID get regionID and instanceID object
func IsDirEmpty ¶ added in v1.0.1
IsDirEmpty return status of dir empty or not
func IsFileExisting ¶
IsFileExisting check file exist in volume driver or not
func IsMountPointRunv ¶ added in v1.0.4
IsMountPointRunv check the mountpoint is runv style
func NewEcsClient ¶ added in v1.0.1
NewEcsClient create a ecsClient object
func ReadJSONFile ¶ added in v1.0.1
ReadJSONFile return a json object
func WriteJSONFile ¶ added in v1.0.1
WriteJSONFile write a json object
func WriteJosnFile ¶
WriteJosnFile save json data to file
Types ¶
type DefaultOptions ¶
type DefaultOptions struct { Global struct { KubernetesClusterTag string AccessKeyID string `json:"accessKeyID"` AccessKeySecret string `json:"accessKeySecret"` Region string `json:"region"` } }
DefaultOptions used for global ak
type Mounter ¶ added in v1.0.1
type Mounter interface { // If the folder doesn't exist, it will call 'mkdir -p' EnsureFolder(target string) error // If the block doesn't exist, create it EnsureBlock(target string) error // Format formats the source with the given filesystem type Format(source, fsType string) error // Mount mounts source to target with the given fstype and options. Mount(source, target, fsType string, options ...string) error // Mount mounts source to target for block file. MountBlock(source, target string, options ...string) error // Unmount unmounts the given target Unmount(target string) error // IsFormatted checks whether the source device is formatted or not. It // returns true if the source device is already formatted. IsFormatted(source string) (bool, error) // IsMounted checks whether the target path is a correct mount (i.e: // propagated). It returns true if it's mounted. An error is returned in // case of system errors or if it's mounted incorrectly. IsMounted(target string) (bool, error) SafePathRemove(target string) error HasMountRefs(mountPath string, mountRefs []string) bool }
Mounter is responsible for formatting and mounting volumes
func NewMounter ¶ added in v1.0.1
func NewMounter() Mounter
NewMounter returns a new mounter instance