Documentation
¶
Index ¶
- func CheckHostPID(readlink func(string) (string, error)) error
- type NodePlugin
- func (p *NodePlugin) GetPluginCapabilities(context.Context, *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
- func (p *NodePlugin) GetPluginInfo(context.Context, *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
- func (p *NodePlugin) Mounts() int
- func (p *NodePlugin) NodeGetCapabilities(context.Context, *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (p *NodePlugin) NodeGetInfo(context.Context, *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (p *NodePlugin) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (p *NodePlugin) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (p *NodePlugin) Probe(context.Context, *csi.ProbeRequest) (*csi.ProbeResponse, error)
- func (p *NodePlugin) Serve(ctx context.Context, socket string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHostPID ¶
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) GetPluginCapabilities ¶
func (p *NodePlugin) GetPluginCapabilities(context.Context, *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
func (*NodePlugin) GetPluginInfo ¶
func (p *NodePlugin) GetPluginInfo(context.Context, *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
func (*NodePlugin) Mounts ¶
func (p *NodePlugin) Mounts() int
Mounts is the number of workspaces the plugin serves.
func (*NodePlugin) NodeGetCapabilities ¶
func (p *NodePlugin) NodeGetCapabilities(context.Context, *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
func (*NodePlugin) NodeGetInfo ¶
func (p *NodePlugin) NodeGetInfo(context.Context, *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
func (*NodePlugin) NodePublishVolume ¶
func (p *NodePlugin) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
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 ¶
func (p *NodePlugin) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
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 (p *NodePlugin) Probe(context.Context, *csi.ProbeRequest) (*csi.ProbeResponse, error)