v1.12.1 Latest Latest

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 35 Imported by: 1




View Source
const (
	// DiskStateActive is the active state of the disk
	DiskStateActive = "Active"
	// ProvisioningTypeManual is the manual type of provisioning pool
	ProvisioningTypeManual = "manual"
View Source
const (
	// SpcLeaseKey is the key that will be used to acquire lease on spc object.
	// It will be present in spc annotations.
	// If key has an empty value, that means no one has acquired a lease on spc object.
	SpcLeaseKey = "openebs.io/spc-lease"
	// PatchOperation is the strategy of patch operation.
	PatchOperation = "replace"
	// PatchPath is the path to the field on spc object which need to be patched.
	PatchPath = "/metadata/annotations/openebs.io~1spc-lease"


This section is empty.


func Start

func Start(controllerMtx *sync.RWMutex) error

Start starts the cstor-operator.


type CasPoolBuilder

type CasPoolBuilder struct {
	CasPool *apis.CasPool

CasPoolBuilder is the builder object for cas pool.

func NewCasPoolBuilder

func NewCasPoolBuilder() *CasPoolBuilder

NewCasPoolBuilder returns an empty instance of CasPoolBuilder.

func (*CasPoolBuilder) Build

func (cb *CasPoolBuilder) Build() *apis.CasPool

Build returns an instance of cas pool object.

func (*CasPoolBuilder) WithPoolROThreshold

func (cb *CasPoolBuilder) WithPoolROThreshold(poolROThreshold int) *CasPoolBuilder

WithPoolROThreshold set PoolROThreshold value

type Controller

type Controller struct {
	// contains filtered or unexported fields

Controller is the controller implementation for SPC resources

func (*Controller) NewPoolCreateConfig

func (c *Controller) NewPoolCreateConfig(spc *apis.StoragePoolClaim) *PoolCreateConfig

NewPoolCreateConfig returns an instance of pool create config.

func (*Controller) Run

func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error

Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workqueue and wait for workers to finish processing their current work items.

type ControllerBuilder

type ControllerBuilder struct {
	Controller *Controller

ControllerBuilder is the builder object for controller.

func NewControllerBuilder

func NewControllerBuilder() *ControllerBuilder

NewControllerBuilder returns an empty instance of controller builder.

func (*ControllerBuilder) Build

func (cb *ControllerBuilder) Build() (*Controller, error)

Build returns a controller instance.

type Lease

type Lease struct {
	// Object is the object over which lease is to be taken
	Object interface{}
	// contains filtered or unexported fields

Lease is the struct which will implement the Leases interface

func (*Lease) Hold

func (sl *Lease) Hold() error

Hold is the implenetation of method from interface Leases It will try to hold a lease on spc object.

func (*Lease) Release

func (sl *Lease) Release()

Release method is implementation of to release lease on a given spc.

func (*Lease) Update

func (sl *Lease) Update(podName string) error

Update will update a lease on spc depending on type of update that is required. We have following type of update strategy: 1.putKeyValue 2.putValue 3.putUpdatedValue See the functions(below) for more details on update strategy

type LeaseContract

type LeaseContract struct {
	// Holder is the namespace/name of the pod who acquires the lease
	Holder string `json:"holder"`
	// LeaderTransition is the count of lease that has been taken on the object
	// in its lifetime.
	// e.g. One of the pod takes a lease on the object and release and then some other
	// pod (or even the same pod ) takes a lease again on the object its leaderTransition
	// value is 1.
	// If an object has leaderTranisiton value equal to 'n' that means it was leased
	// 'n+1' times in its lifetime by distinct, same or some distinct and some same pods.
	LeaderTransition int `json:"leaderTransition"`

LeaseContract struct will be used as a value of lease key that will give information about an acquired lease on object The struct object will be parsed to string which will be then put as a value to the lease key of object annotation.

type Leaser

type Leaser interface {
	// Hold will try to get a lease, in case of failure it will return error
	Hold() error
	// Update will update the lease value on the object
	Update(leaseValue string) error
	// Release will remove the acquired lease on the object

Leaser is an interface which assists in getting and releasing lease on an object

type Patch

type Patch struct {
	// Op defines the operation
	Op string `json:"op"`
	// Path defines the key path
	// eg. for
	// {
	//  	"Name": "openebs"
	//	    Category: {
	//		  "Inclusive": "v1",
	//		  "Rank": "A"
	//	     }
	// }
	// The path of 'Inclusive' would be
	// "/Name/Category/Inclusive"
	Path  string `json:"path"`
	Value string `json:"value"`

Patch struct will used to patch the spc object by a lease holder to release the lease once done.

type PoolCreateConfig

type PoolCreateConfig struct {

PoolCreateConfig is config object used to create a cstor pool.

func (*PoolCreateConfig) CreateStoragePool

func (pc *PoolCreateConfig) CreateStoragePool(spcGot *apis.StoragePoolClaim) error

CreateStoragePool is a function that does following:

  1. It receives storagepoolclaim object from the spc watcher event handler.
  2. After successful validation, it will call a worker function for actual storage creation via the cas template specified in storagepoolclaim.

Jump to

Keyboard shortcuts

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