csi

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHostPID

func CheckHostPID(readlink func(string) (string, error)) error

CheckHostPID refuses to run the overlay mode unless the process shares the PID namespace of the node and has a mount namespace of its own. Without the PID namespace the scan of other pods finds nothing and a stale overlay of a running pod goes unseen. readlink is os.Readlink in production.

Types

type NodePlugin

type NodePlugin struct {
	csi.UnimplementedIdentityServer
	csi.UnimplementedNodeServer

	DriverName string
	NodeID     string
	// StateDir holds the blob cache of the node and the lower mount point, upper directory and work directory of every
	// volume.
	StateDir string
	// APIURL is the store base URL. Grant signs the node grant of a volume; the plugin calls it for every
	// store call, so a mount outlives any one grant.
	APIURL string
	Grant  func(volattr.Publication) (string, error)
	UID    uint32
	GID    uint32
	// AllowedNamespaces lists the namespaces whose pods may publish a volume. The plugin refuses every other pod.
	AllowedNamespaces []string
	HTTP              *http.Client
	Clock             clock.Clock
	// Logger receives the vfs.stats, vfs.health and error records. SlowOp and StatsEvery tune them; zero is the default.
	Logger     *slog.Logger
	SlowOp     time.Duration
	StatsEvery time.Duration

	// SweepCache replaces the walk of the node cache that Serve starts in the background.
	SweepCache func(dir string)
	// contains filtered or unexported fields
}

NodePlugin is the CSI node plugin of the virtual workspace. NodePublishVolume mounts the tree of one commit for one pod as a kernel overlay over a read-only FUSE lower layer, signs the node grant of the volume and serves the control socket in a directory of that pod. NodeUnpublishVolume unmounts it and removes its volume directory and the socket directory.

func (*NodePlugin) GetPluginInfo

func (*NodePlugin) Mounts

func (p *NodePlugin) Mounts() int

Mounts is the number of workspaces the plugin serves.

func (*NodePlugin) NodeGetInfo

func (*NodePlugin) NodePublishVolume

NodePublishVolume mounts the workspace of the workspace named by the volume attributes at the target path, or binds the control socket directory of the workspace for a control socket volume.

func (*NodePlugin) NodeUnpublishVolume

NodeUnpublishVolume unmounts the workspace and deletes its volume directory. A volume this process does not know, for example after a restart, still loses its mount and its volume directory. It holds no lock of the plugin while it unmounts, scans mountinfo or deletes, so a slow volume blocks only itself.

func (*NodePlugin) Probe

func (*NodePlugin) Serve

func (p *NodePlugin) Serve(ctx context.Context, socket string) error

Serve answers CSI calls on the unix socket until ctx ends.

Jump to

Keyboard shortcuts

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