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
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.