component-codegen
is a CLI tool built using the Cobra library to scaffold boilerplate code for new components.
It simplifies the onboarding process by generating necessary files and updating relevant configurations.
A new component can be scaffolded by using a simple make command
make new-component COMPONENT=<component_name>
Running the above command will generate the following files and update relevant configurations:
-
Component Type Definition Creates a
component_types.go
file for the component inapi/components/v1alpha1
. -
Controller Files A folder named after the component inside
internal/controller/components
containing:- component_controller_actions.go
- component_controller.go
- component_support.go
- component.go
-
API Updates Adds an entry of the component in
api/datasciencecluster/v1/datasciencecluster_types.go
within the spec section. -
RBAC Configuration Updates the file
internal/controller/datasciencecluster/kubebuilder_rbac.go
with necessary Kubebuilder RBAC markers. -
Autogenerated Files Update Runs all necessary commands to update autogenerated files.
After running the command, users only need to add specific logic as per their component's requirements to complete onboarding.