controllers

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterExtensionCleanupUnpackCacheFinalizer         = "olm.operatorframework.io/cleanup-unpack-cache"
	ClusterExtensionCleanupContentManagerCacheFinalizer = "olm.operatorframework.io/cleanup-contentmanager-cache"
)

Variables

This section is empty.

Functions

func CheckCatalogsExist added in v1.8.0

func CheckCatalogsExist(ctx context.Context, c client.Client, ext *ocv1.ClusterExtension) (bool, error)

CheckCatalogsExist checks if any ClusterCatalogs matching the extension's selector exist. Returns true if at least one matching ClusterCatalog exists, false if none exist. Treats "CRD doesn't exist" errors as "no ClusterCatalogs exist" (returns false, nil). Returns an error only if the check itself fails unexpectedly.

func SetDeprecationStatus

func SetDeprecationStatus(ext *ocv1.ClusterExtension, installedBundleName string, deprecation *declcfg.Deprecation, hasCatalogData bool)

SetDeprecationStatus updates deprecation conditions based on catalog metadata.

Behavior (following Kubernetes API conventions - conditions always present):

  • IS deprecated -> condition True with Reason: Deprecated
  • NOT deprecated -> condition False with Reason: NotDeprecated
  • Can't check (no catalog) -> condition Unknown with Reason: DeprecationStatusUnknown
  • No bundle installed -> BundleDeprecated Unknown with Reason: Absent

This keeps deprecation conditions focused on catalog data. Install/validation errors never appear here - they belong in Progressing/Installed conditions.

func SetStatusCondition added in v1.5.1

func SetStatusCondition(conditions *[]metav1.Condition, condition metav1.Condition)

SetStatusCondition wraps apimeta.SetStatusCondition and ensures the message is always truncated This should be used throughout the codebase instead of apimeta.SetStatusCondition directly

Types

type Applier

type Applier interface {
	// Apply applies the content in the provided fs.FS using the configuration of the provided ClusterExtension.
	// It also takes in a map[string]string to be applied to all applied resources as labels and another
	// map[string]string used to create a unique identifier for a stored reference to the resources created.
	Apply(context.Context, fs.FS, *ocv1.ClusterExtension, map[string]string, map[string]string) (bool, string, error)
}

type BoxcutterRevisionStatesGetter added in v1.6.0

type BoxcutterRevisionStatesGetter struct {
	Reader client.Reader
}

func (*BoxcutterRevisionStatesGetter) GetRevisionStates added in v1.6.0

type CatalogCache

type CatalogCache interface {
	Get(catalogName, resolvedRef string) (fs.FS, error)
	Remove(catalogName string) error
}

type CatalogCachePopulator

type CatalogCachePopulator interface {
	PopulateCache(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error)
}

type ClusterCatalogReconciler

type ClusterCatalogReconciler struct {
	client.Client
	CatalogCache          CatalogCache
	CatalogCachePopulator CatalogCachePopulator
}

ClusterCatalogReconciler reconciles a ClusterCatalog object

func (*ClusterCatalogReconciler) Reconcile

func (*ClusterCatalogReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ClusterExtensionReconciler

type ClusterExtensionReconciler struct {
	client.Client
	ReconcileSteps ReconcileSteps
}

ClusterExtensionReconciler reconciles a ClusterExtension object

func (*ClusterExtensionReconciler) Reconcile

The operator controller needs to watch all the bundle objects and reconcile accordingly. Though not ideal, but these permissions are required. This has been taken from rukpak, and an issue was created before to discuss it: https://github.com/operator-framework/rukpak/issues/800.

func (*ClusterExtensionReconciler) SetupWithManager

SetupWithManager sets up the controller with the Manager.

type ClusterExtensionRevisionReconciler added in v1.6.0

type ClusterExtensionRevisionReconciler struct {
	Client                client.Client
	RevisionEngineFactory RevisionEngineFactory
	TrackingCache         trackingCache
	// contains filtered or unexported fields
}

ClusterExtensionRevisionReconciler actions individual snapshots of ClusterExtensions, as part of the boxcutter integration.

func (*ClusterExtensionRevisionReconciler) Reconcile added in v1.6.0

func (*ClusterExtensionRevisionReconciler) SetupWithManager added in v1.6.0

func (c *ClusterExtensionRevisionReconciler) SetupWithManager(mgr ctrl.Manager) error

type ControllerBuilderOption added in v1.6.0

type ControllerBuilderOption func(builder *ctrl.Builder)

func WithOwns added in v1.6.0

type HelmRevisionStatesGetter added in v1.6.0

type HelmRevisionStatesGetter struct {
	helmclient.ActionClientGetter
}

func (*HelmRevisionStatesGetter) GetRevisionStates added in v1.6.0

type ReconcileStepFunc added in v1.7.0

type ReconcileStepFunc func(context.Context, *reconcileState, *ocv1.ClusterExtension) (*ctrl.Result, error)

ReconcileStepFunc represents a single step in the ClusterExtension reconciliation process. It takes a context, state and ClusterExtension object as input and returns: - Any error that occurred during reconciliation, which will be returned to the caller - A ctrl.Result that indicates whether reconciliation should complete immediately or be retried later

func ApplyBundle added in v1.7.0

func ApplyBundle(a Applier) ReconcileStepFunc

func ApplyBundleWithBoxcutter added in v1.8.0

func ApplyBundleWithBoxcutter(apply func(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (bool, string, error)) ReconcileStepFunc

func HandleFinalizers added in v1.7.0

func HandleFinalizers(f finalizer.Finalizer) ReconcileStepFunc

func MigrateStorage added in v1.7.0

func MigrateStorage(m StorageMigrator) ReconcileStepFunc

func ResolveBundle added in v1.7.0

func ResolveBundle(r resolve.Resolver, c client.Client) ReconcileStepFunc

ResolveBundle resolves the bundle to install or roll out for a ClusterExtension. It requires a controller-runtime client (in addition to the resolve.Resolver) to enable intelligent error handling when resolution fails. The client is used to check if ClusterCatalogs matching the extension's selector still exist in the cluster, allowing the controller to distinguish between "ClusterCatalog deleted" (fall back to installed bundle) and "transient failure" (retry resolution). This ensures workload resilience during ClusterCatalog outages while maintaining responsiveness during ClusterCatalog updates.

func RetrieveRevisionStates added in v1.7.0

func RetrieveRevisionStates(r RevisionStatesGetter) ReconcileStepFunc

func UnpackBundle added in v1.7.0

func UnpackBundle(i imageutil.Puller, cache imageutil.Cache) ReconcileStepFunc

type ReconcileSteps added in v1.7.0

type ReconcileSteps []ReconcileStepFunc

ReconcileSteps is an ordered collection of reconciliation steps that are executed sequentially. Each step receives the shared state from previous steps, allowing data to flow through the pipeline.

func (*ReconcileSteps) Reconcile added in v1.7.0

func (steps *ReconcileSteps) Reconcile(ctx context.Context, ext *ocv1.ClusterExtension) (ctrl.Result, error)

Reconcile executes a series of reconciliation steps in sequence for a ClusterExtension. It takes a context and ClusterExtension object as input and executes each step in the ReconcileSteps slice. If any step returns an error, reconciliation stops and the error is returned. If any step returns a non-nil ctrl.Result, reconciliation stops, and that result is returned. If all steps complete successfully, returns an empty ctrl.Result and nil error.

type RevisionEngine added in v1.6.0

RevisionEngine defines the interface for reconciling and tearing down revisions.

type RevisionEngineFactory added in v1.8.0

type RevisionEngineFactory interface {
	CreateRevisionEngine(ctx context.Context, rev *ocv1.ClusterExtensionRevision) (RevisionEngine, error)
}

RevisionEngineFactory creates a RevisionEngine for a ClusterExtensionRevision.

func NewDefaultRevisionEngineFactory added in v1.8.0

func NewDefaultRevisionEngineFactory(
	scheme *runtime.Scheme,
	trackingCache managedcache.TrackingCache,
	discoveryClient discovery.CachedDiscoveryInterface,
	restMapper meta.RESTMapper,
	fieldOwnerPrefix string,
	baseConfig *rest.Config,
	tokenGetter *authentication.TokenGetter,
) (RevisionEngineFactory, error)

NewDefaultRevisionEngineFactory creates a new defaultRevisionEngineFactory.

type RevisionMetadata added in v1.6.0

type RevisionMetadata struct {
	RevisionName string
	Package      string
	Image        string
	ocv1.BundleMetadata
	Conditions []metav1.Condition
}

type RevisionStates added in v1.6.0

type RevisionStates struct {
	Installed  *RevisionMetadata
	RollingOut []*RevisionMetadata
}

type RevisionStatesGetter added in v1.6.0

type RevisionStatesGetter interface {
	GetRevisionStates(ctx context.Context, ext *ocv1.ClusterExtension) (*RevisionStates, error)
}

type Sourcerer added in v1.6.0

type Sourcerer interface {
	Source(handler handler.EventHandler, predicates ...predicate.Predicate) source.Source
}

type StorageMigrator added in v1.6.0

type StorageMigrator interface {
	Migrate(context.Context, *ocv1.ClusterExtension, map[string]string) error
}

Jump to

Keyboard shortcuts

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