# README
Custom Dataset controller
This controller should be deployed on each cluster. It is used to delete S3 object when a Kubernetes Dataset is being deleted.
Some resources regarding controllers
-
Writing custom Kubernetes controllers, it's a must read and there is a very good representation of how a custom controller works.
How it works
Illustration from Writing custom Kubernetes controllers
-
The controller creates an Informer and an Indexer to list, watch and index a Kubernetes object, for our controller it's all about datasets
-
When a new object is being deleted, it calls an event handler to delete the s3 object.
Running it locally
$ go run *.go -kubeconfig=</PATH/TO/YOUR/KUBECONFIG> -alsologtostderr -v 4
Building the docker image
$ CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o controller .
$ docker build -t nerdalize/custom-dataset-controller:<TAG> -f Dockerfile .
$ docker push nerdalize/custom-dataset-controller
Deploying the controller on Kubernetes
Update the docker image tag in the deployment file and then apply it using kubectl:
$ kubectl apply -f deployment.yml
The deployment is always done in the kube-system
namespace.
# Functions
NewController returns a new dataset controller.
# Structs
Controller is the controller implementation for Dataset resources Good to read to understand the different components: https://engineering.bitnami.com/articles/a-deep-dive-into-kubernetes-controllers.html.
S3AWS handler implements Handler interface.
# Interfaces
Handler is implemented by any handler.