storage

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

This package contains the driver interface and their implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageClusterInterface

type StorageClusterInterface interface {
	// AddCluster adds a new storage cluster.
	// AddCluster will be called by Quartermaster controller when a new
	// storage cluster `c` is created as a StorageCluster TPR.
	// AddCluster may save metadata on the StorageCluster resource and
	// return it to Quartermaster for it to submit back to Kubernetes.
	// Quartermaster will create and submit a StorageNode automatically for each
	// described StorageNodeSpec in the StorageCluster, which will in turn create
	// new events.
	AddCluster(c *spec.StorageCluster) (*spec.StorageCluster, error)

	// UpdateCluster updates the cluster.
	// UpdateCluster will be called by Quartermaster controller when an existing
	// storage cluster `oldc` is updated to `newc`.
	UpdateCluster(oldc *spec.StorageCluster, newc *spec.StorageCluster) error

	// DeleteCluster deletes the cluster.
	// DeleteCluster will be called by Quartermaster controller when the storage cluster
	// `c` is deleted.  Quartermaster will then automatically go through the list
	// of StorageNodes which were created by this StorageCluster and delete each one.
	// This will cause an event which is then handled by DeleteNode.
	DeleteCluster(c *spec.StorageCluster) error
}

type StorageHandlerFuncs

type StorageHandlerFuncs struct {
	StorageHandler interface{}

	AddClusterFunc    func(c *spec.StorageCluster) (*spec.StorageCluster, error)
	UpdateClusterFunc func(old *spec.StorageCluster, new *spec.StorageCluster) error
	DeleteClusterFunc func(c *spec.StorageCluster) error

	MakeDeploymentFunc func(n *spec.StorageNode, old *v1beta1.Deployment) (*v1beta1.Deployment, error)
	AddNodeFunc        func(n *spec.StorageNode) (*spec.StorageNode, error)
	UpdateNodeFunc     func(n *spec.StorageNode) (*spec.StorageNode, error)
	DeleteNodeFunc     func(n *spec.StorageNode) error

	InitFunc func() error
	TypeFunc func() spec.StorageTypeIdentifier
}

StorageHandlerFuncs insulates the implementation from unsupported interface functions. Please see StorageType for documentation

func (StorageHandlerFuncs) AddCluster

func (StorageHandlerFuncs) AddNode

func (StorageHandlerFuncs) DeleteCluster

func (s StorageHandlerFuncs) DeleteCluster(c *spec.StorageCluster) error

func (StorageHandlerFuncs) DeleteNode

func (s StorageHandlerFuncs) DeleteNode(n *spec.StorageNode) error

func (StorageHandlerFuncs) Init

func (s StorageHandlerFuncs) Init() error

func (StorageHandlerFuncs) MakeDeployment

func (StorageHandlerFuncs) Type

func (StorageHandlerFuncs) UpdateCluster

func (s StorageHandlerFuncs) UpdateCluster(old *spec.StorageCluster,
	new *spec.StorageCluster) error

func (StorageHandlerFuncs) UpdateNode

type StorageNodeInterface

type StorageNodeInterface interface {
	// When a new StorageNode event is received, QM will ask the driver for a
	// Deployment object to deploy the containerized storage software.  This
	// deployment will be submitted to Kubernetes by QM which will then wait
	// until it is ready before calling AddNode().
	//
	// We use Deployments for now because they can handle rollouts and updates
	// well.  We could deploy other object deployment types in the future like
	// (StatefulSets, DaemonSets, etc).
	MakeDeployment(s *spec.StorageNode, old *v1beta1.Deployment) (*v1beta1.Deployment, error)

	// AddNode is called by Quartermaster when a deployment is Ready and is
	// avaiable to be managed by the driver.  AddNode may save metadata on the
	// StorageNode resource and return it to Quartermaster for it to submit
	// back to Kubernetes
	AddNode(s *spec.StorageNode) (*spec.StorageNode, error)

	// UpdateNode is called when Quartermaster is notified of an update to
	// a StorageNode resource
	UpdateNode(s *spec.StorageNode) (*spec.StorageNode, error)

	// DeleteNode is called when Quartermaster is notified of a deletion of
	// a StorageNode resource. This normally happens as a result of a
	// DeleteCluster event.
	DeleteNode(s *spec.StorageNode) error
}

type StorageType

type StorageType interface {
	StorageClusterInterface
	StorageNodeInterface

	// Called on program initialization
	Init() error

	// Must be supplied
	Type() spec.StorageTypeIdentifier
}

type StorageTypeNewFunc

type StorageTypeNewFunc func(kubernetes.Interface, restclient.Interface) (StorageType, error)

Registers driver with Quartermaster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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