flexadapter

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 15 Imported by: 6

README

CSI to Flexvolume adapter

Usage:

Start Flexvolume adapter for simple nfs flexvolume driver
$ sudo ./_output/flexadapter --endpoint tcp://127.0.0.1:10000 --drivername simplenfs --driverpath ./pkg/flexadapter/examples/simplenfs-flexdriver/driver/nfs --nodeid CSINode -v=5
Test using csc

Get csc tool from https://github.com/rexray/gocsi/tree/master/csc

Get plugin info
$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
"simplenfs"	"0.1.0"
NodePublish a volume
$ csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=a.b.c.d --attrib share=nfs_share nfstestvol
nfstestvol
NodeUnpublish a volume
$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs nfstestvol
nfstestvol
Get NodeID
$ csc node get-id --endpoint tcp://127.0.0.1:10000
CSINode

Documentation

Index

Constants

View Source
const (
	// StatusSuccess represents the successful completion of command.
	StatusSuccess = "Success"
	// StatusNotSupported represents that the command is not supported.
	StatusNotSupported = "Not supported"
)

Variables

View Source
var (
	TimeoutError = fmt.Errorf("Timeout")
)

Functions

func New

func New() *flexAdapter

func NewControllerServer

func NewControllerServer(d *csicommon.CSIDriver, f *flexVolumeDriver) *controllerServer

func NewFlexVolumeDriver

func NewFlexVolumeDriver(driverName, driverPath string) (*flexVolumeDriver, error)

func NewNodeServer

func NewNodeServer(d *csicommon.CSIDriver, f *flexVolumeDriver) *nodeServer

Types

type DriverCall

type DriverCall struct {
	Command string
	Timeout time.Duration
	// contains filtered or unexported fields
}

DriverCall implements the basic contract between FlexVolume and its driver. The caller is responsible for providing the required args.

func (*DriverCall) Append

func (dc *DriverCall) Append(arg string)

func (*DriverCall) AppendSpec

func (dc *DriverCall) AppendSpec(volumeID, fsType string, readOnly bool, volumeAttributes map[string]string) error

func (*DriverCall) Run

func (dc *DriverCall) Run() (*DriverStatus, error)

type DriverCapabilities

type DriverCapabilities struct {
	Attach         bool `json:"attach"`
	SELinuxRelabel bool `json:"selinuxRelabel"`
}

type DriverStatus

type DriverStatus struct {
	// Status of the callout. One of "Success", "Failure" or "Not supported".
	Status string `json:"status"`
	// Reason for success/failure.
	Message string `json:"message,omitempty"`
	// Path to the device attached. This field is valid only for attach calls.
	// ie: /dev/sdx
	DevicePath string `json:"device,omitempty"`
	// Cluster wide unique name of the volume.
	VolumeName string `json:"volumeName,omitempty"`
	// Represents volume is attached on the node
	Attached bool `json:"attached,omitempty"`
	// Returns capabilities of the driver.
	// By default we assume all the capabilities are supported.
	// If the plugin does not support a capability, it can return false for that capability.
	Capabilities *DriverCapabilities `json:",omitempty"`
}

DriverStatus represents the return value of the driver callout.

type OptionsForDriver

type OptionsForDriver map[string]string

OptionsForDriver represents the spec given to the driver.

func NewOptionsForDriver

func NewOptionsForDriver(volumeID, fsType string, readOnly bool, volumeAttributes map[string]string) OptionsForDriver

Jump to

Keyboard shortcuts

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