Skip to content

Commit

Permalink
Implement base of continuous benchmark tool (#1776)
Browse files Browse the repository at this point in the history
* Create Continuous Bench Search Job tool (#1733)

* ✨ create bench job search tools

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ✨ add load hdf5 functions

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ fix format

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ fix docker and use hdf5 data

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ fix

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ refactor benchmark job

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ fix

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ fix proto

Signed-off-by: vankichi <kyukawa315@gmail.com>

* 💚 add benchmark job image build ci

Signed-off-by: vankichi <kyukawa315@gmail.com>

* 💚 invest

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Revert "💚 invest"

This reverts commit f0f585c.

* Apply suggestions from code review

Co-authored-by: Yusuke Kato <kpango@vdaas.org>

* ♻️ apply code review

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Apply suggestions from code review

Co-authored-by: Hiroto Funakoshi <hiroto.funakoshi.hiroto@gmail.com>

* ✨ apply from feedback

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Update internal/config/benchmark.go

Co-authored-by: Yusuke Kato <kpango@vdaas.org>

* ♻️ change directory path

Signed-off-by: vankichi <kyukawa315@gmail.com>

Signed-off-by: vankichi <kyukawa315@gmail.com>
Co-authored-by: Yusuke Kato <kpango@vdaas.org>
Co-authored-by: Hiroto Funakoshi <hiroto.funakoshi.hiroto@gmail.com>

* Add crds for continuous benchmark tools (#1789)

* ✨ add crds for continuous benchmark operator

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ✨ add benchmark operator/job scheme

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ✨ rename package names and add doc.go

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ✨ create runtime object

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Apply suggestions from code review

Co-authored-by: Yusuke Kato <kpango@vdaas.org>

* ♻️ apply feedback

Signed-off-by: vankichi <kyukawa315@gmail.com>

Signed-off-by: vankichi <kyukawa315@gmail.com>
Co-authored-by: Yusuke Kato <kpango@vdaas.org>

* Add Job reconciler & Change directory constitution of internal/k8s for benchmark (#1825)

* ✨ ♻️ add Job reconciler & use scenario instead of operator

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ fix format & rename file

Signed-off-by: vankichi <kyukawa315@gmail.com>

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Add benchmark operator framework (#1916)

* ✨ impl benchmark reconciler

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ✨ create benchmark operator framework

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ remove unness changes

Signed-off-by: vankichi <kyukawa315@gmail.com>

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Format code with prettier and gofumpt

* impl reconcile logic for create benchmark job (#1923)

* ✨ impl reconcile logic for create benchmark job

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Format code with prettier and gofumpt

* ♻️ fix

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ refactor continuous benchmark's crds

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ resolve error due to update conn bench crds for pkg/tools/benchmark/job

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ refactor continuous benchmark job logic

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Format code with prettier and gofumpt

* ♻️ update charts

Signed-off-by: vankichi <kyukawa315@gmail.com>

* Format code with prettier and gofumpt

* ♻️ rafactor con bench config and bug fix reconcile logic

Signed-off-by: vankichi <kyukawa315@gmail.com>

* 🐛 Bugfix: fix typo and recall function logic

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ♻️ refactor pkg benchmark job

Signed-off-by: vankichi <kyukawa315@gmail.com>

---------

Signed-off-by: vankichi <kyukawa315@gmail.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>

---------

Signed-off-by: vankichi <kyukawa315@gmail.com>
Co-authored-by: Yusuke Kato <kpango@vdaas.org>
Co-authored-by: Hiroto Funakoshi <hiroto.funakoshi.hiroto@gmail.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
4 people committed Dec 26, 2023
1 parent 8dc67ee commit fb2fb66
Show file tree
Hide file tree
Showing 80 changed files with 7,103 additions and 5 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/dockers-benchmark-job-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#
# Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
#
# 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
#
# https://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.
#
name: "Build docker image: benchmark-job"
on:
push:
branches:
- master
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
paths:
- ".github/actions/docker-build/actions.yaml"
- ".github/workflows/dockers-benchmak-job-image.yml"
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/benchmark/job/**"
- "cmd/benchmark/job/**"
- "dockers/benchmark/job/Dockerfile"
- "versions/GO_VERSION"
- "versions/NGT_VERSION"
pull_request:
paths:
- ".github/actions/docker-build/actions.yaml"
- ".github/workflows/dockers-benchmak-job-image.yml"
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/benchmark/job/**"
- "cmd/benchmark/job/**"
- "dockers/benchmark/job/Dockerfile"
- "versions/GO_VERSION"
- "versions/NGT_VERSION"

jobs:
build:
strategy:
max-parallel: 4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: "--debug"
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_USER }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Build and Publish
id: build_and_publish
uses: ./.github/actions/docker-build
with:
target: benchmark-job
builder: ${{ steps.buildx.outputs.name }}
- name: Initialize CodeQL
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/init@v2
- name: Run vulnerability scanner (table)
if: startsWith( github.ref, 'refs/tags/')
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.build_and_publish.outputs.IMAGE_NAME }}:${{ steps.build_and_publish.outputs.PRIMARY_TAG }}"
format: "table"
- name: Run vulnerability scanner (sarif)
if: startsWith( github.ref, 'refs/tags/')
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.build_and_publish.outputs.IMAGE_NAME }}:${{ steps.build_and_publish.outputs.PRIMARY_TAG }}"
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
- name: Upload Trivy scan results to Security tab
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "trivy-results.sarif"
slack:
name: Slack notification
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || startsWith( github.ref, 'refs/tags/')
steps:
- uses: technote-space/workflow-conclusion-action@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: 8398a7/action-slack@v3
with:
author_name: benchmark-job image build
status: ${{ env.WORKFLOW_CONCLUSION }}
only_mention_fail: channel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WEBHOOK_URL }}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ INDEX_CREATION_IMAGE = $(NAME)-index-creation
INDEX_SAVE_IMAGE = $(NAME)-index-save
READREPLICA_ROTATE_IMAGE = $(NAME)-readreplica-rotate
MANAGER_INDEX_IMAGE = $(NAME)-manager-index
BENCHMARK_JOB_IMAGE = $(NAME)-benchmark-job
BENCHMARK_OPERATOR_IMAGE = $(NAME)-benchmark-operator
MAINTAINER = "$(ORG).org $(NAME) team <$(NAME)@$(ORG).org>"

VERSION ?= $(eval VERSION := $(shell cat versions/VALD_VERSION))$(VERSION)
Expand Down
73 changes: 72 additions & 1 deletion Makefile.d/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ binary/build: \
cmd/discoverer/k8s/discoverer \
cmd/gateway/lb/lb \
cmd/gateway/filter/filter \
cmd/manager/index/index
cmd/manager/index/index \
cmd/tools/benchmark/job/job \
cmd/tools/benchmark/operator/operator

cmd/agent/core/ngt/ngt: \
ngt/install \
Expand Down Expand Up @@ -322,6 +324,68 @@ cmd/index/job/readreplica/rotate/readreplica-rotate: \
$(dir $@)main.go
$@ -version

cmd/tools/benchmark/job/job: \
$(GO_SOURCES_INTERNAL) \
$(PBGOS) \
$(shell find ./cmd/tools/benchmark/job -type f -name '*.go' -not -name '*_test.go' -not -name 'doc.go') \
$(shell find ./pkg/tools/benchmark/job -type f -name '*.go' -not -name '*_test.go' -not -name 'doc.go')
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
CGO_ENABLED=1 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
GO111MODULE=on \
GOPRIVATE=$(GOPRIVATE) \
go build \
--ldflags "-s -w \
-X '$(GOPKG)/internal/info.Version=$(VERSION)' \
-X '$(GOPKG)/internal/info.GitCommit=$(GIT_COMMIT)' \
-X '$(GOPKG)/internal/info.BuildTime=$(DATETIME)' \
-X '$(GOPKG)/internal/info.GoVersion=$(GO_VERSION)' \
-X '$(GOPKG)/internal/info.GoOS=$(GOOS)' \
-X '$(GOPKG)/internal/info.GoArch=$(GOARCH)' \
-X '$(GOPKG)/internal/info.CGOEnabled=$${CGO_ENABLED}' \
-X '$(GOPKG)/internal/info.NGTVersion=$(NGT_VERSION)' \
-X '$(GOPKG)/internal/info.BuildCPUInfoFlags=$(CPU_INFO_FLAGS)' \
-buildid=" \
-mod=readonly \
-modcacherw \
-a \
-tags "cgo osusergo netgo" \
-trimpath \
-o $@ \
$(dir $@)main.go
$@ -version

cmd/tools/benchmark/operator/operator: \
$(GO_SOURCES_INTERNAL) \
$(PBGOS) \
$(shell find ./cmd/tools/benchmark/operator -type f -name '*.go' -not -name '*_test.go' -not -name 'doc.go') \
$(shell find ./pkg/tools/benchmark/operator -type f -name '*.go' -not -name '*_test.go' -not -name 'doc.go')
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
CGO_ENABLED=1 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
GO111MODULE=on \
GOPRIVATE=$(GOPRIVATE) \
go build \
--ldflags "-s -w \
-X '$(GOPKG)/internal/info.CGOEnabled=$${CGO_ENABLED}' \
-X '$(GOPKG)/internal/info.NGTVersion=$(NGT_VERSION)' \
-X '$(GOPKG)/internal/info.BuildCPUInfoFlags=$(CPU_INFO_FLAGS)' \
-buildid=" \
-mod=readonly \
-modcacherw \
-a \
-tags "cgo osusergo netgo" \
-trimpath \
-o $@ \
$(dir $@)main.go
$@ -version

.PHONY: binary/build/zip
## build all binaries and zip them
binary/build/zip: \
Expand Down Expand Up @@ -356,3 +420,10 @@ artifacts/vald-manager-index-$(GOOS)-$(GOARCH).zip: cmd/manager/index/index
$(call mkdir, $(dir $@))
zip --junk-paths $@ $<

artifacts/vald-benchmark-job-$(GOOS)-$(GOARCH).zip: cmd/tools/benchmark/job/job
$(call mkdir, $(dir $@))
zip --junk-paths $@ $<

artifacts/vald-benchmark-operator-$(GOOS)-$(GOARCH).zip: cmd/tools/benchmark/operator/operator
$(call mkdir, $(dir $@))
zip --junk-paths $@ $<
34 changes: 33 additions & 1 deletion Makefile.d/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ docker/build: \
docker/build/gateway-lb \
docker/build/gateway-filter \
docker/build/manager-index \
docker/build/operator/helm
docker/build/benchmark-job \
docker/build/benchmark-operator \
docker/build/helm-operator

.PHONY: docker/name/org
docker/name/org:
Expand Down Expand Up @@ -226,3 +228,33 @@ docker/build/readreplica-rotate:
@make DOCKERFILE="$(ROOTDIR)/dockers/index/job/readreplica/rotate/Dockerfile" \
IMAGE=$(READREPLICA_ROTATE_IMAGE) \
docker/build/image

.PHONY: docker/name/benchmark-job
docker/name/benchmark-job:
@echo "$(ORG)/$(BENCHMARK_JOB_IMAGE)"

.PHONY: docker/build/benchmark-job
## build benchmark job
docker/build/benchmark-job:
$(DOCKER) build \
$(DOCKER_OPTS) \
-f dockers/tools/benchmark/job/Dockerfile \
-t $(ORG)/$(BENCHMARK_JOB_IMAGE):$(TAG) . \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg DISTROLESS_IMAGE=$(DISTROLESS_IMAGE) \
--build-arg DISTROLESS_IMAGE_TAG=$(DISTROLESS_IMAGE_TAG)

.PHONY: docker/name/benchmark-operator
docker/name/benchmark-operator:
@echo "$(ORG)/$(BENCHMARK_OPERATOR_IMAGE)"

.PHONY: docker/build/benchmark-operator
## build benchmark operator
docker/build/benchmark-operator:
$(DOCKER) build \
$(DOCKER_OPTS) \
-f dockers/tools/benchmark/operator/Dockerfile \
-t $(ORG)/$(BENCHMARK_OPERATOR_IMAGE):$(TAG) . \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg DISTROLESS_IMAGE=$(DISTROLESS_IMAGE) \
--build-arg DISTROLESS_IMAGE_TAG=$(DISTROLESS_IMAGE_TAG)
22 changes: 22 additions & 0 deletions Makefile.d/helm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ charts/vald-helm-operator/values.schema.json: \
GOPRIVATE=$(GOPRIVATE) \
go run -mod=readonly hack/helm/schema/gen/main.go charts/vald-helm-operator/values.yaml > charts/vald-helm-operator/values.schema.json

.PHONY: helm/schema/vald-benchmark-operator
## generate json schema for Vald Benchmark Operator Chart
helm/schema/vald-benchmark-operator: charts/vald-benchmark-operator/values.schema.json

charts/vald-benchmark-operator/values.schema.json: \
charts/vald-benchmark-operator/values.yaml \
hack/helm/schema/gen/main.go
GOPRIVATE=$(GOPRIVATE) \
go run -mod=readonly hack/helm/schema/gen/main.go charts/vald-benchmark-operator/values.yaml > charts/vald-benchmark-operator/values.schema.json


.PHONY: yq/install
## install yq
yq/install: $(BINDIR)/yq
Expand Down Expand Up @@ -121,3 +132,14 @@ helm/schema/crd/vald-helm-operator: \
charts/vald-helm-operator/values.yaml > $(TEMP_DIR)/valdhelmoperatorrelease-spec.yaml
$(BINDIR)/yq eval-all 'select(fileIndex==0).spec.versions[0].schema.openAPIV3Schema.properties.spec = select(fileIndex==1).spec | select(fileIndex==0)' \
$(TEMP_DIR)/valdhelmoperatorrelease.yaml $(TEMP_DIR)/valdhelmoperatorrelease-spec.yaml > charts/vald-helm-operator/crds/valdhelmoperatorrelease.yaml

.PHONY: helm/schema/crd/vald-benchmark-operator
## generate OpenAPI v3 schema for ValdBenchmarkOperatorRelease
helm/schema/crd/vald-benchmark-operator: \
yq/install
mv charts/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml $(TEMP_DIR)/valdbenchmarkoperatorrelease.yaml
GOPRIVATE=$(GOPRIVATE) \
go run -mod=readonly hack/helm/schema/crd/main.go \
charts/vald-benchmark-operator/values.yaml > $(TEMP_DIR)/valdbenchmarkoperatorrelease-spec.yaml
$(BINDIR)/yq eval-all 'select(fileIndex==0).spec.versions[0].schema.openAPIV3Schema.properties.spec = select(fileIndex==1).spec | select(fileIndex==0)' \
$(TEMP_DIR)/valdbenchmarkoperatorrelease.yaml $(TEMP_DIR)/valdbenchmarkoperatorrelease-spec.yaml > charts/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml
19 changes: 19 additions & 0 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@
- [Update](#vald-v1-Update)
- [v1/vald/upsert.proto](#v1_vald_upsert-proto)
- [Upsert](#vald-v1-Upsert)
- [apis/proto/v1/rpc/error_details.proto](#apis_proto_v1_rpc_error_details-proto)
- [BadRequest](#rpc-v1-BadRequest)
- [BadRequest.FieldViolation](#rpc-v1-BadRequest-FieldViolation)
- [DebugInfo](#rpc-v1-DebugInfo)
- [ErrorInfo](#rpc-v1-ErrorInfo)
- [ErrorInfo.MetadataEntry](#rpc-v1-ErrorInfo-MetadataEntry)
- [Help](#rpc-v1-Help)
- [Help.Link](#rpc-v1-Help-Link)
- [LocalizedMessage](#rpc-v1-LocalizedMessage)
- [PreconditionFailure](#rpc-v1-PreconditionFailure)
- [PreconditionFailure.Violation](#rpc-v1-PreconditionFailure-Violation)
- [QuotaFailure](#rpc-v1-QuotaFailure)
- [QuotaFailure.Violation](#rpc-v1-QuotaFailure-Violation)
- [RequestInfo](#rpc-v1-RequestInfo)
- [ResourceInfo](#rpc-v1-ResourceInfo)
- [RetryInfo](#rpc-v1-RetryInfo)
- [apis/proto/v1/benchmark/benchmark.proto](#apis_proto_v1_benchmark_benchmark-proto)
- [Controller](#benchmark-v1-Controller)
- [Job](#benchmark-v1-Job)
- [Scalar Value Types](#scalar-value-types)

<a name="v1_payload_payload-proto"></a>
Expand Down
Loading

0 comments on commit fb2fb66

Please sign in to comment.