Open salaboy opened 2 years ago
This is where all gets instantiated.. meaning this is what is going to be executed inside the docker container that ko
will generate: https://github.com/tektoncd/experimental/blob/main/cloudevents/cmd/controller/main.go#L27
As mentioned in #1 this is a Kubernetes controller that don't manage any new CRD, it just monitors existing CRDs, I think this is an important distinction to be made here.
Based on #1 Let's create a simple controller inside this project that watch Knative Services and emit a CloudEvent when a new Knative Service is created:
You can follow the following examples inside the tekton controller which creates a "Controller" and a "Reconciler"
https://github.com/tektoncd/experimental/blob/main/cloudevents/pkg/reconciler/pipelinerun/controller.go#L39
https://github.com/tektoncd/experimental/blob/main/cloudevents/pkg/reconciler/pipelinerun/reconciler.go#L75
The reconciler emits the event in the linked line.
The controller register the watches for the resources that we are interested.