Documentation
¶
Overview ¶
Package flexvolume to manage Kubernetes storage attach events.
Package flexvolume to manage Kubernetes storage attach events.
Index ¶
- Constants
- type AttachOptions
- type Controller
- func (c *Controller) Attach(attachOpts AttachOptions, devicePath *string) error
- func (c *Controller) Detach(detachOpts AttachOptions, _ *struct{}) error
- func (c *Controller) DetachForce(detachOpts AttachOptions, _ *struct{}) error
- func (c *Controller) GetAttachInfoFromMountDir(mountDir string, attachOptions *AttachOptions) error
- func (c *Controller) GetClientAccessInfo(clusterName string, clientAccessInfo *model.ClientAccessInfo) error
- func (c *Controller) GetGlobalMountPath(volumeName string, globalMountPath *string) error
- func (c *Controller) GetKernelVersion(_ *struct{}, kernelVersion *string) error
- func (c *Controller) Log(message LogMessage, _ *struct{}) error
- func (c *Controller) RemoveAttachmentObject(detachOpts AttachOptions, safeToDetach *bool) error
- type FlexvolumeServer
- type LogMessage
- type MockFlexvolumeController
- func (m *MockFlexvolumeController) Attach(attachOpts AttachOptions, devicePath *string) error
- func (m *MockFlexvolumeController) Detach(detachOpts AttachOptions, _ *struct{}) error
- func (m *MockFlexvolumeController) DetachForce(detachOpts AttachOptions, _ *struct{}) error
- func (m *MockFlexvolumeController) GetAttachInfoFromMountDir(mountDir string, attachOptions *AttachOptions) error
- func (m *MockFlexvolumeController) Log(message LogMessage, _ *struct{}) error
- func (m *MockFlexvolumeController) RemoveAttachmentObject(detachOpts AttachOptions, safeToDetach *bool) error
- type VolumeController
- type VolumeManager
Constants ¶
const ( StorageClassKey = "storageClass" PoolKey = "pool" ImageKey = "image" )
const ( UnixSocketName = ".rook.sock" FlexvolumeVendor = "rook.io" FlexvolumeDriver = "rook" )
const ( ReadOnly = "ro" ReadWrite = "rw" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachOptions ¶
type AttachOptions struct {
Image string `json:"image"`
Pool string `json:"pool"`
ClusterName string `json:"clusterName"`
StorageClass string `json:"storageClass"`
MountDir string `json:"mountDir"`
FsName string `json:"fsName"`
Path string `json:"path"` // Path within the CephFS to mount
RW string `json:"kubernetes.io/readwrite"`
FsType string `json:"kubernetes.io/fsType"`
VolumeName string `json:"kubernetes.io/pvOrVolumeName"` // only available on 1.7
Pod string `json:"kubernetes.io/pod.name"`
PodID string `json:"kubernetes.io/pod.uid"`
PodNamespace string `json:"kubernetes.io/pod.namespace"`
}
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller handles all events from the Flexvolume driver
func NewController ¶
func NewController(context *clusterd.Context, volumeAttachment attachment.Attachment, manager VolumeManager) *Controller
func (*Controller) Attach ¶
func (c *Controller) Attach(attachOpts AttachOptions, devicePath *string) error
Attach attaches rook volume to the node
func (*Controller) Detach ¶
func (c *Controller) Detach(detachOpts AttachOptions, _ *struct{}) error
Detach detaches a rook volume to the node
func (*Controller) DetachForce ¶
func (c *Controller) DetachForce(detachOpts AttachOptions, _ *struct{}) error
func (*Controller) GetAttachInfoFromMountDir ¶
func (c *Controller) GetAttachInfoFromMountDir(mountDir string, attachOptions *AttachOptions) error
GetAttachInfoFromMountDir obtain pod and volume information from the mountDir. K8s does not provide all necessary information to detach a volume (https://github.com/kubernetes/kubernetes/issues/52590). So we are hacking a bit and by parsing it from mountDir
func (*Controller) GetClientAccessInfo ¶
func (c *Controller) GetClientAccessInfo(clusterName string, clientAccessInfo *model.ClientAccessInfo) error
GetClientAccessInfo obtains the cluster monitor endpoints, username and secret
func (*Controller) GetGlobalMountPath ¶
func (c *Controller) GetGlobalMountPath(volumeName string, globalMountPath *string) error
GetGlobalMountPath generate the global mount path where the device path is mounted. It is based on the kubelet root dir, which defaults to /var/lib/kubelet
func (*Controller) GetKernelVersion ¶
func (c *Controller) GetKernelVersion(_ *struct{}, kernelVersion *string) error
GetKernelVersion returns the kernel version of the current node.
func (*Controller) Log ¶
func (c *Controller) Log(message LogMessage, _ *struct{}) error
Log logs messages from the driver
func (*Controller) RemoveAttachmentObject ¶
func (c *Controller) RemoveAttachmentObject(detachOpts AttachOptions, safeToDetach *bool) error
RemoveAttachmentObject removes the attachment from the VolumeAttachment CRD and returns whether the volume is safe to detach
type FlexvolumeServer ¶
type FlexvolumeServer struct {
// contains filtered or unexported fields
}
FlexvolumeServer start a unix domain socket server to interact with the flexvolume driver
func NewFlexvolumeServer ¶
func NewFlexvolumeServer(context *clusterd.Context, controller *Controller, manager VolumeManager) *FlexvolumeServer
NewFlexvolumeServer creates an Flexvolume server
func (*FlexvolumeServer) Start ¶
func (s *FlexvolumeServer) Start() error
Start configures the flexvolume driver on the host and starts the unix domain socket server to communicate with the driver
func (*FlexvolumeServer) Stop ¶
func (s *FlexvolumeServer) Stop()
Stop the unix domain socket server and deletes the socket file
type LogMessage ¶
type MockFlexvolumeController ¶
type MockFlexvolumeController struct {
MockAttach func(attachOpts AttachOptions, devicePath *string) error
MockDetach func(detachOpts AttachOptions, _ *struct{}) error
MockDetachForce func(detachOpts AttachOptions, _ *struct{}) error
MockRemoveAttachmentObject func(detachOpts AttachOptions, safeToDetach *bool) error
MockLog func(message LogMessage, _ *struct{}) error
MockGetAttachInfoFromMountDir func(mountDir string, attachOptions *AttachOptions) error
}
func (*MockFlexvolumeController) Attach ¶
func (m *MockFlexvolumeController) Attach(attachOpts AttachOptions, devicePath *string) error
func (*MockFlexvolumeController) Detach ¶
func (m *MockFlexvolumeController) Detach(detachOpts AttachOptions, _ *struct{}) error
func (*MockFlexvolumeController) DetachForce ¶
func (m *MockFlexvolumeController) DetachForce(detachOpts AttachOptions, _ *struct{}) error
func (*MockFlexvolumeController) GetAttachInfoFromMountDir ¶
func (m *MockFlexvolumeController) GetAttachInfoFromMountDir(mountDir string, attachOptions *AttachOptions) error
func (*MockFlexvolumeController) Log ¶
func (m *MockFlexvolumeController) Log(message LogMessage, _ *struct{}) error
func (*MockFlexvolumeController) RemoveAttachmentObject ¶
func (m *MockFlexvolumeController) RemoveAttachmentObject(detachOpts AttachOptions, safeToDetach *bool) error
type VolumeController ¶
type VolumeController interface {
Attach(attachOpts AttachOptions, devicePath *string) error
Detach(detachOpts AttachOptions, _ *struct{}) error
DetachForce(detachOpts AttachOptions, _ *struct{}) error
RemoveAttachmentObject(detachOpts AttachOptions, safeToDetach *bool) error
Log(message LogMessage, _ *struct{}) error
GetAttachInfoFromMountDir(mountDir string, attachOptions *AttachOptions) error
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package attachment to manage Kubernetes storage attach events.
|
Package attachment to manage Kubernetes storage attach events. |