kubeshop / kusk-gateway

Kusk-gateway is an OpenAPI-driven API Gateway for Kubernetes
https://kubeshop.github.io/kusk-gateway/
MIT License
253 stars 21 forks source link

`make create-env`: Use `minikube image load` #854

Closed mbana closed 1 year ago

mbana commented 1 year ago

Instead of building the image in the minikube docker environment, build it on the host. I.e., remove eval $$(minikube docker-env --profile kgw); docker build in favour of:

$ docker build ...
$ minikube image --profile kgw load kubeshop/kusk-gateway:$(git describe --tags $(git rev-list --tags --max-count=1))

This should result in faster builds if you delete the minikube cluster and re-create as the kubeshop/kusk-gateway:$(git describe --tags $(git rev-list --tags --max-count=1)) images are not being built in the minikube docker daemon so its layers are cached.

Results

I benchmarked the changes:

Old:

$ hyperfine --runs 3 'minikube delete --profile kgw && time make create-env'
Benchmark 1: minikube delete --profile kgw && time make create-env
  Time (mean ± σ):     97.866 s ±  2.965 s    [User: 32.466 s, System: 7.927 s]
  Range (min … max):   94.516 s … 100.156 s    3 runs

New:

$ hyperfine --runs 3 'minikube delete --profile kgw && time make create-env'
Benchmark 1: minikube delete --profile kgw && time make create-env
  Time (mean ± σ):     65.146 s ±  0.983 s    [User: 30.162 s, System: 6.345 s]
  Range (min … max):   64.340 s … 66.241 s    3 runs

Signed-off-by: Mohamed Bana mohamed@bana.io


Could you please try out this branch to ensure it works in whatever setup you use.

netlify[bot] commented 1 year ago

Deploy Preview for kusk-docs-preview canceled.

Name Link
Latest commit a35755e410dc6af0ade7544466e2b5e4409e139c
Latest deploy log https://app.netlify.com/sites/kusk-docs-preview/deploys/6343fbb19d05f500088ba68b