registry

package
v2.34.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ch ComponentHandler)

func ForEach

func ForEach(f func(ch ComponentHandler) error) error

func IsComponentEnabled added in v2.32.0

func IsComponentEnabled(componentName string, dsc *dscv1.DataScienceCluster) bool

IsComponentEnabled checks if a component with the given name is enabled in the DataScienceCluster using the default registry. Returns false if the component is not found.

Types

type ComponentHandler

type ComponentHandler interface {
	Init(platform common.Platform) error
	GetName() string
	// NewCRObject constructs components specific Custom Resource
	// e.g. Dashboard in datasciencecluster.opendatahub.io group
	// It returns interface, but it simplifies DSC reconciler code a lot
	NewCRObject(dsc *dscv1.DataScienceCluster) common.PlatformObject
	NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error
	// UpdateDSCStatus updates the component specific status part of the DSC
	UpdateDSCStatus(ctx context.Context, rr *types.ReconciliationRequest) (metav1.ConditionStatus, error)
	// IsEnabled returns whether the component should be deployed/is active
	IsEnabled(dsc *dscv1.DataScienceCluster) bool
}

ComponentHandler is an interface to manage a component Every method should accept ctx since it contains the logger.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is a struct that maintains a list of registered ComponentHandlers.

func DefaultRegistry

func DefaultRegistry() *Registry

func (*Registry) Add

func (r *Registry) Add(ch ComponentHandler)

Add registers a new ComponentHandler to the registry. not thread safe, supposed to be called during init.

func (*Registry) ForEach

func (r *Registry) ForEach(f func(ch ComponentHandler) error) error

ForEach iterates over all registered ComponentHandlers and applies the given function. If any handler returns an error, that error is collected and returned at the end. With go1.23 probably https://go.dev/blog/range-functions can be used.

func (*Registry) IsComponentEnabled added in v2.32.0

func (r *Registry) IsComponentEnabled(componentName string, dsc *dscv1.DataScienceCluster) bool

IsComponentEnabled checks if a component with the given name is enabled in the DataScienceCluster. Returns false if the component is not found.

Jump to

Keyboard shortcuts

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