buildkit/examples/kube-consistent-hash
Akihiro Suda aa9c666e16 add example/kube-consistent-hash
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-04-23 19:35:29 +09:00
..
consistenthash add example/kube-consistent-hash 2019-04-23 19:35:29 +09:00
README.md add example/kube-consistent-hash 2019-04-23 19:35:29 +09:00
buildkitd-rootless-statefulset.yaml add example/kube-consistent-hash 2019-04-23 19:35:29 +09:00
show-running-pods.sh add example/kube-consistent-hash 2019-04-23 19:35:29 +09:00

README.md

Distributed Build with Consistent Hashing

Demo for efficiently using BuildKit daemon-local cache with multi-node cluster

Deploy

$ kubectl apply -f buildkitd-rootless-statefulset.yaml
$ kubectl scale --replicas=10 statefulset/buildkitd

Consistent hashing

Define the key string for consistent hashing.

For example, the key can be defined as <REPO NAME>:<CONTEXT PATH>, e.g. github.com/example/project:some/directory.

Then determine the pod that corresponds to the key:

$ go get ./consistenthash
$ pod=$(./show-running-pods.sh | consistenthash $key)

You can connect to the pod using export BUILDKIT_HOST=kube-pod://$pod.