Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateDataHash(dataObject interface{}) (string, error)
- func DetermineOpenShiftVersion(client client.Client) (string, error)
- func FindStatusCondition(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) *odfv1alpha1.Condition
- func GetCreateConfigmap(client client.Client, log logr.Logger, ns string, createIfMissing bool) (*corev1.ConfigMap, error)
- func GetExporterImage() (string, error)
- func GetLabels() map[string]string
- func GetStorageClassSecret(client client.Client, sc *storagev1.StorageClass) (corev1.Secret, error)
- func GetStorageClassSecretNamespacedName(sc *storagev1.StorageClass) (string, string, error)
- func GetWatchNamespace() (string, error)
- func InitK8sEvent(instance *odfv1alpha1.FlashSystemCluster, eventType, reason, message string) *corev1.Event
- func IsContain(slice []string, s string) bool
- func IsStatusConditionFalse(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) bool
- func IsStatusConditionPresentAndEqual(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType, ...) bool
- func IsStatusConditionTrue(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) bool
- func MapClustersByMgmtAddress(client client.Client, logger logr.Logger) (map[string]v1alpha1.FlashSystemCluster, error)
- func ReadPoolConfigMapFile() (map[string]FlashSystemClusterMapContent, error)
- func Remove(slice []string, s string) (result []string)
- func RemoveStatusCondition(conditions *[]odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType)
- func SetReconcileCompleteCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)
- func SetReconcileErrorCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)
- func SetReconcileProgressingCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)
- func SetReconcileProvisionerErrorCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)
- func SetStatusCondition(conditions *[]odfv1alpha1.Condition, newCondition odfv1alpha1.Condition)
- type FSCConfigMapData
- type FSCMatchNotFoundError
- type FlashSystemClusterMapContent
- type Label
- type UniqueFSCMatchError
Constants ¶
const ( // SuccessfulLaunchBlockCSIReason is added in an event when Block CSI is successfully launched. SuccessfulLaunchBlockCSIReason = "SuccessfulLaunchBlockCSI" FailedLaunchBlockCSIReason = "FailedLaunchBlockCSI" SuccessfulDetectBlockCSIReason = "SuccessfulDetectBlockCSI" FailedLaunchBlockExporterReason = "FailedLaunchBlockExporter" FailedEnsureSecretOwnershipReason = "FailedEnsureSecretOwnership" FailedCreateServiceReason = "FailedCreateService" FailedScPoolConfigMapReason = "FailedEnsureScPoolConfigMap" FailedCreateServiceMonitorReason = "FailedCreateServiceMonitor" FailedCreateStorageClassReason = "FailedCreateStorageClass" DeletedDuplicatedStorageClassReason = "DeletedDuplicatedStorageClass" FailedCreatePromRuleReason = "FailedCreatePromRule" )
Reasons for ibm storage odf events
const ( PoolConfigmapName = "ibm-flashsystem-pools" PoolsKey = "pools" FSCConfigmapMountPath = "/config" TopologySecretDataKey = "config" TopologyStorageClassByMgmtId = "by_management_id" PVMgmtAddrKey = "array_address" CsiIBMBlockDriver = "block.csi.ibm.com" CsiIBMBlockScPool = "pool" PersistentVolumeClaimKind = "PersistentVolumeClaim" DefaultSecretNameKey = "csi.storage.k8s.io/secret-name" // #nosec G101 - false positive DefaultSecretNamespaceKey = "csi.storage.k8s.io/secret-namespace" // #nosec G101 - false positive ProvisionerSecretNameKey = "csi.storage.k8s.io/provisioner-secret-name" // #nosec G101 - false positive ProvisionerSecretNamespaceKey = "csi.storage.k8s.io/provisioner-secret-namespace" // #nosec G101 - false positive SecretManagementAddressKey = "management_address" // #nosec G101 - false positive )
const ExporterImageEnvVar = "EXPORTER_IMAGE"
const OdfFsStorageSystemLabelKey = "odf-fs-storage-system"
const WatchNamespaceEnvVar = "RESOURCES_NAMESPACE"
WatchNamespaceEnvVar is the constant for env variable RESOURCES_NAMESPACE which is the namespace where the watch activity happens. this value is empty if the operator is running with clusterScope.
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" )
var ComponentLabel = Label{"app.kubernetes.io/component", "ibm-storage-odf-operator"}
var IgnoreUpdateAndGenericPredicate = predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { return true }, DeleteFunc: func(e event.DeleteEvent) bool { return true }, UpdateFunc: func(e event.UpdateEvent) bool { return false }, GenericFunc: func(e event.GenericEvent) bool { return false }, }
var OdfFsLabel = Label{"odf-fs", "odf-fs-workspace"}
var OdfLabel = Label{"odf", "storage.ibm.com"}
var RunDeletePredicate = predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { return false }, DeleteFunc: func(e event.DeleteEvent) bool { return true }, UpdateFunc: func(e event.UpdateEvent) bool { return false }, GenericFunc: func(e event.GenericEvent) bool { return false }, }
var SecretMgmtAddrPredicate = predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { secret, ok := e.Object.(*corev1.Secret) if !ok { return false } _, isTopology := secret.Data[TopologySecretDataKey] if isTopology { return isTopologySecretHasMgmtAddr(secret) } _, exist := secret.Data[SecretManagementAddressKey] return exist }, DeleteFunc: func(e event.DeleteEvent) bool { secret, ok := e.Object.(*corev1.Secret) if !ok { return false } _, isTopology := secret.Data[TopologySecretDataKey] if isTopology { return isTopologySecretHasMgmtAddr(secret) } _, exist := secret.Data[SecretManagementAddressKey] return exist }, UpdateFunc: func(e event.UpdateEvent) bool { oldSecret, ok := e.ObjectOld.(*corev1.Secret) newSecret := e.ObjectNew.(*corev1.Secret) if !ok { return false } _, isTopology := oldSecret.Data[TopologySecretDataKey] if isTopology { return isTopologySecretUpdated(oldSecret, newSecret) } oldMgmtAddr, exist1 := oldSecret.Data[SecretManagementAddressKey] newMgmtAddr, exist2 := newSecret.Data[SecretManagementAddressKey] return exist1 && exist2 && (string(oldMgmtAddr) != string(newMgmtAddr)) }, GenericFunc: func(e event.GenericEvent) bool { return false }, }
Functions ¶
func CalculateDataHash ¶
CalculateDataHash generates a sha256 hex-digest for a data object
func DetermineOpenShiftVersion ¶ added in v1.0.0
func FindStatusCondition ¶
func FindStatusCondition(conditions []odfv1alpha1.Condition, conditionType odfv1alpha1.ConditionType) *odfv1alpha1.Condition
FindStatusCondition finds the conditionType in conditions.
func GetCreateConfigmap ¶ added in v1.3.0
func GetExporterImage ¶
GetExporterImage returns the exporter image from operator env by OLM bundle
func GetStorageClassSecret ¶ added in v1.3.0
func GetStorageClassSecretNamespacedName ¶ added in v1.3.0
func GetStorageClassSecretNamespacedName(sc *storagev1.StorageClass) (string, string, error)
func GetWatchNamespace ¶
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 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 MapClustersByMgmtAddress ¶ added in v1.3.0
func ReadPoolConfigMapFile ¶ added in v1.3.0
func ReadPoolConfigMapFile() (map[string]FlashSystemClusterMapContent, error)
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)
SetReconcileCompleteCondition 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)
SetReconcileErrorCondition 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)
SetReconcileProgressingCondition 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 SetReconcileProvisionerErrorCondition ¶ added in v1.3.0
func SetReconcileProvisionerErrorCondition(conditions *[]odfv1alpha1.Condition, reason string, message string)
SetReconcileProvisionerErrorCondition sets the ProvisionerReady to False in case CSI driver fails to start
func SetStatusCondition ¶
func SetStatusCondition(conditions *[]odfv1alpha1.Condition, newCondition odfv1alpha1.Condition)
SetStatusCondition sets the corresponding condition in conditions to newCondition.
Types ¶
type FSCConfigMapData ¶ added in v1.3.0
type FSCConfigMapData struct {
FlashSystemClusterMap map[string]FlashSystemClusterMapContent
}
type FSCMatchNotFoundError ¶ added in v1.3.0
type FSCMatchNotFoundError struct{}
func (*FSCMatchNotFoundError) Error ¶ added in v1.3.0
func (m *FSCMatchNotFoundError) Error() string
type FlashSystemClusterMapContent ¶ added in v1.3.0
type UniqueFSCMatchError ¶ added in v1.3.0
type UniqueFSCMatchError struct{}
func (*UniqueFSCMatchError) Error ¶ added in v1.3.0
func (m *UniqueFSCMatchError) Error() string