== Topic Controller
The *topic controller* runs inside kubernetes and continuously monitors the *topic* custom resource
definitions for changes. It reacts by creating new topics (with given characteristics such as number of partitions)
in the messaging broker.
== Development
=== Prerequisites
The following tools are required to build this project:
- `make`
- Docker
- https://github.com/Masterminds/glide#install[Glide] for dependency management
If you intend to re-generate mocks for testing, install:
- https://github.com/vektra/mockery#installation[Mockery]
If you would like to run tests using the `ginkgo` command, install:
- http://onsi.github.io/ginkgo/[Ginkgo]
=== Get the source
[source, bash]
----
go get github.com/projectriff/riff
cd $(go env GOPATH)/github.com/projectriff/riff/topic-controller
----
=== Building
* To build locally (this will produce a binary named `topic-controller` on _your_ machine):
+
[source, bash]
----
make build
----
* To build for docker (and deploy as part of the whole https://github.com/projectriff/riff#-manual-install-of-riff[riff]
installation):
+
[source, bash]
----
make dockerize
----
This assumes that your docker client is correctly configured to target the daemon where you want the image built.
* To run tests:
+
[source, bash]
----
make test
----
* To attach a https://github.com/derekparker/delve/blob/master/Documentation/EditorIntegration.md[delve capable] debugger (such as Goland)
to a `topic-controller` running _inside_ k8s:
+
[source, bash]
----
make debug-dockerize
----
Then expose the `2345` port as a service, using `riff/config/delve/topic-controller-debug.yaml`:
+
[source, bash]
----
kubectl apply -f config/debug-service.yaml
----
After restarting the `topic-controller-...` pod, you can connect the debugger through `localhost:30101` (or `$(minikube ip):30101`).