util

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventReasonValidationFailed is used when the StorageCluster spec validation fails
	EventReasonValidationFailed = "FailedValidation"

	// EventReasonUninstallPending is used when the StorageCluster uninstall is Pending
	EventReasonUninstallPending = "UninstallPending"
)
View Source
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"
)
View Source
const FileName = "/tmp/operator-sdk-ready"

FileName represent the full path to the file for determining ready status

View Source
const WatchNamespaceEnvVar = "WATCH_NAMESPACE"

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.

Variables

View Source
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"
)

These constants represent the overall Phase as used by .Status.Phase

Functions

func ComposePredicates

func ComposePredicates(predicates ...predicate.Predicate) predicate.Predicate

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 GetWatchNamespace

func GetWatchNamespace() (string, error)

GetWatchNamespace returns the namespace the operator should be watching for changes

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 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.

Types

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

type MetadataChangedPredicate struct {
	predicate.Funcs
}

MetadataChangedPredicate will only allow events that changed labels, annotations, or finalizers

func (MetadataChangedPredicate) Update

Update implements the update event trap for StorageClusterChangedPredicate

type Ready

type Ready interface {
	// Set ensures that future readiness probes will indicate that the operator
	// is ready.
	Set() error

	// Unset ensures that future readiness probes will indicate that the
	// operator is not ready.
	Unset() error
}

Ready holds state about whether the operator is ready and communicates that to a Kubernetes readiness probe.

func NewFileReady

func NewFileReady() Ready

NewFileReady returns a Ready that uses the presence of a file on disk to communicate whether the operator is ready. The operator's Pod definition should include a readinessProbe of "exec" type that calls "stat /tmp/operator-sdk-ready".

Jump to

Keyboard shortcuts

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