Documentation ¶
Overview ¶
Package flexvolume to manage Kubernetes storage attach events.
Package flexvolume to manage Kubernetes storage attach events.
Index ¶
- Constants
- func RookDriverName(context *clusterd.Context) (string, error)
- type AttachOptions
- type ClientAccessInfo
- 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(clusterNamespace string, clientAccessInfo *ClientAccessInfo) error
- func (c *Controller) GetGlobalMountPath(input GlobalMountPathInput, 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 GlobalMountPathInput
- 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 ( ClusterNamespaceKey = "clusterNamespace" StorageClassKey = "storageClass" PoolKey = "pool" ImageKey = "image" )
const ( UnixSocketName = ".rook.sock" FlexvolumeVendor = "ceph.rook.io" FlexvolumeVendorLegacy = "rook.io" FlexDriverName = "rook" )
const ( ReadOnly = "ro" ReadWrite = "rw" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttachOptions ¶
type AttachOptions struct { Image string `json:"image"` Pool string `json:"pool"` ClusterNamespace string `json:"clusterNamespace"` 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 ClientAccessInfo ¶
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(clusterNamespace string, clientAccessInfo *ClientAccessInfo) error
GetClientAccessInfo obtains the cluster monitor endpoints, username and secret
func (*Controller) GetGlobalMountPath ¶
func (c *Controller) GetGlobalMountPath(input GlobalMountPathInput, 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 Volume 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(driverVendor, driverName string) error
Start configures the flexvolume driver on the host and starts the unix domain socket server to communicate with the driver
func (*FlexvolumeServer) StopAll ¶
func (s *FlexvolumeServer) StopAll()
Stop the unix domain socket server and deletes the socket file
type GlobalMountPathInput ¶
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. |