The components
dir of the codebase is hosts all the component specific logic of the operator. Since, ODH operator is an
integration point to deploy ODH component manifests it is essential to have common processes to integrate new components.
To ensure a component is integrated seamlessly in the operator, follow the steps below:
DataScienceCluster CRD is responsible for defining the component fields and exposing them to end users. Add your component to it's api spec:
type Components struct {
NewComponent newcomponent.newComponentName `json:"newcomponent,omitempty"`
}
- Add a new module,
<newComponent>
, undercomponents/
directory to define code specific to the new component. Example can be found here - Define
Path
andComponentName
variables for the new component.
-
Define struct that includes a shared struct
Component
with common fields. -
Implement interface methods according to your component
type ComponentInterface interface { ReconcileComponent(ctx context.Context, cli client.Client, logger logr.Logger, owner metav1.Object, DSCISpec *dsciv1.DSCInitializationSpec, currentComponentStatus bool) error Cleanup(cli client.Client, DSCISpec *dsciv1.DSCInitializationSpec) error GetComponentName() string GetManagementState() operatorv1.ManagementState OverrideManifests(platform cluster.Platform) error UpdatePrometheusConfig(cli client.Client, enable bool, component string) error ConfigComponentLogger(logger logr.Logger, component string, dscispec *dsciv1.DSCInitializationSpec) logr.Logger }
- Once you set up the new component module, add the component to Reconcile function in order to deploy manifests.
- This will also enable/add status updates of the component in the operator.
- Components should add
unit
tests for any component specific functions added to the codebase - Components should update e2e tests to capture deployments introduced by the new component