util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// SuccessfulCreateBlockCSIReason is added in an event when Block CSI
	// is successfully launched.
	SuccessfulLaunchBlockCSIReason      = "SuccessfulLaunchBlockCSI"
	FailedLaunchBlockCSIReason          = "FailedLaunchBlockCSI"
	SuccessfulDetectBlockCSIReason      = "SuccessfulDetectBlockCSI"
	FailedLaunchBlockExporterReason     = "FailedLaunchBlockExporter"
	FailedCreateServiceReason           = "FailedCreateService"
	FailedCreateServiceMonitorReason    = "FailedCreateServiceMonitor"
	FailedCreateStorageClassReason      = "FailedCreateStorageClass"
	DeletedDuplicatedStorageClassReason = "DeletedDuplicatedStorageClass"
	FailedCreatePromRuleReason          = "FailedCreatePromRule"
)

Reasons for ibm storage odf events

View Source
const (
	PoolConfigmapName      = "ibm-flashsystem-pools"
	PoolConfigmapMountPath = "/config"
	PoolConfigmapKey       = "pools"

	CsiIBMBlockDriver = "block.csi.ibm.com"
	CsiIBMBlockScPool = "pool"
)
View Source
const ExporterImageEnvVar = "EXPORTER_IMAGE"
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"
)

Functions

func CalculateDataHash

func CalculateDataHash(dataObject interface{}) (string, error)

CalculateDataHash generates a sha256 hex-digest for a data object

func DetermineOpenShiftVersion added in v1.0.0

func DetermineOpenShiftVersion(client client.Client) (string, error)

func FindStatusCondition

func FindStatusCondition(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) *odfv1alpha1.Condition

FindStatusCondition finds the conditionType in conditions.

func GeneratePoolConfigmapContent

func GeneratePoolConfigmapContent(sp ScPoolMap) (string, error)

func GetExporterImage

func GetExporterImage() (string, error)

GetExporterImage returns the exporter image from operator env by OLM bundle

func GetLabels

func GetLabels(clusterName string) map[string]string

GetLabels returns the labels with cluster name

func GetWatchNamespace

func GetWatchNamespace() (string, error)

GetWatchNamespace returns the namespace the operator should be watching for changes

func InitK8sEvent added in v1.0.0

func InitK8sEvent(instance *odfv1alpha1.FlashSystemCluster, eventtype, reason, message string) *corev1.Event

func IsContain

func IsContain(slice []string, s string) bool

func IsStatusConditionFalse

func IsStatusConditionFalse(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) bool

IsStatusConditionFalse returns true when the conditionType is present and set to `corev1.ConditionFalse`

func IsStatusConditionPresentAndEqual

func IsStatusConditionPresentAndEqual(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType, status corev1.ConditionStatus) bool

IsStatusConditionPresentAndEqual returns true when conditionType is present and equal to status.

func IsStatusConditionTrue

func IsStatusConditionTrue(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) bool

IsStatusConditionTrue returns true when the conditionType is present and set to `corev1.ConditionTrue`

func Remove

func Remove(slice []string, s string) (result []string)

func RemoveStatusCondition

func RemoveStatusCondition(conditions *[]odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType)

RemoveStatusCondition removes the corresponding conditionType from conditions.

func SetReconcileCompleteCondition

func SetReconcileCompleteCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)

SetCompleteCondition sets the ConditionReconcileComplete to True and other Conditions to indicate that the reconciliation process has completed successfully.

func SetReconcileErrorCondition

func SetReconcileErrorCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)

SetErrorCondition sets the ConditionReconcileComplete to False in case of any errors during the reconciliation process.

func SetReconcileProgressingCondition

func SetReconcileProgressingCondition(conditions *[]odfv1alpha1.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 SetStatusCondition

func SetStatusCondition(conditions *[]odfv1alpha1.Condition, newCondition odfv1alpha1.Condition)

SetStatusCondition sets the corresponding condition in conditions to newCondition.

Types

type ScPoolMap

type ScPoolMap struct {
	ScPool map[string]string `json:"storageclass_pool,omitempty"`
}

func GetPoolConfigmapContent

func GetPoolConfigmapContent() (ScPoolMap, error)

Jump to

Keyboard shortcuts

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