Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 3.67 KB

README.md

File metadata and controls

67 lines (50 loc) · 3.67 KB

Component Integration

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.

Integrating a new component

To ensure a component is integrated seamlessly in the operator, follow the steps below:

Add Component to DataScienceCluster API spec

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 Component module

  • Add a new module, <newComponent>, under components/ directory to define code specific to the new component. Example can be found here
  • Define Path and ComponentName variables for the new component.

Implement common Interface

  • 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
    }

Add reconcile and Events

  • 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.

Reconcile Workflow

Component Reconcile Workflow.png

Add Unit and e2e tests

  • 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

Integrated Components