2021-05-26 22:45:11 +00:00
#!/bin/bash
# Copyright 2021 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
install_kind( ) {
2021-06-28 22:25:58 +00:00
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/latest/download/kind-linux-amd64
2021-05-26 22:45:11 +00:00
chmod +x ./kind
2021-06-28 22:25:58 +00:00
sudo mv ./kind /usr/local/bin/kind
2021-05-26 22:45:11 +00:00
}
install_k3d( ) {
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
}
install_minikube( ) {
make
sudo install ./out/minikube /usr/local/bin/minikube
}
run_benchmark( ) {
2021-06-15 17:17:46 +00:00
( cd ./hack/benchmark/time-to-k8s/time-to-k8s-repo/ &&
2021-05-26 22:45:11 +00:00
git submodule update --init &&
2021-06-28 22:25:58 +00:00
go run . --config local-kubernetes.yaml --iterations 10 --output output.csv )
2021-05-26 22:45:11 +00:00
}
2022-02-22 07:16:09 +00:00
# create page and generate chart inside the code
2021-05-26 22:45:11 +00:00
create_page( ) {
2022-02-22 07:16:09 +00:00
go run ./hack/benchmark/time-to-k8s/*.go --csv ./hack/benchmark/time-to-k8s/time-to-k8s-repo/output.csv --image ./site/static/images/benchmarks/timeToK8s/" $1 " --page ./site/content/en/docs/benchmarks/timeToK8s/" $1 " .md
2021-05-26 22:45:11 +00:00
}
2021-07-08 21:01:09 +00:00
cleanup( ) {
rm ./hack/benchmark/time-to-k8s/time-to-k8s-repo/output.csv
}
2021-05-26 22:45:11 +00:00
install_kind
install_k3d
install_minikube
2021-06-15 17:17:46 +00:00
VERSION = $( minikube version --short)
2021-05-26 22:45:11 +00:00
run_benchmark
create_page " $VERSION "
2021-07-08 21:01:09 +00:00
cleanup