utils

package
v0.0.0-...-0028f1d Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OperatorNamespaceEnvVar is the constant for env variable OPERATOR_NAMESPACE
	// which is the namespace where operator pod is deployed.
	OperatorNamespaceEnvVar = "OPERATOR_NAMESPACE"

	// WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE
	// which indicates any other namespace to watch for resources.
	WatchNamespaceEnvVar = "WATCH_NAMESPACE"

	// OperatorPodNameEnvVar is the constant for env variable OPERATOR_POD_NAME
	OperatorPodNameEnvVar = "OPERATOR_POD_NAME"

	// StorageClientNameEnvVar is the constant for env variable STORAGE_CLIENT_NAME
	StorageClientNameEnvVar = "STORAGE_CLIENT_NAME"

	StatusReporterImageEnvVar = "STATUS_REPORTER_IMAGE"

	// Value corresponding to annotation key has subscription channel
	DesiredSubscriptionChannelAnnotationKey = "ocs.openshift.io/subscription.channel"

	// Value corresponding to annotation key has desired client hash
	DesiredConfigHashAnnotationKey = "ocs.openshift.io/provider-side-state"

	TopologyDomainLabelsAnnotationKey = "ocs.openshift.io/csi-rbd-topology-domain-labels"

	CronScheduleWeekly = "@weekly"

	ExitCodeThatShouldRestartTheProcess = 42

	OcsClientTimeout = 10 * time.Second

	OperatorVersionEnvVar = "OPERATOR_VERSION"
)

Variables

This section is empty.

Functions

func AddAnnotation

func AddAnnotation(obj metav1.Object, key string, value string) bool

AddAnnotation adds an annotation to a resource metadata, returns true if added else false

func AddAnnotations

func AddAnnotations(obj metav1.Object, newAnnotations map[string]string)

func AddLabel

func AddLabel(obj metav1.Object, key string, value string) bool

AddAnnotation adds label to a resource metadata, returns true if added else false

func AddLabels

func AddLabels(obj metav1.Object, newLabels map[string]string)

AddLabels adds values from newLabels to the keys on the supplied obj or overwrites values for existing keys on the obj

func AssertEqual

func AssertEqual[T comparable](actual T, expected T, exitCode int)

func EventTypePredicate

func EventTypePredicate(create, update, del, generic bool) predicate.Predicate

EventTypePredicate return a predicate the filter events based on their respective event type. This helper allows for the selection of multiple types resulting in a predicate that can filter in more then a single event type

func Filter

func Filter[T any](s []T, predicate func(*T) bool) []T

func Find

func Find[T any](list []T, f func(item *T) bool) *T

Find returns the first entry matching the function "f" or else return nil

func GetClusterResourceQuotaName

func GetClusterResourceQuotaName(name string) string

func GetMD5Hash

func GetMD5Hash(text string) string

func GetOperatorNamespace

func GetOperatorNamespace() string

GetOperatorNamespace returns the namespace where the operator is deployed.

func GetOperatorPodName

func GetOperatorPodName() (string, error)

func GetWatchNamespace

func GetWatchNamespace() string

func IsForbiddenError

func IsForbiddenError(err error) bool

func NamePredicate

func NamePredicate(name string) predicate.Predicate

Name Predicate return a predicate the filter events produced by resources that matches the given name

func RemoveAnnotation

func RemoveAnnotation(obj metav1.Object, key string) bool

func SetClusterInformation

func SetClusterInformation(
	ctx context.Context,
	kubeClient client.Client,
	status interfaces.StorageClientInfo,
) error

func ValidateOperatorNamespace

func ValidateOperatorNamespace() error

func ValidateStausReporterImage

func ValidateStausReporterImage() error

Types

This section is empty.

Jump to

Keyboard shortcuts

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