volume

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

This file exposes volume plugin related contracts. Hence, any specific volume plugin implementor will implement the logic that aligns to the contracts exposed here. Some of the plugin based interfaces delegate to volume based interfaces to do the actual work.

This file models every volume action in form of an interface.

QUERY: How are these related to plugin based interfaces ?

The procedure to create concrete instances of these interfaces

are exposed via concrete instance(s) of volume plugin(s).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsVolumePlugin

func IsVolumePlugin(name string) bool

IsVolumePlugin returns true if name corresponds to an already registered volume plugin.

func RegisterVolumePlugin

func RegisterVolumePlugin(name string, factory VolumeFactory)

RegisterVolumePlugin registers a volume.VolumePlugin by name. This is just a registry entry. The actual initialization is done elsewhere with passing of dynamic parameters i.e.

  1. volume plugin config file and
  2. volume aspect instance

NOTE:

Each implementation of volume plugin need to call

RegisterVolumePlugin inside their init() function. func RegisterVolumePlugin(name string, factory VolumePluginFactory) {

func VolumePlugins

func VolumePlugins() []string

VolumePlugins returns the name of all registered volume plugins in a string slice

Types

type Deleter

type Deleter interface {
	// Delete removes the allocated resource in the storage system.
	//Delete() error
	Delete(*v1.PersistentVolume) error
}

Deleter removes the storage resource from the underlying storage infrastructure. Any error returned indicates the volume has failed to be reclaimed. A nil return indicates success.

type Provisioner

type Provisioner interface {
	// Provision tries creating (i.e. claim) a resource in the underlying storage
	// system. This method returns PersistentVolume representing the
	// created storage resource.
	//Provision() (*v1.PersistentVolume, error)
	Provision(*v1.PersistentVolumeClaim) (*v1.PersistentVolume, error)
}

Provisioner is an interface that can create the volume as a new resource in the storage infrastructure.

type VolumeFactory

type VolumeFactory func(config io.Reader, aspect VolumePluginAspect) (VolumeInterface, error)

VolumeFactory is a function that returns a volume.VolumeInterface. The config parameter provides an io.Reader handler to the factory in order to load specific configurations. If no configuration is provided the parameter is nil.

type VolumeInterface

type VolumeInterface interface {
	Name() string

	// This is a builder for Provisioner interface. Will return
	// false if not supported.
	Provisioner() (Provisioner, bool)

	// This is a builder for Deleter interface. Will return
	// false if not supported.
	Deleter() (Deleter, bool)
}

Volume represents an entity that is created by any storage infrastructure provider. type Volume interface {

func GetVolumePlugin

func GetVolumePlugin(name string, config io.Reader, aspect VolumePluginAspect) (VolumeInterface, error)

GetVolumePlugin creates an instance of the named volume plugin, or nil if the name is unknown. The error return is only used if the named volume plugin was known but failed to initialize. The config parameter specifies the io.Reader handler of the configuration file for the volume plugin, or nil for no configuation. func GetVolumePlugin(name string, config io.Reader, aspect VolumePluginAspect) (VolumePlugin, error) {

func InitVolumePlugin

func InitVolumePlugin(name string, configFilePath string, aspect VolumePluginAspect) (VolumeInterface, error)

TODO Who calls this ? This will currently be triggered while starting the binary as a http service ?

InitVolumePlugin creates an instance of the named volume plugin.

type VolumePluginAspect

type VolumePluginAspect interface {

	// Get the suitable orchestration provider.
	// A volume plugin may be linked with its provider e.g.
	// an orchestration provider like K8s, Nomad, Mesos, etc.
	//
	// Note:
	//    OpenEBS believes in running storage software in containers & hence
	// above container specific orchestrators.
	GetOrchProvider() (orchprovider.OrchestratorInterface, error)
}

VolumePluginAspect is an interface that provides a blueprint for plugins to cater to the needs when a plugin requires the help of a third party resource (library, provider, etc) to materialize a requirement.

type VolumePluginConfig

type VolumePluginConfig struct {

	// OtherAttributes stores config as strings.  These strings are opaque to
	// the system and only understood by the binary hosting the plugin and the
	// plugin itself.
	OtherAttributes map[string]string
}

VolumePluginConfig is how volume plugins receive configuration. An instance specific to the plugin will be passed to the plugin's ProbeVolumePlugins(config) func. Reasonable defaults will be provided by the binary hosting the plugins while allowing override of those default values. Those config values are then set to an instance of VolumePluginConfig and passed to the plugin.

Values in VolumeConfig are intended to be relevant to several plugins, but not necessarily all plugins. The preference is to leverage strong typing in this struct. All config items must have a descriptive but non-specific name (i.e, RecyclerMinimumTimeout is OK but RecyclerMinimumTimeoutForNFS is !OK). An instance of config will be given directly to the plugin, so config names specific to plugins are unneeded and wrongly expose plugins in this VolumeConfig struct.

OtherAttributes is a map of string values intended for one-off configuration of a plugin or config that is only relevant to a single plugin. All values are passed by string and require interpretation by the plugin. Passing config as strings is the least desirable option but can be used for truly one-off configuration. The binary should still use strong typing for this value when binding CLI values before they are passed as strings in OtherAttributes.

Directories

Path Synopsis
This file provides the necessary implementation to establish jiva as a mayaserver volume plugin.
This file provides the necessary implementation to establish jiva as a mayaserver volume plugin.

Jump to

Keyboard shortcuts

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