volume

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 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 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

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

AttachVolume simulates volume attachment to a node.

func (*MockVolumePlugin) CreateVolume

func (p *MockVolumePlugin) CreateVolume(ctx context.Context, name string, capacity string, storageClass string, parameters map[string]string) (string, map[string]string, error)

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, volumeID string, targetPath string, volumeContext map[string]string) 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 VolumePluginControlPlane

type VolumePluginControlPlane interface {
	DriverName(ctx context.Context) (string, error)
	CreateVolume(ctx context.Context, name string, capacity string, driverName string, parameters map[string]string) (volumeID string, volumeContext map[string]string, err error)
	DeleteVolume(ctx context.Context, volumeID string) error
	AttachVolume(ctx context.Context, volumeID string, node string) 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, volumeID string, targetPath string, volumeContext map[string]string) 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