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: 10 Imported by: 7




View Source
const (
	// CRDRetryInterval is used if CRD is not present.
	CRDRetryInterval = 10 * time.Second
	// PoolNameHandlerInterval is used when expected pool is not present.
	PoolNameHandlerInterval = 5 * time.Second
	// SharedInformerInterval is used to sync watcher controller.
	SharedInformerInterval = 30 * time.Second
	// ResourceWorkerInterval is used for resource sync.
	ResourceWorkerInterval = time.Second
	// InitialZreplRetryInterval is used while initially starting controller.
	InitialZreplRetryInterval = 3 * time.Second
	// ContinuousZreplRetryInterval is used while controller has started running.
	ContinuousZreplRetryInterval = 1 * time.Second

Periodic interval duration.

View Source
const (
	// NoOfPoolWaitAttempts is number of attempts to wait in case of pod/container restarts.
	NoOfPoolWaitAttempts = 30
	// PoolWaitInterval is the interval to wait for pod/container restarts.
	PoolWaitInterval = 2 * time.Second
View Source
const (
	// DefaultNameSpace namespace `default`
	DefaultNameSpace string = "default"

Different types of k8s namespaces.


View Source
var InitialImportedPoolVol []string

InitialImportedPoolVol is to store pool-volume names while pod restart.


func CheckForCStorPool

func CheckForCStorPool()

CheckForCStorPool tries to get pool name and blocks forever because volumereplica can be created only if pool is present.

func CheckForCStorPoolCRD

func CheckForCStorPoolCRD(clientset clientset.Interface)

CheckForCStorPoolCRD is Blocking call for checking status of CStorPool CRD.

func CheckForCStorVolumeReplicaCRD

func CheckForCStorVolumeReplicaCRD(clientset clientset.Interface)

CheckForCStorVolumeReplicaCRD is Blocking call for checking status of CStorVolumeReplica CRD.

func CheckForInitialImportedPoolVol

func CheckForInitialImportedPoolVol(InitialImportedPoolVol []string, fullvolname string) bool

CheckForInitialImportedPoolVol is to check if volume is already imported with pool.

func CheckIfPresent

func CheckIfPresent(arrStr []string, searchStr string) bool

CheckIfPresent is to check if search string is present in array of string.

func Init

func Init()

Init is to instantiate variable used between pool and volumereplica while starting controller.

func PoolNameHandler

func PoolNameHandler(cVR *apis.CStorVolumeReplica, cnt int) bool

PoolNameHandler tries to get pool name and blocks for particular number of attempts.


type Environment

type Environment string

Environment is for environment variables passed for cstor-pool-mgmt.

const (
	// OpenEBSIOCStorID is the environment variable specified in pod.
	// OpenEBSIOCSPIID is cstorpoolinstance name as environment variable
	// specified in pool instance pods.
	// OpenEBSIOPoolName is cstorpoolcluster name as environment variable
	// specified in pod instance pods.
	OpenEBSIOPoolName Environment = "OPENEBS_IO_POOL_NAME"
	// RebuildEstimates is the feature gate environment variable to estimate
	// rebuild time for replica which is undergoing rebuild.
	RebuildEstimates Environment = "REBUILD_ESTIMATES"

type EventReason

type EventReason string

EventReason is used as part of the Event reason when a resource goes through different phases

const (
	// ToDo: Improve the messages and event reason. ( Put these in a similar k8s style)
	// SuccessSynced is used as part of the Event 'reason' when a resource is synced.
	SuccessSynced EventReason = "Synced"
	// FailedSynced is used as part of the Event 'reason' when resource sync fails.
	FailedSynced EventReason = "FailedSync"
	// MessageCreateSynced holds message for corresponding create request sync.
	MessageCreateSynced EventReason = "Received Resource create event"
	// MessageModifySynced holds message for corresponding modify request sync.
	MessageModifySynced EventReason = "Received Resource modify event"
	// MessageDestroySynced holds message for corresponding destroy request sync.
	MessageDestroySynced EventReason = "Received Resource destroy event"
	// StatusSynced holds message for corresponding status request sync.
	StatusSynced EventReason = "Resource status sync event"
	// SuccessCreated holds status for corresponding created resource.
	SuccessCreated EventReason = "Created"
	// MessageResourceCreated holds message for corresponding created resource.
	MessageResourceCreated EventReason = "Resource created successfully"
	// FailureCreate holds status for corresponding failed create resource.
	FailureCreate EventReason = "FailCreate"
	// MessageResourceFailCreate holds message for corresponding failed create resource.
	MessageResourceFailCreate EventReason = "Resource creation failed"
	// SuccessImported holds status for corresponding imported resource.
	SuccessImported EventReason = "Imported"
	// FailureImported holds status for corresponding imported resource.
	FailureImported EventReason = "Import failure"
	// FailureImportOperations holds status for corresponding imported resource.
	FailureImportOperations EventReason = "Failure Import operations"
	// MessageResourceImported holds message for corresponding imported resource.
	MessageResourceImported EventReason = "Resource imported successfully"
	// FailureStatusSync holds status for corresponding failed status sync of resource.
	FailureStatusSync EventReason = "FailStatusSync"
	// FailureCapacitySync holds status for corresponding failed capacity sync of resource.
	FailureCapacitySync EventReason = "FailCapacitySync"
	// MessageResourceFailStatusSync holds message for corresponding failed status sync of resource.
	MessageResourceFailStatusSync EventReason = "Resource status sync failed"
	// MessageResourceFailCapacitySync holds message for corresponding failed capacity sync of resource.
	MessageResourceFailCapacitySync EventReason = "Resource capacity sync failed"
	// MessageResourceSyncSuccess holds message for corresponding successful sync of resource.
	MessageResourceSyncSuccess EventReason = "Resource successfully synced"
	// MessageResourceSyncFailure holds message for corresponding failed sync of resource.
	MessageResourceSyncFailure EventReason = "Resource sync failed:"

	// FailureDestroy holds status for corresponding failed destroy resource.
	FailureDestroy EventReason = "FailDestroy"

	// FailureRemoveFinalizer holds the status when
	// the resource's finalizers could not be removed
	FailureRemoveFinalizer EventReason = "FailRemoveFinalizer"

	// MessageResourceFailDestroy holds descriptive message for
	// resource could not be deleted
	MessageResourceFailDestroy EventReason = "Resource Destroy failed"

	// FailureValidate holds status for corresponding failed validate resource.
	FailureValidate EventReason = "FailValidate"
	// MessageResourceFailValidate holds message for corresponding failed validate resource.
	MessageResourceFailValidate EventReason = "Resource validation failed"
	// AlreadyPresent holds status for corresponding already present resource.
	AlreadyPresent EventReason = "AlreadyPresent"
	// MessageResourceAlreadyPresent holds message for corresponding already present resource.
	MessageResourceAlreadyPresent EventReason = "Resource already present"
	// MessageImproperPoolStatus holds message for corresponding failed validate resource.
	MessageImproperPoolStatus EventReason = "Improper pool status"
	// PoolROThreshold holds status for pool read only state
	PoolROThreshold EventReason = "PoolReadOnlyThreshold"
	// MessagePoolROThreshold holds descriptive message for PoolROThreshold
	MessagePoolROThreshold EventReason = "Pool storage limit reached to threshold. Pool expansion is required to make it's replica RW"

type QueueLoad

type QueueLoad struct {
	Key       string
	Operation QueueOperation

QueueLoad represents the payload of the workqueue

It stores the key and corresponding type of operation

type QueueOperation

type QueueOperation string

QueueOperation determines the type of operation that needs to be executed on the watched resource

const (
	QOpAdd     QueueOperation = "add"
	QOpDestroy QueueOperation = "destroy"
	QOpModify  QueueOperation = "modify"

	// QOpSync is the operation to reconcile
	// cstor pool resource
	QOpSync QueueOperation = "Sync"

Different type of operations that can be supported by the controller/watcher logic

type SyncCStorPoolCVR

type SyncCStorPoolCVR struct {
	// Mux is mutex variable to block cvr until certain pool operations are complete.
	Mux *sync.Mutex

	// IsImported is boolean flag to check at cvr until certain pool import operations are complete.
	IsImported bool

SyncCStorPoolCVR is to hold synchronization related variables.

var SyncResources SyncCStorPoolCVR

SyncResources is to synchronize pool and volumereplica.

Jump to

Keyboard shortcuts

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