Files
virtual-kubelet/vendor/github.com/vmware/vic/doc/design/volumes.md
Loc Nguyen 513cebe7b7 VMware vSphere Integrated Containers provider (#206)
* Add Virtual Kubelet provider for VIC

Initial virtual kubelet provider for VMware VIC.  This provider currently
handles creating and starting of a pod VM via the VIC portlayer and persona
server.  Image store handling via the VIC persona server.  This provider
currently requires the feature/wolfpack branch of VIC.

* Added pod stop and delete.  Also added node capacity.

Added the ability to stop and delete pod VMs via VIC.  Also retrieve
node capacity information from the VCH.

* Cleanup and readme file

Some file clean up and added a Readme.md markdown file for the VIC
provider.

* Cleaned up errors, added function comments, moved operation code

1. Cleaned up error handling.  Set standard for creating errors.
2. Added method prototype comments for all interface functions.
3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder.

* Add mocking code and unit tests for podcache, podcreator, and podstarter

Used the unit test framework used in VIC to handle assertions in the provider's
unit test.  Mocking code generated using OSS project mockery, which is compatible
with the testify assertion framework.

* Vendored packages for the VIC provider

Requires feature/wolfpack branch of VIC and a few specific commit sha of
projects used within VIC.

* Implementation of POD Stopper and Deleter unit tests (#4)

* Updated files for initial PR
2018-06-04 15:41:32 -07:00

2.3 KiB

Volume support

Volumes are mutable disk devices, backed by .vmdk, whos lifetime is decoupled from that of the container VM.

Requirements

  • To create a volume by ID in PL on the specified datastore + path via volumestore name and return a URI pointing it.
  • To create "anonymous" volumes and identify them with a generated ID`.
  • To (statefully) remove a volume via the PL by its URI.
  • To reference an existing volume in the spec for a new container by its vmkd path
  • Store (immutable) metadata in "key"/[]byte{"value"} form.

Filesystem requirements

Mirrors what exists in the storage layer for images. Currently there is an implementation for ext4, but the underlying disk implementation is opaque to this. In short, we'll use ext4 for now, but using any other filesystem shouldn't be a huge change.

Datastore destination

The VI admin will specify datastore + paths which volumes should be created on, giving each of them a volumestore to identify them. For instance [datastore1] /path/to/volumes can be identified by volumestore name datastoreWithVolumes. The the docker user can supply this volumestore name to as a driver arg when creating the volume. The result will be a .vmdk created in the [datastore1] /path/to/volumes/VIC/<vch uuid>/volumes/<volume name>/<volume name>.vmdk

Definitions

// Unique identifier for the volume.  Enumeration of volumes is done via these tags.
type Tag string

type Volume struct {
	// Identifies the volume
	Tag 	Tag

	// The datastore the volume lives on
	Datastore *object.Datastore

	// Metadata the volume is included with.  Is persisted along side the volume vmdk.
	Info    map[string][]byte

	// Namespace in the storage layer to look up this volume.
	SelfLink url.URL
}

// VolumeStorer is an interface to create, remove, enumerate, and get Volumes.
type VolumeStorer interface {
	// Creates a volume on the given volume store, of the given size, with the given metadata.
	VolumeCreate(ctx context.Context, ID string, store *url.URL, capacityKB uint64, info map[string][]byte) (*Volume, error)

	// Get an existing volume via it's ID.
	VolumeGet(ctx context.Context, ID string) (*Volume, error)

	// Destroys a volume
	VolumeDestroy(ctx context.Context, ID string) error

	// Lists all volumes
	VolumesList(ctx context.Context) ([]*Volume, error)
}