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 IsManaged ¶
func IsManaged(ch ComponentHandler, dsc *dscv1.DataScienceCluster) bool
Types ¶
type ComponentHandler ¶
type ComponentHandler interface {
Init(platform common.Platform) error
// GetName and GetManagementState sound like pretty much the same across
// all components, but I could not find a way to avoid it
GetName() string
GetManagementState(dsc *dscv1.DataScienceCluster) operatorv1.ManagementState
// 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)
}
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.
Click to show internal directories.
Click to hide internal directories.