tmforum-oda / oda-canvas

Apache License 2.0
19 stars 50 forks source link

Documentation: Interactive development of operators using kopf #265

Closed LesterThomas closed 2 months ago

LesterThomas commented 2 months ago

Description

For the query raised by @adarshkumar4 about interactive development of operators using kopf: This issue is to improve the documentation to show how to achieve this.

The current documentation for this is just a 1 line description at the bottom of each README showing how to run the operator locally on the command line (eg. componentOperator):

Run locally in command-line: kopf run --namespace=components --standalone .\componentOperator.py

The --standalone attribute is used to run the operator in a standalone mode. This means that the operator will run independently, without relying on any external controllers or frameworks. It is particularly useful for development and debugging purposes, as it allows you to run and test your operator locally on your machine.

When you use the --standalone flag, Kopf will handle all the necessary Kubernetes API interactions directly, making it easier to see how your operator behaves in isolation. This can help you identify and fix issues more efficiently.

To run the operator on the command-line, you need to remove the operator running in Kubernetes. A simple way to do this is to set the replicas in the operator Deployment to 0.

You also need to install the required python libraries - these are the same as documented in the helm charts for each operator - e.g. in component-IstioController-dockerfile