Documentation ¶
Index ¶
- Constants
- Variables
- func AddAnnotation(obj metav1.Object, key string, value string) bool
- func AddLabel(obj metav1.Object, key string, value string) bool
- func ComposePredicates(predicates ...predicate.Predicate) predicate.Predicate
- func DetectDuplicateInStringSlice(slice []string) bool
- func Find[T any](list []T, f func(item *T) bool) *T
- func GenerateNameForNonResilientCephBlockPoolSC(initData *ocsv1.StorageCluster) string
- func GenerateOnboardingToken(tokenLifetimeInHours int, privateKeyPath string) (string, error)
- func GetClusterID(ctx context.Context, kubeClient client.Client, logger *logr.Logger) string
- func GetCountOfRunningPods(podList *corev1.PodList) int
- func GetKeyRotationSpec(sc *ocsv1.StorageCluster) (bool, string)
- func GetOperatorNamespace() (string, error)
- func GetPGBaseUnitSize(osdCount int) int
- func GetPodsWithLabels(ctx context.Context, kubeClient client.Client, namespace string, ...) (*corev1.PodList, error)
- func GetStorageClassWithName(ctx context.Context, kubeClient client.Client, name string) *storagev1.StorageClass
- func GetWatchNamespace() (string, error)
- func IsSingleNodeDeployment() bool
- func MapCephClusterNegativeConditions(conditions *[]conditionsv1.Condition, found *cephv1.CephCluster)
- func MapCephClusterNoConditions(conditions *[]conditionsv1.Condition, reason string, message string)
- func MapExternalCephClusterNegativeConditions(conditions *[]conditionsv1.Condition, found *cephv1.CephCluster)
- func MapNoobaaNegativeConditions(conditions *[]conditionsv1.Condition, found *nbv1.NooBaa)
- func OwnersIndexFieldFunc(obj client.Object) []string
- func RemoveDuplicatesFromStringSlice(slice []string) []string
- func RemoveExternalCephClusterNegativeConditions(conditions *[]conditionsv1.Condition)
- func RestartPod(ctx context.Context, kubeClient client.Client, logger *logr.Logger, ...)
- func SetCompleteCondition(conditions *[]conditionsv1.Condition, reason string, message string)
- func SetErrorCondition(conditions *[]conditionsv1.Condition, reason string, message string)
- func SetProgressingCondition(conditions *[]conditionsv1.Condition, reason string, message string)
- func SetVersionMismatchCondition(conditions *[]conditionsv1.Condition, status corev1.ConditionStatus, ...)
- type Clusters
- func (c *Clusters) AreOtherStorageClustersReady(instance *ocsv1.StorageCluster) bool
- func (c *Clusters) GetExternalStorageClusters() []ocsv1.StorageCluster
- func (c *Clusters) GetInternalStorageClusters() []ocsv1.StorageCluster
- func (c *Clusters) GetNames() []string
- func (c *Clusters) GetNamespacedNames() []string
- func (c *Clusters) GetNamespaces() []string
- func (c *Clusters) GetStorageClusters() []ocsv1.StorageCluster
- func (c *Clusters) GetStorageClustersInNamespace(namespace string) []ocsv1.StorageCluster
- func (c *Clusters) HasMultipleStorageClustersInNamespace(namespace string) bool
- func (c *Clusters) HasMultipleStorageClustersWithSameName(name string) bool
- func (c *Clusters) IsExternalStorageClusterExist() bool
- func (c *Clusters) IsInternalAndExternalStorageClustersExist() bool
- func (c *Clusters) IsInternalStorageClusterExist() bool
- type EventReporter
- type MetadataChangedPredicate
Constants ¶
const ( // EventReasonValidationFailed is used when the StorageCluster spec validation fails EventReasonValidationFailed = "FailedValidation" // EventReasonUninstallPending is used when the StorageCluster uninstall is Pending EventReasonUninstallPending = "UninstallPending" )
const ( // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE // which is the namespace where the watch activity happens. // this value is empty if the operator is running with clusterScope. WatchNamespaceEnvVar = "WATCH_NAMESPACE" // SingleNodeEnvVar is set if StorageCluster needs to be deployed on a single node SingleNodeEnvVar = "SINGLE_NODE" // This configmap is purely for the OCS operator to use. OcsOperatorConfigName = "ocs-operator-config" // This configmap is watched by rook-ceph-operator & is reserved only for manual overrides. RookCephOperatorConfigName = "rook-ceph-operator-config" // These are the keys in the ocs-operator-config configmap ClusterNameKey = "CSI_CLUSTER_NAME" RookCurrentNamespaceOnlyKey = "ROOK_CURRENT_NAMESPACE_ONLY" EnableTopologyKey = "CSI_ENABLE_TOPOLOGY" TopologyDomainLabelsKey = "CSI_TOPOLOGY_DOMAIN_LABELS" EnableNFSKey = "ROOK_CSI_ENABLE_NFS" CsiDisableHolderPodsKey = "CSI_DISABLE_HOLDER_PODS" DisableCSIDriverKey = "ROOK_CSI_DISABLE_DRIVER" // This is the name for the OwnerUID FieldIndex OwnerUIDIndexName = "ownerUID" )
const ( // ExternalClusterConnectingReason indicates the storage cluster is trying to connect to an external one. ExternalClusterConnectingReason = "ExternalClusterStateConnecting" // ExternalClusterUnknownReason is for unknown cluster condition/state ExternalClusterUnknownReason = "ExternalClusterStateUnknownCondition" // ExternalClusterErrorReason indicates an error state ExternalClusterErrorReason = "ExternalClusterStateError" // VersionValidReason indicates version in SC CR and operator is equal VersionValidReason = "VersionMatched" )
const OperatorNamespaceEnvVar = "OPERATOR_NAMESPACE"
OperatorNamespaceEnvVar is the constant for env variable OPERATOR_NAMESPACE which is the namespace where operator pod is deployed.
Variables ¶
var ( // PhaseIgnored is used when a resource is ignored PhaseIgnored = "Ignored" // PhaseProgressing is used when SetProgressingCondition is called PhaseProgressing = "Progressing" // PhaseError is used when SetErrorCondition is called PhaseError = "Error" // PhaseReady is used when SetCompleteCondition is called PhaseReady = "Ready" // PhaseNotReady is used when waiting for system to be ready // after reconcile is successful PhaseNotReady = "Not Ready" // PhaseClusterExpanding is used when cluster is expanding capacity PhaseClusterExpanding = "Expanding Capacity" // PhaseDeleting is used when cluster is deleting PhaseDeleting = "Deleting" // PhaseConnecting is used when cluster is connecting to external cluster PhaseConnecting = "Connecting" // PhaseOnboarding is used when consumer is Onboarding PhaseOnboarding = "Onboarding" )
These constants represent the overall Phase as used by .Status.Phase
Functions ¶
func ComposePredicates ¶
ComposePredicates will compose a variable number of predicates and return a predicate that will allow events that are allowed by any of the given predicates.
func GenerateNameForNonResilientCephBlockPoolSC ¶
func GenerateNameForNonResilientCephBlockPoolSC(initData *ocsv1.StorageCluster) string
func GenerateOnboardingToken ¶
GenerateOnboardingToken generates a token valid for a duration of "tokenLifetimeInHours". The token content is predefined and signed by the private key which'll be read from supplied "privateKeyPath".
func GetClusterID ¶
getClusterID returns the cluster ID of the OCP-Cluster
func GetCountOfRunningPods ¶
getCountOfRunningPods gives the count of pods in running state in a given pod list
func GetKeyRotationSpec ¶
func GetKeyRotationSpec(sc *ocsv1.StorageCluster) (bool, string)
func GetOperatorNamespace ¶
GetOperatorNamespace returns the namespace where the operator is deployed.
func GetPGBaseUnitSize ¶
func GetPodsWithLabels ¶
func GetPodsWithLabels(ctx context.Context, kubeClient client.Client, namespace string, labelSelector map[string]string) (*corev1.PodList, error)
GetPodsWithLabels gives all the pods that are in a namespace after filtering them based on the given label selector
func GetStorageClassWithName ¶
func GetStorageClassWithName(ctx context.Context, kubeClient client.Client, name string) *storagev1.StorageClass
GetStorageClassWithName returns the storage class object by name
func GetWatchNamespace ¶
GetWatchNamespace returns the namespace the operator should be watching for changes
func IsSingleNodeDeployment ¶
func IsSingleNodeDeployment() bool
IsSingleNodeDeployment returns true if StorageCluster needs to be deployed on a single node.
func MapCephClusterNegativeConditions ¶
func MapCephClusterNegativeConditions(conditions *[]conditionsv1.Condition, found *cephv1.CephCluster)
MapCephClusterNegativeConditions maps the status states from CephCluster resource into ocs status conditions. This will only look for negative conditions: !Available, Degraded, Progressing
func MapCephClusterNoConditions ¶
func MapCephClusterNoConditions(conditions *[]conditionsv1.Condition, reason string, message string)
MapCephClusterNoConditions sets status conditions to progressing. Used when component operator isn't reporting any status, and we have to assume progress.
func MapExternalCephClusterNegativeConditions ¶
func MapExternalCephClusterNegativeConditions(conditions *[]conditionsv1.Condition, found *cephv1.CephCluster)
MapExternalCephClusterNegativeConditions maps the status states from CephCluster resource into ocs status conditions. This will only look for negative conditions: !Available, Degraded, Progressing
func MapNoobaaNegativeConditions ¶
func MapNoobaaNegativeConditions(conditions *[]conditionsv1.Condition, found *nbv1.NooBaa)
MapNoobaaNegativeConditions records noobaa related conditions This will only look for negative conditions: !Available, Degraded, Progressing
func OwnersIndexFieldFunc ¶
func RemoveExternalCephClusterNegativeConditions ¶
func RemoveExternalCephClusterNegativeConditions(conditions *[]conditionsv1.Condition)
RemoveExternalCephClusterNegativeConditions removes the External cluster negative conditions
func RestartPod ¶
func RestartPod(ctx context.Context, kubeClient client.Client, logger *logr.Logger, name string, namespace string)
RestartPod restarts the pod with the given name in the given namespace by deleting it and letting another one be created
func SetCompleteCondition ¶
func SetCompleteCondition(conditions *[]conditionsv1.Condition, reason string, message string)
SetCompleteCondition sets the ConditionReconcileComplete to True and other Conditions to indicate that the reconciliation process has completed successfully.
func SetErrorCondition ¶
func SetErrorCondition(conditions *[]conditionsv1.Condition, reason string, message string)
SetErrorCondition sets the ConditionReconcileComplete to False in case of any errors during the reconciliation process.
func SetProgressingCondition ¶
func SetProgressingCondition(conditions *[]conditionsv1.Condition, reason string, message string)
SetProgressingCondition sets the ProgressingCondition to True and other conditions to false or Unknown. Used when we are just starting to reconcile, and there are no existing conditions.
func SetVersionMismatchCondition ¶
func SetVersionMismatchCondition(conditions *[]conditionsv1.Condition, status corev1.ConditionStatus, reason string, message string)
SetVersionMismatchCondition sets the ConditionVersionMismatch to the status passed as argument, if the same status is not already present
Types ¶
type Clusters ¶
type Clusters struct {
// contains filtered or unexported fields
}
func (*Clusters) AreOtherStorageClustersReady ¶
func (c *Clusters) AreOtherStorageClustersReady(instance *ocsv1.StorageCluster) bool
AreOtherStorageClustersReady checks if all other storage clusters (internal and external) are ready.
func (*Clusters) GetExternalStorageClusters ¶
func (c *Clusters) GetExternalStorageClusters() []ocsv1.StorageCluster
func (*Clusters) GetInternalStorageClusters ¶
func (c *Clusters) GetInternalStorageClusters() []ocsv1.StorageCluster
func (*Clusters) GetNamespacedNames ¶
func (*Clusters) GetNamespaces ¶
func (*Clusters) GetStorageClusters ¶
func (c *Clusters) GetStorageClusters() []ocsv1.StorageCluster
func (*Clusters) GetStorageClustersInNamespace ¶
func (c *Clusters) GetStorageClustersInNamespace(namespace string) []ocsv1.StorageCluster
func (*Clusters) HasMultipleStorageClustersInNamespace ¶
func (*Clusters) HasMultipleStorageClustersWithSameName ¶
func (*Clusters) IsExternalStorageClusterExist ¶
func (*Clusters) IsInternalAndExternalStorageClustersExist ¶
func (*Clusters) IsInternalStorageClusterExist ¶
type EventReporter ¶
type EventReporter struct {
// contains filtered or unexported fields
}
EventReporter is custom events reporter type which allows user to limit the events
func NewEventReporter ¶
func NewEventReporter(recorder record.EventRecorder) *EventReporter
NewEventReporter returns EventReporter object
func (*EventReporter) ReportIfNotPresent ¶
func (rep *EventReporter) ReportIfNotPresent(instance runtime.Object, eventType, eventReason, msg string)
ReportIfNotPresent will report event if lastReportedEvent is not the same in last 60 minutes
type MetadataChangedPredicate ¶
MetadataChangedPredicate will only allow events that changed labels, annotations, or finalizers
func (MetadataChangedPredicate) Update ¶
func (p MetadataChangedPredicate) Update(e event.UpdateEvent) bool
Update implements the update event trap for StorageClusterChangedPredicate