Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForCStorPool()
- func CheckForCStorVolumeReplicaCRD(clientset clientset.Interface)
- func CheckForInitialImportedPoolVol(InitialImportedPoolVol []string, fullvolname string) bool
- func CheckIfPresent(arrStr []string, searchStr string) bool
- func Init()
- func PoolNameHandler(cVR *cstor.CStorVolumeReplica, cnt int) bool
- type Environment
- type EventReason
- type QueueLoad
- type QueueOperation
- type SyncCStorPoolCVR
Constants ¶
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 = 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.
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 )
const ( // DefaultNameSpace namespace `default` DefaultNameSpace string = "default" )
Different types of k8s namespaces.
Variables ¶
var InitialImportedPoolVol []string
InitialImportedPoolVol is to store pool-volume names while pod restart.
Functions ¶
func CheckForCStorPool ¶
func CheckForCStorPool()
CheckForCStorPool tries to get pool name and blocks forever because volumereplica can be created only if pool is present.
func CheckForCStorVolumeReplicaCRD ¶
CheckForCStorVolumeReplicaCRD is Blocking call for checking status of CStorVolumeReplica CRD.
func CheckForInitialImportedPoolVol ¶
CheckForInitialImportedPoolVol is to check if volume is already imported with pool.
func CheckIfPresent ¶
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 *cstor.CStorVolumeReplica, cnt int) bool
PoolNameHandler tries to get pool name and blocks for particular number of attempts.
Types ¶
type Environment ¶
type Environment string
Environment is for environment variables passed for cstor-pool-mgmt.
const ( // specified in pool instance pods. OpenEBSIOCSPIID Environment = "OPENEBS_IO_CSPI_ID" // OpenEBSIOPoolName is cstorpoolcluster name as environment variable // specified in pod instance pods. OpenEBSIOPoolName Environment = "OPENEBS_IO_POOL_NAME" )
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" )
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.