hostpath

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

README

CSI Hostpath driver

Usage:

Build hostpathplugin
$ make
Start Hostpath driver
$ sudo ./bin/hostpathplugin --endpoint tcp://127.0.0.1:10000 --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
"csi-hostpath"  "0.1.0"
Create a block volume
$ csc controller new --endpoint tcp://127.0.0.1:10000 --cap 1,block --req-bytes 1048576 --lim-bytes 1048576 CSIVolumeName
CSIVolumeID
Create mounted volume
$ csc controller new --endpoint tcp://127.0.0.1:10000 --cap MULTI_NODE_MULTI_WRITER,mount,xfs,uid=500,gid=500 CSIVolumeName
CSIVolumeID
List volumes
csc controller list-volumes --endpoint tcp://127.0.0.1:10000
CSIVolumeID  0
CSIVolumeID  0
Delete a volume
$ csc controller del --endpoint tcp://127.0.0.1:10000 CSIVolumeID
CSIVolumeID
Validate volume capabilities
$ csc controller validate-volume-capabilities --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeID
CSIVolumeID  true
NodePublish a volume
$ csc node publish --endpoint tcp://127.0.0.1:10000 --cap 1,block --target-path /mnt/hostpath CSIVolumeID
CSIVolumeID
NodeUnpublish a volume
$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/hostpath CSIVolumeID
CSIVolumeID
Get NodeInfo
$ csc node get-info --endpoint tcp://127.0.0.1:10000
CSINode
Create snapshot
$ csc controller create-snapshot --endpoint tcp://127.0.0.1:10000 --params ignoreFailedRead=true --source-volume CSIVolumeID CSISnapshotName
CSISnapshotID
Delete snapshot
csc controller delete-snapshot --endpoint tcp://127.0.0.1:10000 CSISnapshotID
List snapshots
csc controller list-snapshots --endpoint tcp://127.0.0.1:10000

Documentation

Index

Constants

View Source
const (
	TopologyKeyNode = "topology.hostpath.csi/node"
)

Variables

This section is empty.

Functions

func NewHostPathDriver

func NewHostPathDriver(cfg Config) (*hostPath, error)

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() *nonBlockingGRPCServer

Types

type Capacity added in v1.6.0

type Capacity map[string]resource.Quantity

Capacity simulates linear storage of certain types ("fast", "slow"). To calculate the amount of allocated space, the size of all currently existing volumes of the same kind is summed up.

Available capacity is configurable with a command line flag -capacity <type>=<size> where <type> is a string and <size> is a quantity (1T, 1Gi). More than one of those flags can be used.

The underlying map will be initialized if needed by Set, which makes it possible to define and use a Capacity instance without explicit initialization (`var capacity Capacity` or as member in a struct).

func (*Capacity) Enabled added in v1.6.0

func (c *Capacity) Enabled() bool

Enabled returns true if capacities are configured.

func (*Capacity) Set added in v1.6.0

func (c *Capacity) Set(arg string) error

Set is an implementation of flag.Value.Set.

func (*Capacity) String added in v1.6.0

func (c *Capacity) String() string

type Config added in v1.7.0

type Config struct {
	DriverName                    string
	Endpoint                      string
	ProxyEndpoint                 string
	NodeID                        string
	VendorVersion                 string
	StateDir                      string
	MaxVolumesPerNode             int64
	MaxVolumeSize                 int64
	AttachLimit                   int64
	Capacity                      Capacity
	Ephemeral                     bool
	ShowVersion                   bool
	EnableAttach                  bool
	EnableTopology                bool
	EnableVolumeExpansion         bool
	EnableControllerModifyVolume  bool
	AcceptedMutableParameterNames StringArray
	DisableControllerExpansion    bool
	DisableNodeExpansion          bool
	MaxVolumeExpansionSizeNode    int64
	CheckVolumeLifecycle          bool
}

type ContainerFileSystem added in v1.5.0

type ContainerFileSystem struct {
	Children []MountPointInfo `json:"children"`
}

type FileSystems added in v1.5.0

type FileSystems struct {
	Filsystem []ContainerFileSystem `json:"filesystems"`
}

type MountPointInfo added in v1.5.0

type MountPointInfo struct {
	Target              string           `json:"target"`
	Source              string           `json:"source"`
	FsType              string           `json:"fstype"`
	Options             string           `json:"options"`
	ContainerFileSystem []MountPointInfo `json:"children,omitempty"`
}

type StringArray added in v1.13.0

type StringArray []string

StringArray is a flag.Value implementation that allows to specify a comma-separated list of strings on the command line.

func (*StringArray) Set added in v1.13.0

func (s *StringArray) Set(value string) error

Set is an implementation of flag.Value.Set.

func (*StringArray) String added in v1.13.0

func (s *StringArray) String() string

String is an implementation of flag.Value.String.

Jump to

Keyboard shortcuts

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