volume

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachVolumeRequest added in v0.4.0

type AttachVolumeRequest struct {
	// VolumeID is the ID assigned by the storage system at creation.
	VolumeID string
	// Node is the node to attach the volume to.
	Node string
}

AttachVolumeRequest describes a volume to attach to a node.

type AttachVolumeResponse added in v0.4.0

type AttachVolumeResponse struct {
	// PublishContext is driver-defined attachment metadata that must be echoed
	// back on the node's mount calls (e.g. the device path for AWS EBS). It is
	// empty for drivers that do not implement attachment, and is only
	// meaningful for the node named in the request.
	PublishContext map[string]string
}

AttachVolumeResponse describes a completed attachment.

type CreateVolumeRequest added in v0.4.0

type CreateVolumeRequest struct {
	// Name is the name to provision the volume under.
	Name string
	// Capacity is the requested size as a Kubernetes resource.Quantity string.
	Capacity string
	// Parameters are the driver-specific parameters from the StorageClass.
	Parameters map[string]string
}

CreateVolumeRequest describes a volume to provision.

type CreateVolumeResponse added in v0.4.0

type CreateVolumeResponse struct {
	// VolumeID is the globally unique ID assigned by the storage system.
	VolumeID string
	// VolumeContext is driver-defined metadata that the node plugin needs to
	// mount the volume.
	VolumeContext map[string]string
}

CreateVolumeResponse describes a provisioned volume.

type MockVolumePlugin

type MockVolumePlugin struct{}

MockVolumePlugin is a simple implementation of VolumePluginControlPlane and VolumePluginWorkerPlane for testing purposes.

It creates a subdirectory on the host for each actor. This only persists data if the actor is scheduled to the same host.

This plugin also does not cleanup the subdirectories, so that has to be done by the test infrastructure.

The control-plane methods (Create/Delete/Attach/DetachVolume) are intentionally stateless no-ops: they log and succeed, with no bookkeeping of which volumes exist or which node they're attached to. Nothing reads that state - the e2e test that exercises this plugin verifies the volume actually worked by checking the real file MountVolume writes on the node, not by querying the plugin. A stateful mock used to track this in an in-process map, which broke once ate-api-server ran multiple replicas (whichever replica handled a given RPC had no idea what a different replica's map contained); going stateless removes the bug class instead of syncing the state, since nothing actually needs it.

func NewMockVolumePlugin

func NewMockVolumePlugin() *MockVolumePlugin

NewMockVolumePlugin creates a new MockVolumePlugin.

func (*MockVolumePlugin) AttachVolume

AttachVolume simulates volume attachment to a node. The mock driver needs no attachment metadata, so the response carries no publish context.

func (*MockVolumePlugin) CreateVolume

CreateVolume simulates volume provisioning.

func (*MockVolumePlugin) DeleteVolume

func (p *MockVolumePlugin) DeleteVolume(ctx context.Context, volumeID string) error

DeleteVolume simulates volume deletion.

func (*MockVolumePlugin) DetachVolume

func (p *MockVolumePlugin) DetachVolume(ctx context.Context, volumeID string, node string) error

DetachVolume simulates volume detachment from a node.

func (*MockVolumePlugin) DriverName

func (p *MockVolumePlugin) DriverName(ctx context.Context) (string, error)

DriverName returns the driver name for mock plugin.

func (*MockVolumePlugin) MountVolume

func (p *MockVolumePlugin) MountVolume(ctx context.Context, req MountVolumeRequest) error

MountVolume simulates mounting volume on the host.

func (*MockVolumePlugin) UnmountVolume

func (p *MockVolumePlugin) UnmountVolume(ctx context.Context, volumeID string, targetPath string) error

UnmountVolume simulates unmounting volume from the host.

type MountVolumeRequest added in v0.4.0

type MountVolumeRequest struct {
	// VolumeID is the ID assigned by the storage system at creation.
	VolumeID string
	// TargetPath is the host path to mount the volume at.
	TargetPath string
	// VolumeContext is the metadata returned when the volume was created.
	VolumeContext map[string]string
	// PublishContext is the metadata returned when the volume was attached to
	// this node. It is empty for drivers that do not implement attachment.
	PublishContext map[string]string
}

MountVolumeRequest describes a volume to mount on the local node.

type VolumePluginControlPlane

type VolumePluginControlPlane interface {
	DriverName(ctx context.Context) (string, error)
	CreateVolume(ctx context.Context, req CreateVolumeRequest) (CreateVolumeResponse, error)
	DeleteVolume(ctx context.Context, volumeID string) error
	AttachVolume(ctx context.Context, req AttachVolumeRequest) (AttachVolumeResponse, error)
	DetachVolume(ctx context.Context, volumeID string, node string) error
}

VolumePluginControlPlane abstracts storage operations performed on the control plane.

type VolumePluginWorkerPlane

type VolumePluginWorkerPlane interface {
	MountVolume(ctx context.Context, req MountVolumeRequest) error
	UnmountVolume(ctx context.Context, volumeID string, targetPath string) error
}

VolumePluginWorkerPlane abstracts storage operations performed on worker nodes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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