This repo contains demo for KubeCon 2021 talk Real-Time Data Anonymization the Serverless Way - Yuval Lifshitz & Huamin Chen, Red Hat
Install microshift.
Note that Ceph needs at least one extra disk to run, and since microshift runs directly on the host, and extra physical disk is needed (e.g. attach a USB drive). If this is not possible, we would recommend running microshift inside a VM, and attach an extra virtual disk to the VM.
sh scripts/microshift-default-storageclass.shsince bucket notification support is still work-in-progress, replace image in:
operator.yamlwith:quay.io/ylifshit/rook-cephin order to workaround an issue with rabbitmq, replace the ceph image in:cluster-test.yamlwithquay.io/ceph-ci/ceph:wip-yuval-fix-50611
sh scripts/install-rook.shsh scripts/s3-bucket.shto workaround the rabbitmq issue, change the following conf parameter in the RGW:
kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- ceph config set client.rgw.my.store.a rgw_allow_secrets_in_cleartext true
kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- ceph config set client.rgw.my.store.a debug_rgw 10source scripts/s3-env.shinstall the rabbitmq operator
sh scripts/install-rabbitmq.shCreate exchange,queue, and routing key using the RGW bucket notification topic name
sh scripts/rabbitmq-declare-queue.shsh scripts/create-s3-bucket-notification.shEnsure helm v3 is installed locally, then
sh scripts/install-keda.sh
kubectl apply -f keda/anonymize-function.yamlsh scripts/create-k8s-secret.shNow apply the generated secrets file secrets.yaml
kubectl apply -f secrets.yamlMake sure that the awscli tool is installed locally.
RGW_MY_STORE=$(kubectl get service -n rook-ceph rook-ceph-rgw-my-store -o jsonpath='{.spec.clusterIP}')
while true; do file=$(date +%Y-%m-%d-%H-%M-%S)".jpg"; aws --endpoint-url http://$RGW_MY_STORE:80 s3 cp test/image.jpg s3://notification-demo-bucket/$file;sleep 3;donekubectl logs -n keda -l app=keda-operator -fThe logs will show Serverless functions scaling up and down.
kubectl logs -l app=rabbitmq-consumer -fA sample output is as the following:
# kubectl logs -l app=rabbitmq-consumer -f
downloading notification-demo-bucket/2021-10-12-17-21-31.jpg to /tmp/tmp0geekb_2-2021-10-12-17-21-31.jpg
blurring face
blurring license plate
uploading /tmp/tmp0geekb_2-2021-10-12-17-21-31.jpg to notification-demo-bucket/2021-10-12-17-21-31.jpg
object notification-demo-bucket/2021-10-12-17-21-31.jpg already processed
downloading notification-demo-bucket/2021-10-12-17-21-35.jpg to /tmp/tmpxczuj32m-2021-10-12-17-21-35.jpg
blurring face
blurring license plate