controllers

package
v0.0.0-...-c912cfc Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

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

	// EventReasonUninstallPending is used when the uninstall is Pending
	EventReasonUninstallPending = "UninstallPending"

	// EventReasonReconcileFailed is used when the reconcile is failed
	EventReasonReconcileFailed = "ReconcileFailed"

	// EventReasonCreationSucceeded is used when creation of object is succeeded
	EventReasonCreationSucceeded = "CreationSucceeded"
)
View Source
const (
	HasStorageSystemAnnotation = "storagesystem.odf.openshift.io/watched-by"
)
View Source
const (
	OdfSubscriptionPackage = "odf-operator"
)

Variables

View Source
var (
	DefaultValMap = map[string]string{
		"OPERATOR_NAMESPACE": "openshift-storage",

		"NOOBAA_SUBSCRIPTION_NAME":                    "noobaa-operator",
		"NOOBAA_SUBSCRIPTION_PACKAGE":                 "noobaa-operator",
		"NOOBAA_SUBSCRIPTION_CHANNEL":                 "alpha",
		"NOOBAA_SUBSCRIPTION_STARTINGCSV":             "noobaa-operator.v5.14.0",
		"NOOBAA_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"NOOBAA_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

		"OCS_SUBSCRIPTION_NAME":                    "ocs-operator",
		"OCS_SUBSCRIPTION_PACKAGE":                 "ocs-operator",
		"OCS_SUBSCRIPTION_CHANNEL":                 "alpha",
		"OCS_SUBSCRIPTION_STARTINGCSV":             "ocs-operator.v4.16.0",
		"OCS_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"OCS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

		"OCS_CLIENT_SUBSCRIPTION_NAME":                    "ocs-client-operator",
		"OCS_CLIENT_SUBSCRIPTION_PACKAGE":                 "ocs-client-operator",
		"OCS_CLIENT_SUBSCRIPTION_CHANNEL":                 "alpha",
		"OCS_CLIENT_SUBSCRIPTION_STARTINGCSV":             "ocs-client-operator.v4.16.0",
		"OCS_CLIENT_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"OCS_CLIENT_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

		"CSIADDONS_SUBSCRIPTION_NAME":                    "csi-addons",
		"CSIADDONS_SUBSCRIPTION_PACKAGE":                 "csi-addons",
		"CSIADDONS_SUBSCRIPTION_CHANNEL":                 "alpha",
		"CSIADDONS_SUBSCRIPTION_STARTINGCSV":             "csi-addons.v0.8.0",
		"CSIADDONS_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"CSIADDONS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

		"IBM_SUBSCRIPTION_NAME":                    "ibm-storage-odf-operator",
		"IBM_SUBSCRIPTION_PACKAGE":                 "ibm-storage-odf-operator",
		"IBM_SUBSCRIPTION_CHANNEL":                 "stable-v1.4",
		"IBM_SUBSCRIPTION_STARTINGCSV":             "ibm-storage-odf-operator.v1.4.1",
		"IBM_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

		"ROOK_SUBSCRIPTION_NAME":                    "rook-ceph-operator",
		"ROOK_SUBSCRIPTION_PACKAGE":                 "rook-ceph-operator",
		"ROOK_SUBSCRIPTION_CHANNEL":                 "alpha",
		"ROOK_SUBSCRIPTION_STARTINGCSV":             "rook-ceph-operator.v4.16.0",
		"ROOK_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

		"PROMETHEUS_SUBSCRIPTION_NAME":                    "odf-prometheus-operator",
		"PROMETHEUS_SUBSCRIPTION_PACKAGE":                 "odf-prometheus-operator",
		"PROMETHEUS_SUBSCRIPTION_CHANNEL":                 "beta",
		"PROMETHEUS_SUBSCRIPTION_STARTINGCSV":             "odf-prometheus-operator.v4.16.0",
		"PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE":           "odf-catalogsource",
		"PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",
	}

	OperatorNamespace = GetEnvOrDefault("OPERATOR_NAMESPACE")

	OcsSubscriptionName                   = GetEnvOrDefault("OCS_SUBSCRIPTION_NAME")
	OcsSubscriptionPackage                = GetEnvOrDefault("OCS_SUBSCRIPTION_PACKAGE")
	OcsSubscriptionChannel                = GetEnvOrDefault("OCS_SUBSCRIPTION_CHANNEL")
	OcsSubscriptionStartingCSV            = GetEnvOrDefault("OCS_SUBSCRIPTION_STARTINGCSV")
	OcsSubscriptionCatalogSource          = GetEnvOrDefault("OCS_SUBSCRIPTION_CATALOGSOURCE")
	OcsSubscriptionCatalogSourceNamespace = GetEnvOrDefault("OCS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

	OcsClientSubscriptionName                   = GetEnvOrDefault("OCS_CLIENT_SUBSCRIPTION_NAME")
	OcsClientSubscriptionPackage                = GetEnvOrDefault("OCS_CLIENT_SUBSCRIPTION_PACKAGE")
	OcsClientSubscriptionChannel                = GetEnvOrDefault("OCS_CLIENT_SUBSCRIPTION_CHANNEL")
	OcsClientSubscriptionStartingCSV            = GetEnvOrDefault("OCS_CLIENT_SUBSCRIPTION_STARTINGCSV")
	OcsClientSubscriptionCatalogSource          = GetEnvOrDefault("OCS_CLIENT_SUBSCRIPTION_CATALOGSOURCE")
	OcsClientSubscriptionCatalogSourceNamespace = GetEnvOrDefault("OCS_CLIENT_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

	NoobaaSubscriptionName                   = GetEnvOrDefault("NOOBAA_SUBSCRIPTION_NAME")
	NoobaaSubscriptionPackage                = GetEnvOrDefault("NOOBAA_SUBSCRIPTION_PACKAGE")
	NoobaaSubscriptionChannel                = GetEnvOrDefault("NOOBAA_SUBSCRIPTION_CHANNEL")
	NoobaaSubscriptionStartingCSV            = GetEnvOrDefault("NOOBAA_SUBSCRIPTION_STARTINGCSV")
	NoobaaSubscriptionCatalogSource          = GetEnvOrDefault("NOOBAA_SUBSCRIPTION_CATALOGSOURCE")
	NoobaaSubscriptionCatalogSourceNamespace = GetEnvOrDefault("NOOBAA_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

	CSIAddonsSubscriptionName                   = GetEnvOrDefault("CSIADDONS_SUBSCRIPTION_NAME")
	CSIAddonsSubscriptionPackage                = GetEnvOrDefault("CSIADDONS_SUBSCRIPTION_PACKAGE")
	CSIAddonsSubscriptionChannel                = GetEnvOrDefault("CSIADDONS_SUBSCRIPTION_CHANNEL")
	CSIAddonsSubscriptionStartingCSV            = GetEnvOrDefault("CSIADDONS_SUBSCRIPTION_STARTINGCSV")
	CSIAddonsSubscriptionCatalogSource          = GetEnvOrDefault("CSIADDONS_SUBSCRIPTION_CATALOGSOURCE")
	CSIAddonsSubscriptionCatalogSourceNamespace = GetEnvOrDefault("CSIADDONS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

	IbmSubscriptionName                   = GetEnvOrDefault("IBM_SUBSCRIPTION_NAME")
	IbmSubscriptionPackage                = GetEnvOrDefault("IBM_SUBSCRIPTION_PACKAGE")
	IbmSubscriptionChannel                = GetEnvOrDefault("IBM_SUBSCRIPTION_CHANNEL")
	IbmSubscriptionStartingCSV            = GetEnvOrDefault("IBM_SUBSCRIPTION_STARTINGCSV")
	IbmSubscriptionCatalogSource          = GetEnvOrDefault("IBM_SUBSCRIPTION_CATALOGSOURCE")
	IbmSubscriptionCatalogSourceNamespace = GetEnvOrDefault("IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

	RookSubscriptionName                   = GetEnvOrDefault("ROOK_SUBSCRIPTION_NAME")
	RookSubscriptionPackage                = GetEnvOrDefault("ROOK_SUBSCRIPTION_PACKAGE")
	RookSubscriptionChannel                = GetEnvOrDefault("ROOK_SUBSCRIPTION_CHANNEL")
	RookSubscriptionStartingCSV            = GetEnvOrDefault("ROOK_SUBSCRIPTION_STARTINGCSV")
	RookSubscriptionCatalogSource          = GetEnvOrDefault("ROOK_SUBSCRIPTION_CATALOGSOURCE")
	RookSubscriptionCatalogSourceNamespace = GetEnvOrDefault("ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

	PrometheusSubscriptionName                   = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_NAME")
	PrometheusSubscriptionPackage                = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_PACKAGE")
	PrometheusSubscriptionChannel                = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_CHANNEL")
	PrometheusSubscriptionStartingCSV            = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_STARTINGCSV")
	PrometheusSubscriptionCatalogSource          = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE")
	PrometheusSubscriptionCatalogSourceNamespace = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")
)
View Source
var AllQuickStarts = [][]byte{[]byte(gettingStartedQS), []byte(odfConfigAndManagementQS)}
View Source
var StorageClusterKind = odfv1alpha1.StorageKind(strings.ToLower(reflect.TypeOf(ocsv1.StorageCluster{}).Name()) +
	"." + ocsv1.GroupVersion.String())

Functions

func ApproveInstallPlanForCsv

func ApproveInstallPlanForCsv(cli client.Client, csvName string) error

ApproveInstallPlanForCsv approve the manual approval installPlan for the given CSV and returns an error if none found

func CheckExistingSubscriptions

func CheckExistingSubscriptions(cli client.Client, desiredSubscription *operatorv1alpha1.Subscription) (*operatorv1alpha1.Subscription, error)

CheckForExistingSubscription looks for any existing Subscriptions that reference the given package. If one does exist, use its ObjectMeta for the desiredSubscription.

NOTE(jarrpa): We can't use client.MatchingFields to limit the list results because fake.Client does not support them.

func EnsureDesiredSubscription

func EnsureDesiredSubscription(cli client.Client, desiredSubscription *operatorv1alpha1.Subscription) error

func EnsureVendorCsv

func EnsureVendorCsv(cli client.Client, csvName string) (*operatorv1alpha1.ClusterServiceVersion, error)

func GetEnvOrDefault

func GetEnvOrDefault(env string) string

func GetFakeFlashSystemCluster

func GetFakeFlashSystemCluster() *ibmv1alpha1.FlashSystemCluster

func GetFakeStorageCluster

func GetFakeStorageCluster() *ocsv1.StorageCluster

func GetFlashSystemClusterSubscriptions

func GetFlashSystemClusterSubscriptions() []*operatorv1alpha1.Subscription

GetFlashSystemClusterSubscription return subscription for FlashSystemCluster

func GetOdfSubscription

func GetOdfSubscription(cli client.Client) (*operatorv1alpha1.Subscription, error)

GetOdfSubscription returns the subscription for odf-operator.

func GetStorageClusterSubscriptions

func GetStorageClusterSubscriptions() []*operatorv1alpha1.Subscription

GetStorageClusterSubscription return subscription for StorageCluster

func GetSubscriptions

GetSubscriptions returns all required Subscriptions for the given StorageKind

func GetVendorCsvNames

func GetVendorCsvNames(cli client.Client, kind odfv1alpha1.StorageKind) ([]string, error)

func SetAvailableCondition

func SetAvailableCondition(conditions *[]conditionsv1.Condition,
	status corev1.ConditionStatus, reason string, message string)

func SetDeletionInProgressConditions

func SetDeletionInProgressConditions(conditions *[]conditionsv1.Condition,
	reason string, message string)

func SetOdfSubControllerReference

func SetOdfSubControllerReference(cli client.Client, obj client.Object) error

func SetProgressingCondition

func SetProgressingCondition(conditions *[]conditionsv1.Condition,
	status corev1.ConditionStatus, reason string, message string)

func SetReconcileCompleteConditions

func SetReconcileCompleteConditions(conditions *[]conditionsv1.Condition,
	reason string, message string)

func SetReconcileInitConditions

func SetReconcileInitConditions(conditions *[]conditionsv1.Condition,
	reason string, message string)

func SetReconcileStartConditions

func SetReconcileStartConditions(conditions *[]conditionsv1.Condition,
	reason string, message string)

func SetStorageSystemInvalidCondition

func SetStorageSystemInvalidCondition(conditions *[]conditionsv1.Condition,
	status corev1.ConditionStatus, reason string, message string)

func SetStorageSystemInvalidConditions

func SetStorageSystemInvalidConditions(conditions *[]conditionsv1.Condition,
	reason string, message string)

func SetVendorCsvReadyCondition

func SetVendorCsvReadyCondition(conditions *[]conditionsv1.Condition,
	status corev1.ConditionStatus, reason string, message string)

func SetVendorSystemPresentCondition

func SetVendorSystemPresentCondition(conditions *[]conditionsv1.Condition,
	status corev1.ConditionStatus, reason string, message string)

func VendorFlashSystemCluster

func VendorFlashSystemCluster() odfv1alpha1.StorageKind

VendorFlashSystemCluster returns GroupVersionKind

func VendorStorageCluster

func VendorStorageCluster() odfv1alpha1.StorageKind

VendorStorageCluster returns GroupVersionKind

Types

type ClusterVersionReconciler

type ClusterVersionReconciler struct {
	client.Client
	Scheme      *runtime.Scheme
	ConsolePort int
}

ClusterVersionReconciler reconciles a ClusterVersion object

func (*ClusterVersionReconciler) Reconcile

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*ClusterVersionReconciler) SetupWithManager

func (r *ClusterVersionReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

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 StorageClusterReconciler

type StorageClusterReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder *EventReporter
}

StorageClusterReconciler reconciles a StorageCluster object

func GetFakeStorageClusterReconciler

func GetFakeStorageClusterReconciler(t *testing.T, objs ...runtime.Object) *StorageClusterReconciler

func (*StorageClusterReconciler) Reconcile

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*StorageClusterReconciler) SetupWithManager

func (r *StorageClusterReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type StorageSystemReconciler

type StorageSystemReconciler struct {
	client.Client
	Log      logr.Logger
	Scheme   *runtime.Scheme
	Recorder *EventReporter
}

StorageSystemReconciler reconciles a StorageSystem object

func GetFakeStorageSystemReconciler

func GetFakeStorageSystemReconciler(t *testing.T, objs ...runtime.Object) *StorageSystemReconciler

func (*StorageSystemReconciler) Reconcile

func (r *StorageSystemReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*StorageSystemReconciler) SetupWithManager

func (r *StorageSystemReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SubscriptionReconciler

type SubscriptionReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	Recorder          *EventReporter
	ConditionName     string
	OperatorCondition conditions.Condition
}

SubscriptionReconciler reconciles a Subscription object

func (*SubscriptionReconciler) Reconcile

func (r *SubscriptionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*SubscriptionReconciler) SetupWithManager

func (r *SubscriptionReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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