Documentation ¶
Overview ¶
Copyright © 2021 Alibaba Group Holding Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Alibaba Group Holding Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func GetNodeIP(node *v1.Node, nodeID string) (net.IP, error)
- func NewFakeSafeMounter(scripts ...testingexec.FakeAction) *mount.SafeFormatAndMount
- func ParseEndpoint(endpoint string) (string, string, error)
- type CSIPlugin
- func (cs CSIPlugin) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
- func (cs CSIPlugin) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
- func (cs CSIPlugin) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
- func (cs CSIPlugin) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
- func (cs CSIPlugin) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
- func (cs CSIPlugin) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
- func (cs CSIPlugin) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
- func (cs CSIPlugin) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
- func (cs CSIPlugin) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
- func (is *CSIPlugin) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
- func (plugin *CSIPlugin) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
- func (cs CSIPlugin) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
- func (cs CSIPlugin) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
- func (ns CSIPlugin) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
- func (ns CSIPlugin) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (ns CSIPlugin) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (ns CSIPlugin) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
- func (ns CSIPlugin) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (ns CSIPlugin) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
- func (ns CSIPlugin) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (ns CSIPlugin) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
- func (plugin *CSIPlugin) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)
- func (plugin *CSIPlugin) Run() error
- func (plugin *CSIPlugin) Stop()
- func (cs CSIPlugin) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
- type FakeSafeMounter
- type Idempotent
- type InFlight
- type OSTool
- type Option
- func WithCgroupDriver(cgroupDriver string) Option
- func WithDriverMode(mode string) Option
- func WithExtenderSchedulerNames(extenderSchedulerNames []string) Option
- func WithFrameworkSchedulerNames(frameworkSchedulerNames []string) Option
- func WithGrpcConnectionTimeout(grpcConnectionTimeout int) Option
- func WithKubeClient(kubeclient kubernetes.Interface) Option
- func WithLocalClient(localclient clientset.Interface) Option
- func WithSnapshotClient(snapclient snapshot.Interface) Option
- func WithSysPath(sysPath string) Option
- type PVAllocatedInfo
- type PvcPodSchedulerMap
- type SchedulerArch
- type SchedulerArchMap
- type Store
Constants ¶
const ( DefaultEndpoint string = "unix://tmp/csi.sock" DefaultDriverName string = "local.csi.aliyun.com" DefaultEphemeralVolumeDataFilePath string = "/var/lib/kubelet/open-local-volumes.json" // connection timeout DefaultConnectTimeout = 3 // VolumeOperationAlreadyExists is message fmt returned to CO when there is another in-flight call on the given volumeID VolumeOperationAlreadyExists = "An operation with the given volume=%q is already in progress" // VgNameTag is the vg name tag VgNameTag = "vgName" // VolumeTypeTag is the pv type tag VolumeTypeTag = "volumeType" // PvTypeTag is the pv type tag PvTypeTag = "pvType" // FsTypeTag is the fs type tag FsTypeTag = "fsType" // LvmTypeTag is the lvm type tag LvmTypeTag = "lvmType" // NodeAffinity is the pv node schedule tag NodeAffinity = "nodeAffinity" // DefaultFs default fs DefaultFs = "ext4" // DefaultNodeAffinity default NodeAffinity DefaultNodeAffinity = "true" // LinearType linear type LinearType = "linear" // DirectTag is direct-assigned volume tag DirectTag = "direct" // StripingType striping type StripingType = "striping" )
const (
VolumeOperationAlreadyExistsErrorMsg = "An operation with the given Volume %s already exists"
)
Variables ¶
var ( VolumeCaps = []csi.VolumeCapability_AccessMode_Mode{ csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, } // controllerCaps represents the capability of controller service ControllerCaps = []csi.ControllerServiceCapability_RPC_Type{ csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT, csi.ControllerServiceCapability_RPC_EXPAND_VOLUME, } NodeCaps = []*csi.NodeServiceCapability{ { Type: &csi.NodeServiceCapability_Rpc{ Rpc: &csi.NodeServiceCapability_RPC{ Type: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME, }, }, }, { Type: &csi.NodeServiceCapability_Rpc{ Rpc: &csi.NodeServiceCapability_RPC{ Type: csi.NodeServiceCapability_RPC_EXPAND_VOLUME, }, }, }, { Type: &csi.NodeServiceCapability_Rpc{ Rpc: &csi.NodeServiceCapability_RPC{ Type: csi.NodeServiceCapability_RPC_GET_VOLUME_STATS, }, }, }, } )
Functions ¶
func NewFakeSafeMounter ¶ added in v0.6.0
func NewFakeSafeMounter(scripts ...testingexec.FakeAction) *mount.SafeFormatAndMount
NewFakeSafeMounter creates a mount.SafeFormatAndMount instance suitable for use in unit tests.
Types ¶
type CSIPlugin ¶
type CSIPlugin struct {
// contains filtered or unexported fields
}
func (CSIPlugin) ControllerExpandVolume ¶ added in v0.6.0
func (cs CSIPlugin) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
ControllerExpandVolume expand volume
func (CSIPlugin) ControllerGetCapabilities ¶ added in v0.6.0
func (cs CSIPlugin) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
func (CSIPlugin) ControllerPublishVolume ¶ added in v0.6.0
func (cs CSIPlugin) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
func (CSIPlugin) ControllerUnpublishVolume ¶ added in v0.6.0
func (cs CSIPlugin) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
func (CSIPlugin) CreateSnapshot ¶ added in v0.6.0
func (cs CSIPlugin) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
CreateSnapshot create lvm snapshot
func (CSIPlugin) CreateVolume ¶ added in v0.6.0
func (cs CSIPlugin) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
CreateVolume csi interface
func (CSIPlugin) DeleteSnapshot ¶ added in v0.6.0
func (cs CSIPlugin) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
DeleteSnapshot delete lvm snapshot
func (CSIPlugin) DeleteVolume ¶ added in v0.6.0
func (cs CSIPlugin) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
func (CSIPlugin) GetCapacity ¶ added in v0.6.0
func (cs CSIPlugin) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
func (*CSIPlugin) GetPluginCapabilities ¶ added in v0.6.0
func (is *CSIPlugin) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
GetPluginCapabilities returns available capabilities of the plugin
func (*CSIPlugin) GetPluginInfo ¶ added in v0.6.0
func (plugin *CSIPlugin) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
func (CSIPlugin) ListSnapshots ¶ added in v0.6.0
func (cs CSIPlugin) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
func (CSIPlugin) ListVolumes ¶ added in v0.6.0
func (cs CSIPlugin) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
func (CSIPlugin) NodeExpandVolume ¶ added in v0.6.0
func (ns CSIPlugin) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) ( *csi.NodeExpandVolumeResponse, error)
called with args {VolumeId:yoda-7825af6f-ea0a-4047-8704-7576dfe8d201 VolumePath:/var/lib/kubelet/pods/2ba91d3a-1b97-4d72-9dd9-be98aebbfe62/volumes/kubernetes.io~csi/yoda-7825af6f-ea0a-4047-8704-7576dfe8d201/mount CapacityRange:required_bytes:21474836480 StagingTargetPath:/var/lib/kubelet/plugins/kubernetes.io/csi/pv/yoda-7825af6f-ea0a-4047-8704-7576dfe8d201/globalmount VolumeCapability:mount:<fs_type:"ext4" > access_mode:<mode:SINGLE_NODE_WRITER > XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}
func (CSIPlugin) NodeGetCapabilities ¶ added in v0.6.0
func (ns CSIPlugin) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
func (CSIPlugin) NodeGetInfo ¶ added in v0.6.0
func (ns CSIPlugin) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
func (CSIPlugin) NodeGetVolumeStats ¶ added in v0.6.0
func (ns CSIPlugin) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
NodeGetVolumeStats used for csi metrics
func (CSIPlugin) NodePublishVolume ¶ added in v0.6.0
func (ns CSIPlugin) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
volume_id: yoda-70597cb6-c08b-4bbb-8d41-c4afcfa91866 staging_target_path: /var/lib/kubelet/plugins/kubernetes.io/csi/pv/yoda-70597cb6-c08b-4bbb-8d41-c4afcfa91866/globalmount target_path: /var/lib/kubelet/pods/2a7bbb9c-c915-4006-84d7-0e3ac9d8d70f/volumes/kubernetes.io~csi/yoda-70597cb6-c08b-4bbb-8d41-c4afcfa91866/mount
func (CSIPlugin) NodeStageVolume ¶ added in v0.6.0
func (ns CSIPlugin) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
func (CSIPlugin) NodeUnpublishVolume ¶ added in v0.6.0
func (ns CSIPlugin) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
func (CSIPlugin) NodeUnstageVolume ¶ added in v0.6.0
func (ns CSIPlugin) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
func (*CSIPlugin) Probe ¶ added in v0.6.0
func (plugin *CSIPlugin) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)
func (CSIPlugin) ValidateVolumeCapabilities ¶ added in v0.6.0
func (cs CSIPlugin) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
type FakeSafeMounter ¶ added in v0.6.0
type FakeSafeMounter struct { mount.FakeMounter testingexec.FakeExec }
FakeSafeMounter implements a mount.Interface interface suitable for use in unit tests.
func (*FakeSafeMounter) IsLikelyNotMountPoint ¶ added in v0.6.0
func (f *FakeSafeMounter) IsLikelyNotMountPoint(file string) (bool, error)
IsLikelyNotMountPoint overrides mount.FakeMounter.IsLikelyNotMountPoint.
type Idempotent ¶ added in v0.5.5
type Idempotent interface { // The CSI data types are generated using a protobuf. // The generated structures are guaranteed to implement the Stringer interface. // Example: https://github.com/container-storage-interface/spec/blob/master/lib/go/csi/csi.pb.go#L3508 // We can use the generated string as the key of our internal inflight database of requests. String() string }
Idempotent is the interface required to manage in flight requests.
type InFlight ¶ added in v0.5.5
type InFlight struct {
// contains filtered or unexported fields
}
InFlight is a struct used to manage in flight requests per volumeId.
func NewInFlight ¶ added in v0.5.5
func NewInFlight() *InFlight
NewInFlight instanciates a InFlight structures.
type OSTool ¶ added in v0.6.0
type OSTool interface { Remove(name string) error Stat(name string) (os.FileInfo, error) MkdirAll(path string, perm os.FileMode) error RunCommand(cmd string) (string, error) IsBlockDevice(fullPath string) (bool, error) MountBlock(source, target string, opts ...string) error EnsureBlock(target string) error CleanupMountPoint(mountPath string, mounter mountutils.Interface, extensiveMountPointCheck bool) error ResizeFS(devicePath string, deviceMountPath string) (bool, error) }
func NewFakeOSTool ¶ added in v0.6.0
func NewFakeOSTool() OSTool
type Option ¶ added in v0.6.0
type Option func(*driverOptions)
Option configures a Driver
func WithCgroupDriver ¶ added in v0.6.0
func WithDriverMode ¶ added in v0.6.0
func WithExtenderSchedulerNames ¶ added in v0.6.0
func WithFrameworkSchedulerNames ¶ added in v0.6.0
func WithGrpcConnectionTimeout ¶ added in v0.6.0
func WithKubeClient ¶ added in v0.6.0
func WithKubeClient(kubeclient kubernetes.Interface) Option
func WithLocalClient ¶ added in v0.6.0
func WithSnapshotClient ¶ added in v0.6.0
func WithSysPath ¶ added in v0.6.0
type PVAllocatedInfo ¶ added in v0.6.0
type PvcPodSchedulerMap ¶ added in v0.6.0
type PvcPodSchedulerMap struct {
// contains filtered or unexported fields
}
func (*PvcPodSchedulerMap) Add ¶ added in v0.6.0
func (infoMap *PvcPodSchedulerMap) Add(pvcNamespace, pvcName, schedulerName string)
func (*PvcPodSchedulerMap) Get ¶ added in v0.6.0
func (infoMap *PvcPodSchedulerMap) Get(pvcNamespace, pvcName string) string
func (*PvcPodSchedulerMap) Remove ¶ added in v0.6.0
func (infoMap *PvcPodSchedulerMap) Remove(pvcNamespace, pvcName string)
type SchedulerArch ¶ added in v0.6.0
type SchedulerArch string
var ( SchedulerArchExtender SchedulerArch = "extender" SchedulerArchFramework SchedulerArch = "scheduling-framework" SchedulerArchUnknown SchedulerArch = "unknown" )
type SchedulerArchMap ¶ added in v0.6.0
type SchedulerArchMap struct {
// contains filtered or unexported fields
}
func (*SchedulerArchMap) Get ¶ added in v0.6.0
func (archMap *SchedulerArchMap) Get(schedulerName string) SchedulerArch