From 8d7871aa30c3a701f7db742274247983025d346b Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Mon, 29 Nov 2021 14:20:42 -0800 Subject: [PATCH 1/2] store chart and json files in AWS --- .github/workflows/time-to-k8s-public-chart.yml | 10 ++++------ .../time-to-k8s/public-chart/generate-chart.go | 7 ++++++- .../time-to-k8s/public-chart/public-chart.sh | 13 +++++++++---- .../en/docs/benchmarks/timeToK8s/daily_benchmark.md | 4 ++-- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/time-to-k8s-public-chart.yml b/.github/workflows/time-to-k8s-public-chart.yml index 90715472eb..903eda285c 100644 --- a/.github/workflows/time-to-k8s-public-chart.yml +++ b/.github/workflows/time-to-k8s-public-chart.yml @@ -11,18 +11,16 @@ jobs: time-to-k8s-public-chart: if: github.repository == 'kubernetes/minikube' runs-on: ubuntu-20.04 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: 'us-west-1' steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: go-version: ${{env.GO_VERSION}} stable: true - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@master - with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_TIME_TO_K8S_SA_KEY }} - export_default_credentials: true - name: Benchmark time-to-k8s for Docker run: | ./hack/benchmark/time-to-k8s/public-chart/public-chart.sh docker diff --git a/hack/benchmark/time-to-k8s/public-chart/generate-chart.go b/hack/benchmark/time-to-k8s/public-chart/generate-chart.go index 52fa557993..2b4dfedf4b 100644 --- a/hack/benchmark/time-to-k8s/public-chart/generate-chart.go +++ b/hack/benchmark/time-to-k8s/public-chart/generate-chart.go @@ -161,6 +161,8 @@ func createChart(benchmarks []benchmark, chartOutputPath string) { *xy = make(plotter.XYs, n) } + maxTotal := 0 + for i, b := range benchmarks { date := float64(b.Date.Unix()) xyValues := []struct { @@ -181,6 +183,9 @@ func createChart(benchmarks []benchmark, chartOutputPath string) { xy.Y = xyValue.value xy.X = date } + if b.Total > maxTotal { + maxTotal = b.Total + } } p := plot.New() @@ -190,7 +195,7 @@ func createChart(benchmarks []benchmark, chartOutputPath string) { p.X.Label.Text = "date" p.X.Tick.Marker = plot.TimeTicks{Format: "2006-01-02"} p.Y.Label.Text = "time (seconds)" - p.Y.Max = 95 + p.Y.Max = maxTotal + 15 steps := []struct { xys plotter.XYs diff --git a/hack/benchmark/time-to-k8s/public-chart/public-chart.sh b/hack/benchmark/time-to-k8s/public-chart/public-chart.sh index 5bffd172c0..311e6ebd32 100755 --- a/hack/benchmark/time-to-k8s/public-chart/public-chart.sh +++ b/hack/benchmark/time-to-k8s/public-chart/public-chart.sh @@ -18,6 +18,7 @@ set -e # container-runtime (docker or containerd) RUNTIME="$1" +BUCKET="s3://time-to-k8s" install_minikube() { make @@ -34,21 +35,25 @@ generate_chart() { go run ./hack/benchmark/time-to-k8s/public-chart/generate-chart.go --csv ./hack/benchmark/time-to-k8s/time-to-k8s-repo/output.csv --output ./chart.png --past-runs ./runs.json } +copy() { + aws s3 cp "$1" "$2" +} + cleanup() { rm ./runs.json rm ./hack/benchmark/time-to-k8s/time-to-k8s-repo/output.csv rm ./chart.png } -gsutil -m cp "gs://minikube-time-to-k8s/$RUNTIME-runs.json" ./runs.json +copy "$BUCKET/$RUNTIME-runs.json" ./runs.json install_minikube run_benchmark generate_chart -gsutil -m cp ./runs.json "gs://minikube-time-to-k8s/$RUNTIME-runs.json" -gsutil -m cp ./runs.json "gs://minikube-time-to-k8s/$(date +'%Y-%m-%d')-$RUNTIME.json" -gsutil -m cp ./chart.png "gs://minikube-time-to-k8s/$RUNTIME-chart.png" +copy ./runs.json "$BUCKET/$RUNTIME-runs.json" +copy ./runs.json "$BUCKET/$(date +'%Y-%m-%d')-$RUNTIME.json" +copy ./chart.png "$BUCKET/$RUNTIME-chart.png" cleanup diff --git a/site/content/en/docs/benchmarks/timeToK8s/daily_benchmark.md b/site/content/en/docs/benchmarks/timeToK8s/daily_benchmark.md index c65295ee01..950c1d250d 100644 --- a/site/content/en/docs/benchmarks/timeToK8s/daily_benchmark.md +++ b/site/content/en/docs/benchmarks/timeToK8s/daily_benchmark.md @@ -9,8 +9,8 @@ weight: -99999999 ## Docker -![Docker Benchmarks](https://storage.googleapis.com/minikube-time-to-k8s/docker-chart.png) +![Docker Benchmarks](https://time-to-k8s.s3.us-west-1.amazonaws.com/docker-chart.png) ## Containerd -![Containerd Benchmarks](https://storage.googleapis.com/minikube-time-to-k8s/containerd-chart.png) +![Containerd Benchmarks](https://time-to-k8s.s3.us-west-1.amazonaws.com/containerd-chart.png) From 1ddb0bd09c18827f91d804e237cb254c51d190f0 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Mon, 29 Nov 2021 14:34:00 -0800 Subject: [PATCH 2/2] fix initing as int instead of float64 --- hack/benchmark/time-to-k8s/public-chart/generate-chart.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/benchmark/time-to-k8s/public-chart/generate-chart.go b/hack/benchmark/time-to-k8s/public-chart/generate-chart.go index 2b4dfedf4b..2b1ec6cf81 100644 --- a/hack/benchmark/time-to-k8s/public-chart/generate-chart.go +++ b/hack/benchmark/time-to-k8s/public-chart/generate-chart.go @@ -161,7 +161,7 @@ func createChart(benchmarks []benchmark, chartOutputPath string) { *xy = make(plotter.XYs, n) } - maxTotal := 0 + var maxTotal float64 for i, b := range benchmarks { date := float64(b.Date.Unix())