diff --git a/.github/workflows/dockers-benchmark-job-image.yml b/.github/workflows/dockers-benchmark-job-image.yml index 28a239f96f..13d8aa8a16 100644 --- a/.github/workflows/dockers-benchmark-job-image.yml +++ b/.github/workflows/dockers-benchmark-job-image.yml @@ -47,7 +47,6 @@ on: - "internal/**" - "!internal/**/*_test.go" - "!internal/db/**" - - "!internal/k8s/**" - "apis/grpc/**" - "pkg/benchmark/job/**" - "cmd/benchmark/job/**" @@ -55,6 +54,10 @@ on: - "versions/GO_VERSION" - "versions/NGT_VERSION" +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref != 'refs/heads/main' && github.ref || github.sha }}-${{ github.event_name }} + cancel-in-progress: true + jobs: build: strategy: @@ -114,7 +117,7 @@ jobs: name: Slack notification needs: build runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' || startsWith( github.ref, 'refs/tags/') + if: github.ref == 'refs/heads/main' || startsWith( github.ref, 'refs/tags/') steps: - uses: technote-space/workflow-conclusion-action@v2 with: diff --git a/.github/workflows/dockers-benchmark-operator-image.yaml b/.github/workflows/dockers-benchmark-operator-image.yaml new file mode 100644 index 0000000000..ada420e0be --- /dev/null +++ b/.github/workflows/dockers-benchmark-operator-image.yaml @@ -0,0 +1,132 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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-operator" +on: + push: + branches: + - master + tags: + - "*.*.*" + - "v*.*.*" + - "*.*.*-*" + - "v*.*.*-*" + paths: + - ".github/actions/docker-build/actions.yaml" + - ".github/workflows/dockers-benchmak-operator-image.yml" + - "go.mod" + - "go.sum" + - "internal/**" + - "!internal/**/*_test.go" + - "!internal/db/**" + - "!internal/k8s/**" + - "apis/grpc/**" + - "pkg/benchmark/operator/**" + - "cmd/benchmark/operator/**" + - "dockers/benchmark/operator/Dockerfile" + - "versions/GO_VERSION" + - "versions/NGT_VERSION" + pull_request: + paths: + - ".github/actions/docker-build/actions.yaml" + - ".github/workflows/dockers-benchmak-operator-image.yml" + - "go.mod" + - "go.sum" + - "internal/**" + - "!internal/**/*_test.go" + - "!internal/db/**" + - "apis/grpc/**" + - "pkg/benchmark/operator/**" + - "cmd/benchmark/operator/**" + - "dockers/benchmark/operator/Dockerfile" + - "versions/GO_VERSION" + - "versions/NGT_VERSION" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref != 'refs/heads/main' && github.ref || github.sha }}-${{ github.event_name }} + cancel-in-progress: true + +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-operator + 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/main' || 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-operator image build + status: ${{ env.WORKFLOW_CONCLUSION }} + only_mention_fail: channel + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WEBHOOK_URL }} diff --git a/Makefile.d/helm.mk b/Makefile.d/helm.mk index 3123fee36d..b611009bdc 100644 --- a/Makefile.d/helm.mk +++ b/Makefile.d/helm.mk @@ -90,6 +90,26 @@ 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-job +## generate json schema for Vald Benchmark Job Chart +helm/schema/vald-benchmark-job: charts/vald-benchmark-operator/job-values.schema.json + +charts/vald-benchmark-operator/job-values.schema.json: \ + charts/vald-benchmark-operator/schemas/job-values.yaml \ + hack/helm/schema/gen/main.go + GOPRIVATE=$(GOPRIVATE) \ + go run -mod=readonly hack/helm/schema/gen/main.go charts/vald-benchmark-operator/schemas/job-values.yaml > charts/vald-benchmark-operator/job-values.schema.json + +.PHONY: helm/schema/vald-benchmark-job +## generate json schema for Vald Benchmark Job Chart +helm/schema/vald-benchmark-scenario: charts/vald-benchmark-operator/scenario-values.schema.json + +charts/vald-benchmark-operator/scenario-values.schema.json: \ + charts/vald-benchmark-operator/schemas/scenario-values.yaml \ + hack/helm/schema/gen/main.go + GOPRIVATE=$(GOPRIVATE) \ + go run -mod=readonly hack/helm/schema/gen/main.go charts/vald-benchmark-operator/schemas/scenario-values.yaml > charts/vald-benchmark-operator/scenario-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 @@ -133,6 +153,28 @@ helm/schema/crd/vald-helm-operator: \ $(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-job +## generate OpenAPI v3 schema for ValdBenchmarkJobRelease +helm/schema/crd/vald-benchmark-job: \ + yq/install + mv charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml $(TEMP_DIR)/valdbenchmarkjob.yaml + GOPRIVATE=$(GOPRIVATE) \ + go run -mod=readonly hack/helm/schema/crd/main.go \ + charts/vald-benchmark-operator/schemas/job-values.yaml > $(TEMP_DIR)/valdbenchmarkjob-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)/valdbenchmarkjob.yaml $(TEMP_DIR)/valdbenchmarkjob-spec.yaml > charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml + +.PHONY: helm/schema/crd/vald-benchmark-scenario +## generate OpenAPI v3 schema for ValdBenchmarkScenarioRelease +helm/schema/crd/vald-benchmark-scenario: \ + yq/install + mv charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml $(TEMP_DIR)/valdbenchmarkscenario.yaml + GOPRIVATE=$(GOPRIVATE) \ + go run -mod=readonly hack/helm/schema/crd/main.go \ + charts/vald-benchmark-operator/schemas/scenario-values.yaml > $(TEMP_DIR)/valdbenchmarkscenario-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)/valdbenchmarkscenario.yaml $(TEMP_DIR)/valdbenchmarkscenario-spec.yaml > charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml + .PHONY: helm/schema/crd/vald-benchmark-operator ## generate OpenAPI v3 schema for ValdBenchmarkOperatorRelease helm/schema/crd/vald-benchmark-operator: \ diff --git a/Makefile.d/k8s.mk b/Makefile.d/k8s.mk index efa2590143..8973afe52f 100644 --- a/Makefile.d/k8s.mk +++ b/Makefile.d/k8s.mk @@ -63,6 +63,23 @@ k8s/manifest/helm-operator/update: \ rm -rf $(TEMP_DIR) cp -r charts/vald-helm-operator/crds k8s/operator/helm/crds +.PHONY: k8s/manifest/benchmark-operator/clean +## clean k8s manifests for benchmark-operator +k8s/manifest/benchmark-operator/clean: + rm -rf \ + k8s/tools/benchmark/operator + +.PHONY: k8s/manifest/benchmark-operator/update +## update k8s manifests for benchmark-operator using helm templates +k8s/manifest/benchmark-operator/update: \ + k8s/manifest/benchmark-operator/clean + helm template \ + --output-dir $(TEMP_DIR) \ + charts/vald-benchmark-operator + mkdir -p k8s/tools/benchmark + mv $(TEMP_DIR)/vald-benchmark-operator/templates k8s/tools/benchmark/operator + rm -rf $(TEMP_DIR) + cp -r charts/vald-benchmark-operator/crds k8s/tools/benchmark/operator/crds .PHONY: k8s/vald/deploy ## deploy vald sample cluster to k8s @@ -153,6 +170,34 @@ k8s/vr/delete: \ k8s/metrics/metrics-server/delete kubectl delete vr vald-cluster +.PHONY: k8s/vald-benchmark-operator/deploy +## deploy vald-benchmark-operator to k8s +k8s/vald-benchmark-operator/deploy: + helm template \ + --output-dir $(TEMP_DIR) \ + --set image.tag=${VERSION} \ + --include-crds \ + charts/vald-benchmark-operator + kubectl create -f $(TEMP_DIR)/vald-benchmark-operator/crds/valdbenchmarkjob.yaml + kubectl create -f $(TEMP_DIR)/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml + kubectl create -f $(TEMP_DIR)/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml + kubectl apply -f $(TEMP_DIR)/vald-benchmark-operator/templates + sleep 2 + kubectl wait --for=condition=ready pod -l name=vald-benchmark-operator --timeout=600s + +.PHONY: k8s/vald-benchmark-operator/delete +## delete vald-benchmark-operator from k8s +k8s/vald-benchmark-operator/delete: + helm template \ + --output-dir $(TEMP_DIR) \ + --set image.tag=${VERSION} \ + --include-crds \ + charts/vald-benchmark-operator + kubectl delete -f $(TEMP_DIR)/vald-benchmark-operator/templates + kubectl wait --for=delete pod -l name=vald-benchmark-operator --timeout=600s + kubectl delete -f $(TEMP_DIR)/vald-benchmark-operator/crds + rm -rf $(TEMP_DIR) + .PHONY: k8s/external/cert-manager/deploy ## deploy cert-manager k8s/external/cert-manager/deploy: diff --git a/charts/vald-benchmark-operator/Chart.yaml b/charts/vald-benchmark-operator/Chart.yaml new file mode 100644 index 0000000000..b0726effed --- /dev/null +++ b/charts/vald-benchmark-operator/Chart.yaml @@ -0,0 +1,62 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +appVersion: "1.16.0" +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# + +apiVersion: v2 +name: vald-benchmark-operator +version: v1.7.5 +description: A benchmark operator for benchmarking the Vald cluster. +type: application +keywords: + - Vald + - NGT + - vector + - search + - approximate-nearest-neighbor-search + - nearest-neighbor-search + - vector-search-engine + - similarity-search + - image-search + - Kubernetes + - k8s + - AI + - artificial-intelligence +home: https://vald.vdaas.org +icon: https://raw.githubusercontent.com/vdaas/vald/main/assets/image/svg/symbol.svg +sources: + - https://github.com/vdaas/vald +maintainers: + - name: kpango + email: kpango@vdaas.org + - name: vankichi + email: vankichi@vdaas.org + - name: kmrmt + email: ksk@vdaas.org diff --git a/internal/k8s/crd/benchmark/valdbenchmarkjob.yaml b/charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml similarity index 67% rename from internal/k8s/crd/benchmark/valdbenchmarkjob.yaml rename to charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml index dbaf7547cc..de85714816 100644 --- a/internal/k8s/crd/benchmark/valdbenchmarkjob.yaml +++ b/charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml @@ -47,16 +47,10 @@ spec: type: object properties: apiVersion: - description: - "APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" type: string kind: - description: - "Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" type: string metadata: type: object @@ -69,129 +63,17 @@ spec: - Healthy type: string spec: - description: ValdBenchmarkJobSpec defines the desired state of ValdBenchmarkJob type: object properties: - target: - description: BenchmarkTarget defines the desired state of BenchmarkTarget - properties: - host: - type: string - port: - type: integer - required: - - host - - port - type: object - dataset: - description: BenchmarkDataset defines the desired state of BenchmarkDateset - properties: - group: - type: string - indexes: - type: integer - name: - type: string - range: - description: BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange - properties: - end: - type: integer - start: - type: integer - required: - - end - - start - type: object - required: - - group - - indexes - - name - type: object - dimension: - type: integer - job_type: - type: string - repetition: - type: integer - replica: - type: integer - rules: - items: - description: BenchmarkJobRule defines the desired state of BenchmarkJobRule - properties: - name: - type: string - type: - type: string - required: - - name - - type - type: object - type: array - rps: - type: integer - insert_config: - description: InsertConfig defines the desired state of insert config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - type: object - remove_config: - description: RemoveConfig defines the desired state of remove config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - type: object - search_config: - description: SearchConfig defines the desired state of search config - properties: - epsilon: - type: number - min_num: - format: int32 - type: integer - num: - format: int32 - type: integer - radius: - type: number - timeout: - type: string - type: object - update_config: - description: UpdateConfig defines the desired state of update config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - disable_balanced_update: - type: boolean - type: object - upsert_config: - description: UpsertConfig defines the desired state of upsert config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - disable_balanced_update: - type: boolean - type: object client_config: - description: ClientConfig represents the configurations for gRPC client. + type: object properties: addrs: + type: array items: type: string - type: array backoff: - description: Backoff represents the configuration for the internal backoff package. + type: object properties: backoff_factor: type: number @@ -207,21 +89,11 @@ spec: type: string retry_count: type: integer - type: object call_option: - description: CallOption represents the configurations for call option. - properties: - max_recv_msg_size: - type: integer - max_retry_rpc_buffer_size: - type: integer - max_send_msg_size: - type: integer - wait_for_ready: - type: boolean type: object + x-kubernetes-preserve-unknown-fields: true circuit_breaker: - description: CircuitBreaker represents the configuration for the internal circuitbreaker package. + type: object properties: closed_error_rate: type: number @@ -230,27 +102,24 @@ spec: half_open_error_rate: type: number min_samples: - format: int64 type: integer open_timeout: type: string - type: object connection_pool: - description: ConnectionPool represents the configurations for connection pool. + type: object properties: + enable_dns_resolver: + type: boolean enable_rebalance: type: boolean old_conn_close_duration: type: string rebalance_duration: type: string - resolve_dns: - type: boolean size: type: integer - type: object dial_option: - description: DialOption represents the configurations for dial option. + type: object properties: backoff_base_delay: type: string @@ -269,11 +138,13 @@ spec: insecure: type: boolean interceptors: + type: array items: type: string - type: array + enum: + - TraceInterceptor keepalive: - description: GRPCClientKeepalive represents the configurations for gRPC keep-alive. + type: object properties: permit_without_stream: type: boolean @@ -281,28 +152,24 @@ spec: type: string timeout: type: string - type: object max_msg_size: type: integer - minimum_connection_timeout: + min_connection_timeout: type: string net: - description: Net represents the network configuration tcp, udp, unix domain socket. + type: object properties: dialer: - description: Dialer represents the configuration for dial. + type: object properties: dual_stack_enabled: type: boolean - fallback_delay: - type: string keepalive: type: string timeout: type: string - type: object dns: - description: DNS represents the configuration for resolving DNS. + type: object properties: cache_enabled: type: boolean @@ -310,9 +177,8 @@ spec: type: string refresh_duration: type: string - type: object socket_option: - description: SocketOption represents the socket configurations. + type: object properties: ip_recover_destination_addr: type: boolean @@ -332,57 +198,165 @@ spec: type: boolean tcp_quick_ack: type: boolean - type: object tls: - description: TLS represent the TLS configuration for server. + type: object properties: ca: - description: CA represent the CA certificate environment variable key used to start server. type: string cert: - description: Cert represent the certificate environment variable key used to start server. type: string enabled: - description: Enable represent the server enable TLS or not. type: boolean insecure_skip_verify: - description: InsecureSkipVerify represent enable/disable skip SSL certificate verification type: boolean key: - description: Key represent the private key environment variable key used to start server. type: string - type: object - type: object read_buffer_size: type: integer timeout: type: string write_buffer_size: type: integer - type: object health_check_duration: type: string + max_recv_msg_size: + type: integer + max_retry_rpc_buffer_size: + type: integer + max_send_msg_size: + type: integer tls: - description: TLS represent the TLS configuration for server. + type: object properties: ca: - description: CA represent the CA certificate environment variable key used to start server. type: string cert: - description: Cert represent the certificate environment variable key used to start server. type: string enabled: - description: Enable represent the server enable TLS or not. type: boolean insecure_skip_verify: - description: InsecureSkipVerify represent enable/disable skip SSL certificate verification type: boolean key: - description: Key represent the private key environment variable key used to start server. type: string + wait_for_ready: + type: boolean + dataset: + type: object + properties: + group: + type: string + minLength: 1 + indexes: + type: integer + minimum: 0 + name: + type: string + enum: + - fashion-mnist + range: type: object + properties: + end: + type: integer + minimum: 1 + start: + type: integer + minimum: 1 + required: + - name + - indexes + - group + - range + dimension: + type: integer + minimum: 1 + insert_config: + type: object + properties: + skip_strict_exist_check: + type: boolean + timestamp: + type: string + job_type: + type: string + enum: + - insert + - update + - upsert + - search + - remove + - get_object + - exists + object_config: + type: object + properties: + filter_config: + type: object + properties: + host: + type: string + remove_config: type: object - required: - - job_type - - dimension - - dataset + properties: + skip_strict_exist_check: + type: boolean + timestamp: + type: string + repetition: + type: integer + minimum: 1 + replica: + type: integer + minimum: 1 + rps: + type: integer + maximum: 65535 + minimum: 0 + rules: + type: array + items: + type: string + search_config: + type: object + properties: + epsilon: + type: number + min_num: + type: integer + num: + type: integer + radius: + type: number + timeout: + type: string + target: + type: object + properties: + host: + type: string + minLength: 1 + port: + type: integer + maximum: 65535 + minimum: 0 + required: + - host + - port + update_config: + type: object + properties: + disable_balance_update: + type: boolean + skip_strict_exist_check: + type: boolean + timestamp: + type: string + upsert_config: + type: object + properties: + disable_balance_update: + type: boolean + skip_strict_exist_check: + type: boolean + timestamp: + type: string diff --git a/charts/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml b/charts/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml index ae88b72dc5..3451a48b38 100644 --- a/charts/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml +++ b/charts/vald-benchmark-operator/crds/valdbenchmarkoperatorrelease.yaml @@ -16,17 +16,17 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: valdbenchmarkscenarios.vald.vdaas.org + name: valdbenchmarkoperatorreleases.vald.vdaas.org spec: group: vald.vdaas.org names: - kind: ValdBenchmarkScenario - listKind: ValdBenchmarkScenarioList - plural: valdbenchmarkscenarios - singular: valdbenchmarkscenario + kind: ValdBenchmarkOperatorRelease + listKind: ValdBenchmarkOperatorReleaseList + plural: valdbenchmarkoperatorreleases + singular: valdbenchmarkoperatorrelease shortNames: - - vbo - - vbos + - vbor + - vbors scope: Namespaced versions: - name: v1 @@ -55,171 +55,456 @@ spec: description: ValdBenchmarkScenarioStatus defines the observed state of ValdBenchmarkScenario enum: - NotReady + - Completed - Available - Healthy type: string spec: type: object properties: - client_config: + affinity: + type: object + x-kubernetes-preserve-unknown-fields: true + annotations: + type: object + x-kubernetes-preserve-unknown-fields: true + image: + type: object + properties: + pullPolicy: + type: string + enum: + - Always + - Never + - IfNotPresent + repository: + type: string + tag: + type: string + logging: + type: object + properties: + format: + type: string + enum: + - raw + - json + level: + type: string + enum: + - debug + - info + - warn + - error + - fatal + logger: + type: string + enum: + - glg + - zap + name: + type: string + nodeSelector: + type: object + x-kubernetes-preserve-unknown-fields: true + observability: type: object properties: - addrs: - type: array - items: - type: string - backoff: + enabled: + type: boolean + otlp: type: object properties: - backoff_factor: - type: number - backoff_time_limit: + attribute: + type: object + properties: + metrics: + type: object + properties: + enable_cgo: + type: boolean + enable_goroutine: + type: boolean + enable_memory: + type: boolean + enable_version_info: + type: boolean + version_info_labels: + type: array + items: + type: string + namespace: + type: string + node_name: + type: string + pod_name: + type: string + service_name: + type: string + collector_endpoint: type: string - enable_error_log: - type: boolean - initial_duration: + metrics_export_interval: type: string - jitter_limit: + metrics_export_timeout: type: string - maximum_duration: + trace_batch_timeout: type: string - retry_count: - type: integer - call_option: - type: object - x-kubernetes-preserve-unknown-fields: true - circuit_breaker: - type: object - properties: - closed_error_rate: - type: number - closed_refresh_timeout: + trace_export_timeout: type: string - half_open_error_rate: - type: number - min_samples: + trace_max_export_batch_size: type: integer - open_timeout: - type: string - connection_pool: + trace_max_queue_size: + type: integer + trace: type: object properties: - enable_dns_resolver: - type: boolean - enable_rebalance: + enabled: type: boolean - old_conn_close_duration: - type: string - rebalance_duration: - type: string - size: + sampling_rate: type: integer - dial_option: + podAnnotations: + type: object + x-kubernetes-preserve-unknown-fields: true + podSecurityContext: + type: object + x-kubernetes-preserve-unknown-fields: true + rbac: + type: object + properties: + create: + type: boolean + name: + type: string + replicas: + type: integer + resources: + type: object + properties: + limits: + type: object + x-kubernetes-preserve-unknown-fields: true + requests: + type: object + x-kubernetes-preserve-unknown-fields: true + securityContext: + type: object + x-kubernetes-preserve-unknown-fields: true + server_config: + type: object + properties: + full_shutdown_duration: + type: string + healths: type: object properties: - backoff_base_delay: - type: string - backoff_jitter: - type: number - backoff_max_delay: - type: string - backoff_multiplier: - type: number - enable_backoff: - type: boolean - initial_connection_window_size: - type: integer - initial_window_size: - type: integer - insecure: - type: boolean - interceptors: - type: array - items: - type: string - enum: - - TraceInterceptor - keepalive: + liveness: type: object properties: - permit_without_stream: + enabled: type: boolean - time: + host: type: string - timeout: + livenessProbe: + type: object + properties: + failureThreshold: + type: integer + httpGet: + type: object + properties: + path: + type: string + port: + type: string + scheme: + type: string + initialDelaySeconds: + type: integer + periodSeconds: + type: integer + successThreshold: + type: integer + timeoutSeconds: + type: integer + port: + type: integer + server: + type: object + properties: + http: + type: object + properties: + idle_timeout: + type: string + read_header_timeout: + type: string + read_timeout: + type: string + shutdown_duration: + type: string + timeout: + type: string + write_timeout: + type: string + mode: + type: string + network: + type: string + probe_wait_time: + type: string + socket_path: + type: string + servicePort: + type: integer + readiness: + type: object + properties: + enabled: + type: boolean + host: type: string - max_msg_size: - type: integer - min_connection_timeout: - type: string - net: + port: + type: integer + readinessProbe: + type: object + properties: + failureThreshold: + type: integer + httpGet: + type: object + properties: + path: + type: string + port: + type: string + scheme: + type: string + initialDelaySeconds: + type: integer + periodSeconds: + type: integer + successThreshold: + type: integer + timeoutSeconds: + type: integer + server: + type: object + properties: + http: + type: object + properties: + handler_timeout: + type: string + idle_timeout: + type: string + read_header_timeout: + type: string + read_timeout: + type: string + shutdown_duration: + type: string + write_timeout: + type: string + mode: + type: string + network: + type: string + probe_wait_time: + type: string + socket_path: + type: string + servicePort: + type: integer + startup: + type: object + properties: + enabled: + type: boolean + startupProbe: type: object properties: - dialer: + failureThreshold: + type: integer + httpGet: type: object properties: - dual_stack_enabled: - type: boolean - keepalive: + path: + type: string + port: type: string - timeout: + scheme: type: string - dns: + initialDelaySeconds: + type: integer + periodSeconds: + type: integer + successThreshold: + type: integer + timeoutSeconds: + type: integer + metrics: + type: object + properties: + pprof: + type: object + properties: + enabled: + type: boolean + host: + type: string + port: + type: integer + server: type: object properties: - cache_enabled: - type: boolean - cache_expiration: + http: + type: object + properties: + handler_timeout: + type: string + idle_timeout: + type: string + read_header_timeout: + type: string + read_timeout: + type: string + shutdown_duration: + type: string + write_timeout: + type: string + mode: type: string - refresh_duration: + network: type: string - socket_option: - type: "" - tls: - type: "" - read_buffer_size: - type: integer - timeout: - type: string - write_buffer_size: - type: integer - health_check_duration: - type: string - max_recv_msg_size: - type: integer - max_retry_rpc_buffer_size: - type: integer - max_send_msg_size: - type: integer + probe_wait_time: + type: string + socket_path: + type: string + servers: + type: object + properties: + grpc: + type: object + properties: + enabled: + type: boolean + host: + type: string + name: + type: string + port: + type: integer + server: + type: object + properties: + grpc: + type: object + properties: + bidirectional_stream_concurrency: + type: integer + connection_timeout: + type: string + enable_reflection: + type: boolean + header_table_size: + type: integer + initial_conn_window_size: + type: integer + initial_window_size: + type: integer + interceptors: + type: array + items: + type: string + keepalive: + type: object + properties: + max_conn_age: + type: string + max_conn_age_grace: + type: string + max_conn_idle: + type: string + min_time: + type: string + permit_without_stream: + type: boolean + time: + type: string + timeout: + type: string + max_header_list_size: + type: integer + max_receive_message_size: + type: integer + max_send_msg_size: + type: integer + read_buffer_size: + type: integer + write_buffer_size: + type: integer + mode: + type: string + network: + type: string + probe_wait_time: + type: string + restart: + type: boolean + socket_path: + type: string + servicePort: + type: integer + rest: + type: object + properties: + enabled: + type: boolean tls: - type: "" - wait_for_ready: - type: boolean - dataset: + type: object + properties: + ca: + type: string + cert: + type: string + enabled: + type: boolean + insecure_skip_verify: + type: boolean + key: + type: string + service: type: object properties: - group: + annotations: + type: object + x-kubernetes-preserve-unknown-fields: true + enabled: + type: boolean + externalTrafficPolicy: type: string - indexes: - type: integer + labels: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + enum: + - ClusterIP + - LoadBalancer + - NodePort + serviceAccount: + type: object + properties: + create: + type: boolean name: type: string - range: - type: object - properties: - end: - type: integer - start: - type: integer - jobs: + time_zone: + type: string + tolerations: type: array items: type: object x-kubernetes-preserve-unknown-fields: true - target: - type: object - properties: - host: - type: string - port: - type: integer + version: + type: string diff --git a/charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml b/charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml new file mode 100644 index 0000000000..f705e7df6b --- /dev/null +++ b/charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml @@ -0,0 +1,109 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: valdbenchmarkscenarios.vald.vdaas.org +spec: + group: vald.vdaas.org + names: + kind: ValdBenchmarkScenario + listKind: ValdBenchmarkScenarioList + plural: valdbenchmarkscenarios + singular: valdbenchmarkscenario + shortNames: + - vbo + - vbos + scope: Namespaced + versions: + - name: v1 + served: true + storage: true + subresources: + status: {} + additionalPrinterColumns: + - jsonPath: .status + name: STATUS + type: string + schema: + openAPIV3Schema: + description: ValdBenchmarkScenario is the Schema for the valdbenchmarkscenarios API + type: object + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + status: + description: ValdBenchmarkScenarioStatus defines the observed state of ValdBenchmarkScenario + enum: + - NotReady + - Completed + - Available + - Healthy + type: string + spec: + type: object + properties: + dataset: + type: object + properties: + group: + type: string + minLength: 1 + indexes: + type: integer + minimum: 0 + name: + type: string + enum: + - fashion-mnist + range: + type: object + properties: + end: + type: integer + minimum: 1 + start: + type: integer + minimum: 1 + required: + - name + - indexes + - group + - range + jobs: + type: array + items: + type: object + x-kubernetes-preserve-unknown-fields: true + target: + type: object + properties: + host: + type: string + minLength: 1 + port: + type: integer + maximum: 65535 + minimum: 0 + required: + - host + - port diff --git a/charts/vald-benchmark-operator/job-values.schema.json b/charts/vald-benchmark-operator/job-values.schema.json new file mode 100644 index 0000000000..24f2f5b91f --- /dev/null +++ b/charts/vald-benchmark-operator/job-values.schema.json @@ -0,0 +1,469 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Values", + "type": "object", + "properties": { + "client_config": { + "type": "object", + "description": "gRPC client config for request to the Vald cluster", + "properties": { + "addrs": { + "type": "array", + "description": "gRPC client addresses", + "items": { "type": "string" } + }, + "backoff": { + "type": "object", + "properties": { + "backoff_factor": { + "type": "number", + "description": "gRPC client backoff factor" + }, + "backoff_time_limit": { + "type": "string", + "description": "gRPC client backoff time limit" + }, + "enable_error_log": { + "type": "boolean", + "description": "gRPC client backoff log enabled" + }, + "initial_duration": { + "type": "string", + "description": "gRPC client backoff initial duration" + }, + "jitter_limit": { + "type": "string", + "description": "gRPC client backoff jitter limit" + }, + "maximum_duration": { + "type": "string", + "description": "gRPC client backoff maximum duration" + }, + "retry_count": { + "type": "integer", + "description": "gRPC client backoff retry count" + } + } + }, + "call_option": { "type": "object" }, + "circuit_breaker": { + "type": "object", + "properties": { + "closed_error_rate": { + "type": "number", + "description": "gRPC client circuitbreaker closed error rate" + }, + "closed_refresh_timeout": { + "type": "string", + "description": "gRPC client circuitbreaker closed refresh timeout" + }, + "half_open_error_rate": { + "type": "number", + "description": "gRPC client circuitbreaker half-open error rate" + }, + "min_samples": { + "type": "integer", + "description": "gRPC client circuitbreaker minimum sampling count" + }, + "open_timeout": { + "type": "string", + "description": "gRPC client circuitbreaker open timeout" + } + } + }, + "connection_pool": { + "type": "object", + "properties": { + "enable_dns_resolver": { + "type": "boolean", + "description": "enables gRPC client connection pool dns resolver, when enabled vald uses ip handshake exclude dns discovery which improves network performance" + }, + "enable_rebalance": { + "type": "boolean", + "description": "enables gRPC client connection pool rebalance" + }, + "old_conn_close_duration": { + "type": "string", + "description": "makes delay before gRPC client connection closing during connection pool rebalance" + }, + "rebalance_duration": { + "type": "string", + "description": "gRPC client connection pool rebalance duration" + }, + "size": { + "type": "integer", + "description": "gRPC client connection pool size" + } + } + }, + "dial_option": { + "type": "object", + "properties": { + "backoff_base_delay": { + "type": "string", + "description": "gRPC client dial option base backoff delay" + }, + "backoff_jitter": { + "type": "number", + "description": "gRPC client dial option base backoff delay" + }, + "backoff_max_delay": { + "type": "string", + "description": "gRPC client dial option max backoff delay" + }, + "backoff_multiplier": { + "type": "number", + "description": "gRPC client dial option base backoff delay" + }, + "enable_backoff": { + "type": "boolean", + "description": "gRPC client dial option backoff enabled" + }, + "initial_connection_window_size": { + "type": "integer", + "description": "gRPC client dial option initial connection window size" + }, + "initial_window_size": { + "type": "integer", + "description": "gRPC client dial option initial window size" + }, + "insecure": { + "type": "boolean", + "description": "gRPC client dial option insecure enabled" + }, + "interceptors": { + "type": "array", + "description": "gRPC client interceptors", + "items": { "type": "string", "enum": ["TraceInterceptor"] } + }, + "keepalive": { + "type": "object", + "properties": { + "permit_without_stream": { + "type": "boolean", + "description": "gRPC client keep alive permit without stream" + }, + "time": { + "type": "string", + "description": "gRPC client keep alive time" + }, + "timeout": { + "type": "string", + "description": "gRPC client keep alive timeout" + } + } + }, + "max_msg_size": { + "type": "integer", + "description": "gRPC client dial option max message size" + }, + "min_connection_timeout": { + "type": "string", + "description": "gRPC client dial option minimum connection timeout" + }, + "net": { + "type": "object", + "properties": { + "dialer": { + "type": "object", + "properties": { + "dual_stack_enabled": { + "type": "boolean", + "description": "gRPC client TCP dialer dual stack enabled" + }, + "keepalive": { + "type": "string", + "description": "gRPC client TCP dialer keep alive" + }, + "timeout": { + "type": "string", + "description": "gRPC client TCP dialer timeout" + } + } + }, + "dns": { + "type": "object", + "properties": { + "cache_enabled": { + "type": "boolean", + "description": "gRPC client TCP DNS cache enabled" + }, + "cache_expiration": { + "type": "string", + "description": "gRPC client TCP DNS cache expiration" + }, + "refresh_duration": { + "type": "string", + "description": "gRPC client TCP DNS cache refresh duration" + } + } + }, + "socket_option": { + "type": "object", + "properties": { + "ip_recover_destination_addr": { + "type": "boolean", + "description": "server listen socket option for ip_recover_destination_addr functionality" + }, + "ip_transparent": { + "type": "boolean", + "description": "server listen socket option for ip_transparent functionality" + }, + "reuse_addr": { + "type": "boolean", + "description": "server listen socket option for reuse_addr functionality" + }, + "reuse_port": { + "type": "boolean", + "description": "server listen socket option for reuse_port functionality" + }, + "tcp_cork": { + "type": "boolean", + "description": "server listen socket option for tcp_cork functionality" + }, + "tcp_defer_accept": { + "type": "boolean", + "description": "server listen socket option for tcp_defer_accept functionality" + }, + "tcp_fast_open": { + "type": "boolean", + "description": "server listen socket option for tcp_fast_open functionality" + }, + "tcp_no_delay": { + "type": "boolean", + "description": "server listen socket option for tcp_no_delay functionality" + }, + "tcp_quick_ack": { + "type": "boolean", + "description": "server listen socket option for tcp_quick_ack functionality" + } + } + }, + "tls": { + "type": "object", + "properties": { + "ca": { "type": "string" }, + "cert": { "type": "string" }, + "enabled": { "type": "boolean" }, + "insecure_skip_verify": { "type": "boolean" }, + "key": { "type": "string" } + } + } + } + }, + "read_buffer_size": { + "type": "integer", + "description": "gRPC client dial option read buffer size" + }, + "timeout": { + "type": "string", + "description": "gRPC client dial option timeout" + }, + "write_buffer_size": { + "type": "integer", + "description": "gRPC client dial option write buffer size" + } + } + }, + "health_check_duration": { + "type": "string", + "description": "gRPC client health check duration" + }, + "max_recv_msg_size": { "type": "integer" }, + "max_retry_rpc_buffer_size": { "type": "integer" }, + "max_send_msg_size": { "type": "integer" }, + "tls": { + "type": "object", + "properties": { + "ca": { "type": "string", "description": "TLS ca path" }, + "cert": { "type": "string", "description": "TLS cert path" }, + "enabled": { "type": "boolean", "description": "TLS enabled" }, + "insecure_skip_verify": { + "type": "boolean", + "description": "enable/disable skip SSL certificate verification" + }, + "key": { "type": "string", "description": "TLS key path" } + } + }, + "wait_for_ready": { "type": "boolean" } + } + }, + "dataset": { + "type": "object", + "description": "dataset information", + "properties": { + "group": { + "type": "string", + "description": "the hdf5 group name of dataset", + "minLength": 1 + }, + "indexes": { + "type": "integer", + "description": "the amount of indexes", + "minimum": 0 + }, + "name": { + "type": "string", + "description": "the name of dataset", + "enum": ["fashion-mnist"] + }, + "range": { + "type": "object", + "description": "the data range of indexes", + "properties": { + "end": { + "type": "integer", + "description": "end index number", + "minimum": 1 + }, + "start": { + "type": "integer", + "description": "start index number", + "minimum": 1 + } + } + } + }, + "required": ["name", "indexes", "group", "range"] + }, + "dimension": { + "type": "integer", + "description": "vector dimension", + "minimum": 1 + }, + "insert_config": { + "type": "object", + "description": "insert config", + "properties": { + "skip_strict_exist_check": { + "type": "boolean", + "description": "skip strict exists check flag config" + }, + "timestamp": { "type": "string", "description": "index timestamp" } + } + }, + "job_type": { + "type": "string", + "description": "job type name", + "enum": [ + "insert", + "update", + "upsert", + "search", + "remove", + "get_object", + "exists" + ] + }, + "object_config": { + "type": "object", + "description": "object config", + "properties": { + "filter_config": { + "type": "object", + "description": "filter target config", + "properties": { + "host": { "type": "string", "description": "filter target host" } + } + } + } + }, + "remove_config": { + "type": "object", + "description": "remove config", + "properties": { + "skip_strict_exist_check": { + "type": "boolean", + "description": "skip strict exists check flag config" + }, + "timestamp": { "type": "string", "description": "index timestamp" } + } + }, + "repetition": { + "type": "integer", + "description": "the number of repeat job", + "minimum": 1 + }, + "replica": { + "type": "integer", + "description": "the number of running concurrency job", + "minimum": 1 + }, + "rps": { + "type": "integer", + "description": "desired request per sec", + "maximum": 65535, + "minimum": 0 + }, + "rules": { + "type": "array", + "description": "executing rule", + "items": { "type": "string" } + }, + "search_config": { + "type": "object", + "description": "upsert config", + "properties": { + "epsilon": { "type": "number", "description": "epsilon" }, + "min_num": { + "type": "integer", + "description": "minimum number of top-k" + }, + "num": { "type": "integer", "description": "number of top-k" }, + "radius": { "type": "number", "description": "radius" }, + "timeout": { + "type": "string", + "description": "search operation timeout" + } + } + }, + "target": { + "type": "object", + "description": "target cluster location", + "properties": { + "host": { + "type": "string", + "description": "target cluster host", + "minLength": 1 + }, + "port": { + "type": "integer", + "description": "target cluster port", + "maximum": 65535, + "minimum": 0 + } + }, + "required": ["host", "port"] + }, + "update_config": { + "type": "object", + "description": "update config", + "properties": { + "disable_balance_update": { + "type": "boolean", + "description": "disabled balance update flag" + }, + "skip_strict_exist_check": { + "type": "boolean", + "description": "skip strict exists check flag config" + }, + "timestamp": { "type": "string", "description": "index timestamp" } + } + }, + "upsert_config": { + "type": "object", + "description": "upsert config", + "properties": { + "disable_balance_update": { + "type": "boolean", + "description": "disabled balance update flag" + }, + "skip_strict_exist_check": { + "type": "boolean", + "description": "skip strict exists check flag config" + }, + "timestamp": { "type": "string", "description": "index timestamp" } + } + } + } +} diff --git a/charts/vald-benchmark-operator/scenario-values.schema.json b/charts/vald-benchmark-operator/scenario-values.schema.json new file mode 100644 index 0000000000..e3e549e69d --- /dev/null +++ b/charts/vald-benchmark-operator/scenario-values.schema.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Values", + "type": "object", + "properties": { + "dataset": { + "type": "object", + "description": "dataset information", + "properties": { + "group": { + "type": "string", + "description": "the hdf5 group name of dataset", + "minLength": 1 + }, + "indexes": { + "type": "integer", + "description": "the amount of indexes", + "minimum": 0 + }, + "name": { + "type": "string", + "description": "the name of dataset", + "enum": ["fashion-mnist"] + }, + "range": { + "type": "object", + "description": "the data range of indexes", + "properties": { + "end": { + "type": "integer", + "description": "end index number", + "minimum": 1 + }, + "start": { + "type": "integer", + "description": "start index number", + "minimum": 1 + } + } + } + }, + "required": ["name", "indexes", "group", "range"] + }, + "jobs": { "type": "array", "items": { "type": "object" } }, + "target": { + "type": "object", + "description": "target cluster location", + "properties": { + "host": { + "type": "string", + "description": "target cluster host", + "minLength": 1 + }, + "port": { + "type": "integer", + "description": "target cluster port", + "maximum": 65535, + "minimum": 0 + } + }, + "required": ["host", "port"] + } + } +} diff --git a/charts/vald-benchmark-operator/schemas/job-values.yaml b/charts/vald-benchmark-operator/schemas/job-values.yaml new file mode 100644 index 0000000000..47fafd98b0 --- /dev/null +++ b/charts/vald-benchmark-operator/schemas/job-values.yaml @@ -0,0 +1,360 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# + +# @schema {"name": "target", "type": "object", "required": ["host", "port"]} +# target -- target cluster location +target: + # @schema {"name": "target.host", "type": "string", "minLength": 1} + # target.host -- target cluster host + host: + "vald-lb-gateway.default.svc.cluster.local" + # @schema {"name": "target.port", "type": "integer", "minimum": 0, "maximum": 65535} + # target.port -- target cluster port + port: 8081 +# @schema {"name": "dataset", "type": "object", "required": ["name", "indexes", "group", "range"]} +# dataset -- dataset information +dataset: + # @schema {"name": "dataset.name", "type": "string", "enum": ["fashion-mnist"] } + # dataset.name -- the name of dataset + name: "fashion-mnist" + # @schema {"name": "dataset.indexes", "type": "integer", "minimum": 0} + # dataset.indexes -- the amount of indexes + indexes: 1000 + # @schema {"name": "dataset.group", "type": "string", "minLength": 1} + # dataset.group -- the hdf5 group name of dataset + group: "test" + # @schema {"name": "dataset.range", "type": "object", "range": ["start", "port"]} + # dataset.range -- the data range of indexes + range: + # @schema {"name": "dataset.range.start", "type": "integer", "minimum": 1} + # dataset.range.start -- start index number + start: 1 + # @schema {"name": "dataset.range.end", "type": "integer", "minimum": 1} + # dataset.range.end -- end index number + end: 1000 +# @schema {"name": "dimension", "type": "integer", "minimum": 1} +# dimension -- vector dimension +dimension: 784 +# @schema {"name": "replica", "type": "integer", "minimum": 1} +# replica -- the number of running concurrency job +replica: 1 +# @schema {"name": "repetition", "type": "integer", "minimum": 1} +# repetition -- the number of repeat job +repetition: 1 +# @schema {"name": "job_type", "type": "string", "enum": ["insert", "update", "upsert", "search", "remove", "get_object", "exists"]} +# job_type -- job type name +job_type: "search" +# @schema {"name": "insert_config", "type": "object"} +# insert_config -- insert config +insert_config: + # @schema {"name": "insert_config.skip_strict_exist_check", "type": "boolean"} + # insert_config.skip_strict_exist_check -- skip strict exists check flag config + skip_strict_exist_check: false + # @schema {"name": "insert_config.timestamp", "type": "string"} + # insert_config.timestamp -- index timestamp + timestamp: "" +# @schema {"name": "update_config", "type": "object"} +# update_config -- update config +update_config: + # @schema {"name": "update_config.skip_strict_exist_check", "type": "boolean"} + # update_config.skip_strict_exist_check -- skip strict exists check flag config + skip_strict_exist_check: false + # @schema {"name": "update_config.timestamp", "type": "string"} + # update_config.timestamp -- index timestamp + timestamp: "" + # @schema {"name": "update_config.disable_balance_update", "type": "boolean"} + # update_config.disable_balance_update -- disabled balance update flag + disable_balance_update: false +# @schema {"name": "upsert_config", "type": "object"} +# upsert_config -- upsert config +upsert_config: + # @schema {"name": "upsert_config.skip_strict_exist_check", "type": "boolean"} + # upsert_config.skip_strict_exist_check -- skip strict exists check flag config + skip_strict_exist_check: false + # @schema {"name": "upsert_config.timestamp", "type": "string"} + # upsert_config.timestamp -- index timestamp + timestamp: "" + # @schema {"name": "upsert_config.disable_balance_update", "type": "boolean"} + # upsert_config.disable_balance_update -- disabled balance update flag + disable_balance_update: false +# @schema {"name": "search_config", "type": "object"} +# search_config -- upsert config +search_config: + # @schema {"name": "search_config.epsilon", "type": "number"} + # search_config.epsilon -- epsilon + epsilon: 0.1 + # @schema {"name": "search_config.radius", "type": "number"} + # search_config.radius -- radius + radius: -1 + # @schema {"name": "search_config.num", "type": "integer"} + # search_config.num -- number of top-k + num: 10 + # @schema {"name": "search_config.min_num", "type": "integer"} + # search_config.min_num -- minimum number of top-k + min_num: 10 + # @schema {"name": "search_config.timeout", "type": "string"} + # search_config.timeout -- search operation timeout + timeout: "10s" + +# @schema {"name": "remove_config", "type": "object"} +# remove_config -- remove config +remove_config: + # @schema {"name": "remove_config.skip_strict_exist_check", "type": "boolean"} + # remove_config.skip_strict_exist_check -- skip strict exists check flag config + skip_strict_exist_check: false + # @schema {"name": "remove_config.timestamp", "type": "string"} + # remove_config.timestamp -- index timestamp + timestamp: "" +# @schema {"name": "object_config", "type": "object"} +# object_config -- object config +object_config: + # @schema {"name": "object_config.filter_config", "type": "object"} + # object_config.filter_config -- filter target config + filter_config: + # @schema {"name": "object_config.filter_config.host", "type": "string"} + # object_config.filter_config.host -- filter target host + host: 0.0.0.0 + # @schema {"name": "object_config.filter_config.host", "type": "integer"} + # object_config.filter_config.port -- filter target host + port: 8081 +# @schema {"name": "client_config", "type": "object"} +# client_config -- gRPC client config for request to the Vald cluster +client_config: + # @schema {"name": "client_config.addrs", "type": "array", "items": {"type": "string"}} + # client_config.addrs -- gRPC client addresses + addrs: [] + # @schema {"name": "client_config.health_check_duration", "type": "string"} + # client_config.health_check_duration -- gRPC client health check duration + health_check_duration: "1s" + # @schema {"name": "client_config.connection_pool", "type": "object"} + connection_pool: + # @schema {"name": "client_config.connection_pool.enable_dns_resolver", "type": "boolean"} + # client_config.connection_pool.enable_dns_resolver -- enables gRPC client connection pool dns resolver, when enabled vald uses ip handshake exclude dns discovery which improves network performance + enable_dns_resolver: true + # @schema {"name": "client_config.connection_pool.enable_rebalance", "type": "boolean"} + # client_config.connection_pool.enable_rebalance -- enables gRPC client connection pool rebalance + enable_rebalance: true + # @schema {"name": "client_config.connection_pool.rebalance_duration", "type": "string"} + # client_config.connection_pool.rebalance_duration -- gRPC client connection pool rebalance duration + rebalance_duration: 30m + # @schema {"name": "client_config.connection_pool.size", "type": "integer"} + # client_config.connection_pool.size -- gRPC client connection pool size + size: 3 + # @schema {"name": "client_config.connection_pool.old_conn_close_duration", "type": "string"} + # client_config.connection_pool.old_conn_close_duration -- makes delay before gRPC client connection closing during connection pool rebalance + old_conn_close_duration: "2m" + # @schema {"name": "client_config.backoff", "type": "object", "anchor": "backoff"} + backoff: + # @schema {"name": "client_config.backoff.initial_duration", "type": "string"} + # client_config.backoff.initial_duration -- gRPC client backoff initial duration + initial_duration: 5ms + # @schema {"name": "client_config.backoff.backoff_time_limit", "type": "string"} + # client_config.backoff.backoff_time_limit -- gRPC client backoff time limit + backoff_time_limit: 5s + # @schema {"name": "client_config.backoff.maximum_duration", "type": "string"} + # client_config.backoff.maximum_duration -- gRPC client backoff maximum duration + maximum_duration: 5s + # @schema {"name": "client_config.backoff.jitter_limit", "type": "string"} + # client_config.backoff.jitter_limit -- gRPC client backoff jitter limit + jitter_limit: 100ms + # @schema {"name": "client_config.backoff.backoff_factor", "type": "number"} + # client_config.backoff.backoff_factor -- gRPC client backoff factor + backoff_factor: 1.1 + # @schema {"name": "client_config.backoff.retry_count", "type": "integer"} + # client_config.backoff.retry_count -- gRPC client backoff retry count + retry_count: 100 + # @schema {"name": "client_config.backoff.enable_error_log", "type": "boolean"} + # client_config.backoff.enable_error_log -- gRPC client backoff log enabled + enable_error_log: true + # @schema {"name": "client_config.circuit_breaker", "type": "object"} + circuit_breaker: + # @schema {"name": "client_config.circuit_breaker.closed_error_rate", "type": "number"} + # client_config.circuit_breaker.closed_error_rate -- gRPC client circuitbreaker closed error rate + closed_error_rate: 0.7 + # @schema {"name": "client_config.circuit_breaker.half_open_error_rate", "type": "number"} + # client_config.circuit_breaker.half_open_error_rate -- gRPC client circuitbreaker half-open error rate + half_open_error_rate: 0.5 + # @schema {"name": "client_config.circuit_breaker.min_samples", "type": "integer"} + # client_config.circuit_breaker.min_samples -- gRPC client circuitbreaker minimum sampling count + min_samples: 1000 + # @schema {"name": "client_config.circuit_breaker.open_timeout", "type": "string"} + # client_config.circuit_breaker.open_timeout -- gRPC client circuitbreaker open timeout + open_timeout: "1s" + # @schema {"name": "client_config.circuit_breaker.closed_refresh_timeout", "type": "string"} + # client_config.circuit_breaker.closed_refresh_timeout -- gRPC client circuitbreaker closed refresh timeout + closed_refresh_timeout: "10s" + # @schema {"name": "client_config.call_option", "type": "object"} + call_option: + # @schema {"name": "client_config.wait_for_ready", "type": "boolean"} + # client_config.call_option.wait_for_ready -- gRPC client call option wait for ready + wait_for_ready: true + # @schema {"name": "client_config.max_retry_rpc_buffer_size", "type": "integer"} + # client_config.call_option.max_retry_rpc_buffer_size -- gRPC client call option max retry rpc buffer size + max_retry_rpc_buffer_size: 0 + # @schema {"name": "client_config.max_recv_msg_size", "type": "integer"} + # client_config.call_option.max_recv_msg_size -- gRPC client call option max receive message size + max_recv_msg_size: 0 + # @schema {"name": "client_config.max_send_msg_size", "type": "integer"} + # client_config.call_option.max_send_msg_size -- gRPC client call option max send message size + max_send_msg_size: 0 + # @schema {"name": "client_config.dial_option", "type": "object"} + dial_option: + # @schema {"name": "client_config.dial_option.write_buffer_size", "type": "integer"} + # client_config.dial_option.write_buffer_size -- gRPC client dial option write buffer size + write_buffer_size: 0 + # @schema {"name": "client_config.dial_option.read_buffer_size", "type": "integer"} + # client_config.dial_option.read_buffer_size -- gRPC client dial option read buffer size + read_buffer_size: 0 + # @schema {"name": "client_config.dial_option.initial_window_size", "type": "integer"} + # client_config.dial_option.initial_window_size -- gRPC client dial option initial window size + initial_window_size: 0 + # @schema {"name": "client_config.dial_option.initial_connection_window_size", "type": "integer"} + # client_config.dial_option.initial_connection_window_size -- gRPC client dial option initial connection window size + initial_connection_window_size: 0 + # @schema {"name": "client_config.dial_option.max_msg_size", "type": "integer"} + # client_config.dial_option.max_msg_size -- gRPC client dial option max message size + max_msg_size: 0 + # @schema {"name": "client_config.dial_option.backoff_max_delay", "type": "string"} + # client_config.dial_option.backoff_max_delay -- gRPC client dial option max backoff delay + backoff_max_delay: "120s" + # @schema {"name": "client_config.dial_option.backoff_base_delay", "type": "string"} + # client_config.dial_option.backoff_base_delay -- gRPC client dial option base backoff delay + backoff_base_delay: "1s" + # @schema {"name": "client_config.dial_option.backoff_multiplier", "type": "number"} + # client_config.dial_option.backoff_multiplier -- gRPC client dial option base backoff delay + backoff_multiplier: 1.6 + # @schema {"name": "client_config.dial_option.backoff_jitter", "type": "number"} + # client_config.dial_option.backoff_jitter -- gRPC client dial option base backoff delay + backoff_jitter: 0.2 + # @schema {"name": "client_config.dial_option.min_connection_timeout", "type": "string"} + # client_config.dial_option.min_connection_timeout -- gRPC client dial option minimum connection timeout + min_connection_timeout: "20s" + # @schema {"name": "client_config.dial_option.enable_backoff", "type": "boolean"} + # client_config.dial_option.enable_backoff -- gRPC client dial option backoff enabled + enable_backoff: false + # @schema {"name": "client_config.dial_option.insecure", "type": "boolean"} + # client_config.dial_option.insecure -- gRPC client dial option insecure enabled + insecure: true + # @schema {"name": "client_config.dial_option.timeout", "type": "string"} + # client_config.dial_option.timeout -- gRPC client dial option timeout + timeout: "" + # @schema {"name": "client_config.dial_option.interceptors", "type": "array", "items": {"type": "string", "enum": ["TraceInterceptor"]}} + # client_config.dial_option.interceptors -- gRPC client interceptors + interceptors: [] + # @schema {"name": "client_config.dial_option.net", "type": "object", "anchor": "net"} + net: + # @schema {"name": "client_config.dial_option.net.dns", "type": "object"} + dns: + # @schema {"name": "client_config.dial_option.net.dns.cache_enabled", "type": "boolean"} + # client_config.dial_option.net.dns.cache_enabled -- gRPC client TCP DNS cache enabled + cache_enabled: true + # @schema {"name": "client_config.dial_option.net.dns.refresh_duration", "type": "string"} + # client_config.dial_option.net.dns.refresh_duration -- gRPC client TCP DNS cache refresh duration + refresh_duration: 30m + # @schema {"name": "client_config.dial_option.net.dns.cache_expiration", "type": "string"} + # client_config.dial_option.net.dns.cache_expiration -- gRPC client TCP DNS cache expiration + cache_expiration: 1h + # @schema {"name": "client_config.dial_option.net.dialer", "type": "object"} + dialer: + # @schema {"name": "client_config.dial_option.net.dialer.timeout", "type": "string"} + # client_config.dial_option.net.dialer.timeout -- gRPC client TCP dialer timeout + timeout: "" + # @schema {"name": "client_config.dial_option.net.dialer.keepalive", "type": "string"} + # client_config.dial_option.net.dialer.keepalive -- gRPC client TCP dialer keep alive + keepalive: "" + # @schema {"name": "client_config.dial_option.net.dialer.dual_stack_enabled", "type": "boolean"} + # client_config.dial_option.net.dialer.dual_stack_enabled -- gRPC client TCP dialer dual stack enabled + dual_stack_enabled: true + # @schema {"name": "client_config.dial_option.net.tls", "type": "object"} + tls: + # @schema {"name": "client_config.dial_option.net.tls.enabled", "type": "boolean"} + # client_config.tls.enabled -- TLS enabled + enabled: false + # @schema {"name": "client_config.dial_option.net.tls.cert", "type": "string"} + # client_config.tls.cert -- TLS cert path + cert: /path/to/cert + # @schema {"name": "client_config.dial_option.net.tls.key", "type": "string"} + # client_config.tls.key -- TLS key path + key: /path/to/key + # @schema {"name": "client_config.dial_option.net.tls.ca", "type": "string"} + # client_config.tls.ca -- TLS ca path + ca: /path/to/ca + # @schema {"name": "client_config.dial_option.net.tls.insecure_skip_verify", "type": "boolean"} + # client_config.tls.insecure_skip_verify -- enable/disable skip SSL certificate verification + insecure_skip_verify: false + # @schema {"name": "client_config.dial_option.net.socket_option", "type": "object"} + socket_option: + # @schema {"name": "client_config.dial_option.net.socket_option.reuse_port", "type": "boolean"} + # client_config.dial_option.net.socket_option.reuse_port -- server listen socket option for reuse_port functionality + reuse_port: true + # @schema {"name": "client_config.dial_option.net.socket_option.reuse_addr", "type": "boolean"} + # client_config.dial_option.net.socket_option.reuse_addr -- server listen socket option for reuse_addr functionality + reuse_addr: true + # @schema {"name": "client_config.dial_option.net.socket_option.tcp_fast_open", "type": "boolean"} + # client_config.dial_option.net.socket_option.tcp_fast_open -- server listen socket option for tcp_fast_open functionality + tcp_fast_open: true + # @schema {"name": "client_config.dial_option.net.socket_option.tcp_no_delay", "type": "boolean"} + # client_config.dial_option.net.socket_option.tcp_no_delay -- server listen socket option for tcp_no_delay functionality + tcp_no_delay: true + # @schema {"name": "client_config.dial_option.net.socket_option.tcp_cork", "type": "boolean"} + # client_config.dial_option.net.socket_option.tcp_cork -- server listen socket option for tcp_cork functionality + tcp_cork: false + # @schema {"name": "client_config.dial_option.net.socket_option.tcp_quick_ack", "type": "boolean"} + # client_config.dial_option.net.socket_option.tcp_quick_ack -- server listen socket option for tcp_quick_ack functionality + tcp_quick_ack: true + # @schema {"name": "client_config.dial_option.net.socket_option.tcp_defer_accept", "type": "boolean"} + # client_config.dial_option.net.socket_option.tcp_defer_accept -- server listen socket option for tcp_defer_accept functionality + tcp_defer_accept: true + # @schema {"name": "client_config.dial_option.net.socket_option.ip_transparent", "type": "boolean"} + # client_config.dial_option.net.socket_option.ip_transparent -- server listen socket option for ip_transparent functionality + ip_transparent: false + # @schema {"name": "client_config.dial_option.net.socket_option.ip_recover_destination_addr", "type": "boolean"} + # client_config.dial_option.net.socket_option.ip_recover_destination_addr -- server listen socket option for ip_recover_destination_addr functionality + ip_recover_destination_addr: false + # @schema {"name": "client_config.dial_option.keepalive", "type": "object"} + keepalive: + # @schema {"name": "client_config.dial_option.keepalive.time", "type": "string"} + # client_config.dial_option.keepalive.time -- gRPC client keep alive time + time: "120s" + # @schema {"name": "client_config.dial_option.keepalive.timeout", "type": "string"} + # client_config.dial_option.keepalive.timeout -- gRPC client keep alive timeout + timeout: "30s" + # @schema {"name": "client_config.dial_option.keepalive.permit_without_stream", "type": "boolean"} + # client_config.dial_option.keepalive.permit_without_stream -- gRPC client keep alive permit without stream + permit_without_stream: true + # @schema {"name": "client_config.tls", "type": "object"} + tls: + # @schema {"name": "client_config.tls.enabled", "type": "boolean"} + # client_config.tls.enabled -- TLS enabled + enabled: false + # @schema {"name": "client_config.tls.cert", "type": "string"} + # client_config.tls.cert -- TLS cert path + cert: /path/to/cert + # @schema {"name": "client_config.tls.key", "type": "string"} + # client_config.tls.key -- TLS key path + key: /path/to/key + # @schema {"name": "client_config.tls.ca", "type": "string"} + # client_config.tls.ca -- TLS ca path + ca: /path/to/ca + # @schema {"name": "client_config.tls.insecure_skip_verify", "type": "boolean"} + # client_config.tls.insecure_skip_verify -- enable/disable skip SSL certificate verification + insecure_skip_verify: false +# @schema {"name": "rules", "type": "array", "items": {"type": "string"}} +# rules -- executing rule +rules: [] +# @schema {"name": "rps", "type": "integer", "minimum": 0, "maximum": 65535} +# rps -- desired request per sec +rps: 1000 diff --git a/charts/vald-benchmark-operator/schemas/scenario-values.yaml b/charts/vald-benchmark-operator/schemas/scenario-values.yaml new file mode 100644 index 0000000000..dedc6b51b5 --- /dev/null +++ b/charts/vald-benchmark-operator/schemas/scenario-values.yaml @@ -0,0 +1,169 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# + +# @schema {"name": "target", "type": "object", "required": ["host", "port"]} +# target -- target cluster location +target: + # @schema {"name": "target.host", "type": "string", "minLength": 1} + # target.host -- target cluster host + host: + "vald-lb-gateway.default.svc.cluster.local" + # @schema {"name": "target.port", "type": "integer", "minimum": 0, "maximum": 65535} + # target.port -- target cluster port + port: 8081 + +# @schema {"name": "dataset", "type": "object", "required": ["name", "indexes", "group", "range"]} +# dataset -- dataset information +dataset: + # @schema {"name": "dataset.name", "type": "string", "enum": ["fashion-mnist"] } + # dataset.name -- the name of dataset + name: "fashion-mnist" + # @schema {"name": "dataset.indexes", "type": "integer", "minimum": 0} + # dataset.indexes -- the amount of indexes + indexes: 1000 + # @schema {"name": "dataset.group", "type": "string", "minLength": 1} + # dataset.group -- the hdf5 group name of dataset + group: "test" + # @schema {"name": "dataset.range", "type": "object", "range": ["start", "port"]} + # dataset.range -- the data range of indexes + range: + # @schema {"name": "dataset.range.start", "type": "integer", "minimum": 1} + # dataset.range.start -- start index number + start: 1 + # @schema {"name": "dataset.range.end", "type": "integer", "minimum": 1} + # dataset.range.end -- end index number + end: 1000 + +# @schema {"name": "jobs", "type": "array", "items": {"type": "object"}} +jobs: + - target: + host: "vald-lb-gateway.default.svc.cluster.local" + port: 8081 + dataset: + name: "fashion-mnist" + indexes: 1000 + group: "test" + range: + start: 1 + end: 1000 + dimension: 784 + replica: 1 + repetition: 1 + job_type: "search" + insert_config: + skip_strict_exist_check: false + timestamp: "" + update_config: + skip_strict_exist_check: false + timestamp: "" + disable_balance_update: false + upsert_config: + skip_strict_exist_check: false + timestamp: "" + disable_balance_update: false + search_config: + epsilon: 0.1 + radius: -1 + num: 10 + min_num: 10 + timeout: "10s" + remove_config: + skip_strict_exist_check: false + timestamp: "" + object_config: + filter_config: + host: 0.0.0.0 + port: 8081 + client_config: + addrs: [] + health_check_duration: "1s" + connection_pool: + enable_dns_resolver: true + enable_rebalance: true + rebalance_duration: 30m + size: 3 + old_conn_close_duration: "2m" + backoff: + initial_duration: 5ms + backoff_time_limit: 5s + maximum_duration: 5s + jitter_limit: 100ms + backoff_factor: 1.1 + retry_count: 100 + enable_error_log: true + circuit_breaker: + closed_error_rate: 0.7 + half_open_error_rate: 0.5 + min_samples: 1000 + open_timeout: "1s" + closed_refresh_timeout: "10s" + call_option: + wait_for_ready: true + max_retry_rpc_buffer_size: 0 + max_recv_msg_size: 0 + max_send_msg_size: 0 + dial_option: + write_buffer_size: 0 + read_buffer_size: 0 + initial_window_size: 0 + initial_connection_window_size: 0 + max_msg_size: 0 + backoff_max_delay: "120s" + backoff_base_delay: "1s" + backoff_multiplier: 1.6 + backoff_jitter: 0.2 + min_connection_timeout: "20s" + enable_backoff: false + insecure: true + timeout: "" + interceptors: [] + net: + dns: + cache_enabled: true + refresh_duration: 30m + cache_expiration: 1h + dialer: + timeout: "" + keepalive: "" + dual_stack_enabled: true + tls: + enabled: false + cert: /path/to/cert + key: /path/to/key + ca: /path/to/ca + insecure_skip_verify: false + socket_option: + reuse_port: true + reuse_addr: true + tcp_fast_open: true + tcp_no_delay: true + tcp_cork: false + tcp_quick_ack: true + tcp_defer_accept: true + ip_transparent: false + ip_recover_destination_addr: false + keepalive: + time: "120s" + timeout: "30s" + permit_without_stream: true + tls: + enabled: false + cert: /path/to/cert + key: /path/to/key + ca: /path/to/ca + insecure_skip_verify: false + rules: [] + rps: 1000 diff --git a/charts/vald-benchmark-operator/templates/NOTES.txt b/charts/vald-benchmark-operator/templates/NOTES.txt new file mode 100644 index 0000000000..8dff4bbfb1 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/NOTES.txt @@ -0,0 +1 @@ +Release {{ .Release.Name }} is created. diff --git a/charts/vald-benchmark-operator/templates/_helpers.tpl b/charts/vald-benchmark-operator/templates/_helpers.tpl new file mode 100644 index 0000000000..42ae6d7c72 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/_helpers.tpl @@ -0,0 +1,310 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "vald.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "vald.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "vald.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "vald.labels" -}} +app.kubernetes.io/name: {{ include "vald.name" . }} +helm.sh/chart: {{ include "vald.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +joinListWithSpace +*/}} +{{- define "vald.utils.joinListWithSpace" -}} +{{- $local := dict "first" true -}} +{{- range $k, $v := . -}}{{- if not $local.first -}}{{- " " -}}{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}} +{{- end -}} + +{{/* +joinListWithComma +*/}} +{{- define "vald.utils.joinListWithComma" -}} +{{- $local := dict "first" true -}} +{{- range $k, $v := . -}}{{- if not $local.first -}},{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}} +{{- end -}} + +{{/* +logging settings +*/}} +{{- define "vald.logging"}} +{{- if .Values -}} +logger: {{ .Values.logger | quote }} +level: {{ .Values.level | quote }} +format: {{ .Values.format | quote }} +{{- end }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "vald.selectorLabels" -}} +app.kubernetes.io/name: {{ include "vald.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "vald.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "vald.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end -}} + +{{/* +Server configures that inserted into server_config +*/}} +{{- define "vald.servers" -}} +servers: + {{- $restEnabled := false }} + {{- if hasKey .Values.servers.rest "enabled" }} + {{- $restEnabled = .Values.servers.rest.enabled }} + {{- end }} + {{- if $restEnabled }} + - name: rest + host: {{ .Values.servers.rest.host }} + port: {{ .Values.servers.rest.port }} + {{- if .Values.servers.rest.server }} + mode: {{ .Values.servers.rest.server.mode }} + probe_wait_time: {{ .Values.servers.rest.server.probe_wait_time }} + network: {{ .Values.servers.rest.server.network | quote }} + socket_path: {{ .Values.servers.rest.server.socket_path | quote }} + http: + {{- if .Values.servers.rest.server.http }} + shutdown_duration: {{ .Values.servers.rest.server.http.shutdown_duration }} + handler_timeout: {{.Values.servers.rest.server.http.handler_timeout }} + idle_timeout: {{ .Values.servers.rest.server.http.idle_timeout }} + read_header_timeout: {{ .Values.servers.rest.server.http.read_header_timeout }} + read_timeout: {{ .Values.servers.rest.server.http.read_timeout }} + write_timeout: {{ .Values.servers.rest.server.http.write_timeout }} + {{- end }} + {{- end }} + {{- end }} + {{- $grpcEnabled := false }} + {{- if hasKey .Values.servers.grpc "enabled" }} + {{- $grpcEnabled = .Values.servers.grpc.enabled }} + {{- end }} + {{- if $grpcEnabled }} + - name: grpc + host: {{ .Values.servers.grpc.host }} + port: {{ .Values.servers.grpc.port }} + {{- if .Values.servers.grpc.server }} + mode: {{ .Values.servers.grpc.server.mode }} + probe_wait_time: {{ .Values.servers.grpc.server.probe_wait_time | quote }} + network: {{ .Values.servers.grpc.server.network | quote }} + socket_path: {{ .Values.servers.grpc.server.socket_path | quote }} + grpc: + {{- if .Values.servers.grpc.server.grpc }} + bidirectional_stream_concurrency: {{ .Values.servers.grpc.server.grpc.bidirectional_stream_concurrency }} + connection_timeout: {{ .Values.servers.grpc.server.grpc.connection_timeout | quote }} + max_receive_message_size: {{ .Values.servers.grpc.server.grpc.max_receive_message_size }} + max_send_message_size: {{ .Values.servers.grpc.server.grpc.max_send_message_size }} + initial_window_size: {{ .Values.servers.grpc.server.grpc.initial_window_size }} + initial_conn_window_size: {{ .Values.servers.grpc.server.grpc.initial_conn_window_size }} + keepalive: + {{- if .Values.servers.grpc.server.grpc.keepalive }} + max_conn_idle: {{ .Values.servers.grpc.server.grpc.keepalive.max_conn_idle | quote }} + max_conn_age: {{ .Values.servers.grpc.server.grpc.keepalive.max_conn_age | quote }} + max_conn_age_grace: {{ .Values.servers.grpc.server.grpc.keepalive.max_conn_age_grace | quote }} + time: {{ .Values.servers.grpc.server.grpc.keepalive.time | quote }} + timeout: {{ .Values.servers.grpc.server.grpc.keepalive.timeout | quote }} + min_time: {{ .Values.servers.grpc.server.grpc.keepalive.min_time | quote }} + permit_without_stream: {{ .Values.servers.grpc.server.grpc.keepalive.permit_without_stream }} + {{- end }} + write_buffer_size: {{ .Values.servers.grpc.server.grpc.write_buffer_size }} + read_buffer_size: {{ .Values.servers.grpc.server.grpc.read_buffer_size }} + max_header_list_size: {{ .Values.servers.grpc.server.grpc.max_header_list_size }} + header_table_size: {{ .Values.servers.grpc.server.grpc.header_table_size }} + {{- if .Values.servers.grpc.server.grpc.interceptors }} + interceptors: + {{- toYaml .Values.servers.grpc.server.grpc.interceptors | nindent 8 }} + {{- else }} + interceptors: [] + {{- end }} + enable_reflection: {{ .Values.servers.grpc.server.grpc.enable_reflection }} + {{- end }} + restart: {{ .Values.servers.grpc.server.restart }} + {{- end }} + {{- end }} +health_check_servers: + {{- $livenessEnabled := false }} + {{- if hasKey .Values.healths.liveness "enabled" }} + {{- $livenessEnabled = .Values.healths.liveness.enabled }} + {{- end }} + {{- if $livenessEnabled }} + - name: liveness + host: {{ .Values.healths.liveness.host }} + port: {{ .Values.healths.liveness.port }} + {{- if .Values.healths.liveness.server }} + mode: {{ .Values.healths.liveness.server.mode | quote }} + probe_wait_time: {{ .Values.healths.liveness.server.probe_wait_time | quote }} + network: {{ .Values.healths.liveness.server.network | quote }} + socket_path: {{ .Values.healths.liveness.server.socket_path | quote }} + http: + {{- if .Values.healths.liveness.server.http }} + shutdown_duration: {{ .Values.healths.liveness.server.http.shutdown_duration | quote }} + handler_timeout: {{ .Values.healths.liveness.server.http.handler_timeout | quote }} + idle_timeout: {{ .Values.healths.liveness.server.http.idle_timeout | quote }} + read_header_timeout: {{ .Values.healths.liveness.server.http.read_header_timeout | quote }} + read_timeout: {{ .Values.healths.liveness.server.http.read_timeout | quote }} + write_timeout: {{ .Values.healths.liveness.server.http.write_timeout | quote }} + {{- end }} + {{- end }} + {{- end }} + {{- $readinessEnabled := false }} + {{- if hasKey .Values.healths.readiness "enabled" }} + {{- $readinessEnabled = .Values.healths.readiness.enabled }} + {{- end }} + {{- if $readinessEnabled }} + - name: readiness + host: {{ .Values.healths.readiness.host }} + port: {{ .Values.healths.readiness.port }} + {{- if .Values.healths.readiness.server }} + mode: {{ .Values.healths.readiness.server.mode | quote }} + probe_wait_time: {{ .Values.healths.readiness.server.probe_wait_time | quote }} + network: {{ .Values.healths.readiness.server.network | quote }} + socket_path: {{ .Values.healths.readiness.server.socket_path | quote }} + http: + {{- if .Values.healths.readiness.server.http }} + shutdown_duration: {{ .Values.healths.readiness.server.http.shutdown_duration | quote }} + handler_timeout: {{ .Values.healths.readiness.server.http.handler_timeout | quote }} + idle_timeout: {{ .Values.healths.readiness.server.http.idle_timeout | quote }} + read_header_timeout: {{ .Values.healths.readiness.server.http.read_header_timeout | quote }} + read_timeout: {{ .Values.healths.readiness.server.http.read_timeout | quote }} + write_timeout: {{ .Values.healths.readiness.server.http.write_timeout | quote }} + {{- end }} + {{- end }} + {{- end }} +metrics_servers: + {{- $pprofEnabled := false }} + {{- if hasKey .Values.metrics.pprof "enabled" }} + {{- $pprofEnabled = .Values.metrics.pprof.enabled }} + {{- end }} + {{- if $pprofEnabled }} + - name: pprof + host: {{ .Values.metrics.pprof.host }} + port: {{ .Values.metrics.pprof.port }} + {{- if .Values.metrics.pprof.server }} + mode: {{ .Values.metrics.pprof.server.mode }} + probe_wait_time: {{ .Values.metrics.pprof.server.probe_wait_time }} + network: {{ .Values.metrics.pprof.server.network | quote }} + socket_path: {{ .Values.metrics.pprof.server.socket_path | quote }} + http: + {{- if .Values.metrics.pprof.server.http }} + shutdown_duration: {{ .Values.metrics.pprof.server.http.shutdown_duration }} + handler_timeout: {{ .Values.metrics.pprof.server.http.handler_timeout }} + idle_timeout: {{ .Values.metrics.pprof.server.http.idle_timeout }} + read_header_timeout: {{ .Values.metrics.pprof.server.http.read_header_timeout }} + read_timeout: {{ .Values.metrics.pprof.server.http.read_timeout }} + write_timeout: {{ .Values.metrics.pprof.server.http.write_timeout }} + {{- end }} + {{- end }} + {{- end }} +startup_strategy: + {{- if $livenessEnabled }} + - liveness + {{- end }} + {{- if $pprofEnabled }} + - pprof + {{- end }} + {{- if $grpcEnabled }} + - grpc + {{- end }} + {{- if $restEnabled }} + - rest + {{- end }} + {{- if $readinessEnabled }} + - readiness + {{- end }} +full_shutdown_duration: {{ .Values.full_shutdown_duration }} +tls: + {{- if .Values.tls }} + enabled: {{ .Values.tls.enabled }} + cert: {{ .Values.tls.cert | quote }} + key: {{ .Values.tls.key | quote }} + ca: {{ .Values.tls.ca | quote }} + insecure_skip_verify: {{ .Values.tls.insecure_skip_verify }} + {{- end }} +{{- end -}} + +{{/* +observability +*/}} +{{- define "vald.observability" -}} +enabled: {{ .Values.enabled }} +otlp: + {{- if .Values.otlp }} + collector_endpoint: {{ .Values.otlp.collector_endpoint | quote }} + trace_batch_timeout: {{ .Values.otlp.trace_batch_timeout | quote }} + trace_export_timeout: {{ .Values.otlp.trace_export_timeout | quote }} + trace_max_export_batch_size: {{ .Values.otlp.trace_max_export_batch_size }} + trace_max_queue_size: {{ .Values.otlp.trace_max_queue_size }} + metrics_export_interval: {{ .Values.otlp.metrics_export_interval | quote }} + metrics_export_timeout: {{ .Values.otlp.metrics_export_timeout | quote }} + attribute: + {{- if .Values.otlp.attribute }} + namespace: {{ .Values.otlp.attribute.namespace | quote }} + pod_name: {{ .Values.otlp.attribute.pod_name | quote }} + node_name: {{ .Values.otlp.attribute.node_name | quote }} + service_name: {{ .Values.otlp.attribute.service_name | quote }} + {{- end }} + {{- end }} +metrics: + {{- if .Values.metrics }} + enable_version_info: {{ .Values.metrics.enable_version_info }} + {{- if .Values.metrics.version_info_labels }} + version_info_labels: + {{- toYaml .Values.metrics.version_info_labels | nindent 4 }} + {{- else }} + version_info_labels: [] + {{- end }} + enable_memory: {{ .Values.metrics.enable_memory }} + enable_goroutine: {{ .Values.metrics.enable_goroutine }} + enable_cgo: {{ .Values.metrics.enable_cgo }} + {{- end }} +trace: + {{- if .Values.trace }} + enabled: {{ .Values.trace.enabled }} + sampling_rate: {{ .Values.trace.sampling_rate }} + {{- end }} +{{- end -}} + diff --git a/charts/vald-benchmark-operator/templates/clusterrole.yaml b/charts/vald-benchmark-operator/templates/clusterrole.yaml new file mode 100644 index 0000000000..63fc0c6812 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/clusterrole.yaml @@ -0,0 +1,115 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + creationTimestamp: null + name: {{ .Values.rbac.name }} + namespace: {{ .Release.Namespace }} +rules: + - apiGroups: + - apps + resources: + - deployments + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - batch + resources: + - jobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - vald.vdaas.org + resources: + - valdbenchmarkscenarios + - valdbenchmarkscenario + - valdbenchmarkjob + - valdbenchmarkjobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - vald.vdaas.org + resources: + - valdbenchmarkscenarios/finalizers + - valdbenchmarkscenario/finalizers + - valdbenchmarkjob/finalizers + - valdbenchmarkjobs/finalizers + verbs: + - update + - apiGroups: + - vald.vdaas.org + resources: + - valdbenchmarkscenario/status + - valdbenchmarkscenarios/status + - valdbenchmarkjob/status + - valdbenchmarkjobs/status + verbs: + - get + - patch + - update + - apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + resources: + - events + verbs: + - create + - patch + - update + - apiGroups: + - "" + resources: + - services + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +{{- end }} diff --git a/charts/vald-benchmark-operator/templates/clusterrolebinding.yaml b/charts/vald-benchmark-operator/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..5130f14292 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/clusterrolebinding.yaml @@ -0,0 +1,30 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +{{- if .Values.rbac.create }} +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.serviceAccount.name }} + namespace: {{ .Release.Namespace }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceAccount.name }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.rbac.name }} + apiGroup: rbac.authorization.k8s.io +{{- end }} diff --git a/charts/vald-benchmark-operator/templates/configmap.yaml b/charts/vald-benchmark-operator/templates/configmap.yaml new file mode 100644 index 0000000000..ceb92f2b55 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/configmap.yaml @@ -0,0 +1,40 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.name }}-config + labels: + app.kubernetes.io/name: {{ include "vald.name" . }} + helm.sh/chart: {{ include "vald.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.Version }} + app.kubernetes.io/component: benchmark-operator +data: + config.yaml: | + --- + version: {{ .Values.version }} + time_zone: {{ .Values.time_zone | quote }} + logging: + {{- $logging := dict "Values" .Values.logging }} + {{- include "vald.logging" $logging | nindent 6 }} + server_config: + {{- $servers := dict "Values" .Values.server_config }} + {{- include "vald.servers" $servers | nindent 6 }} + observability: + {{- $observability := dict "Values" .Values.observability}} + {{- include "vald.observability" $observability | nindent 6 }} diff --git a/charts/vald-benchmark-operator/templates/deployment.yaml b/charts/vald-benchmark-operator/templates/deployment.yaml new file mode 100644 index 0000000000..bff799a214 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/deployment.yaml @@ -0,0 +1,152 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.name }} + app.kubernetes.io/name: {{ include "vald.name" . }} + helm.sh/chart: {{ include "vald.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.Version }} + app.kubernetes.io/component: benchmark-operator + {{- if .Values.annotations }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + name: {{ .Values.name }} + template: + metadata: + labels: + name: {{ .Values.name }} + app.kubernetes.io/name: {{ include "vald.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: benchmark-operator + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.serviceAccount.name }} + containers: + - name: {{ .Values.name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- $liveness := .Values.server_config.healths.liveness }} + {{- if $liveness.enabled }} + livenessProbe: + failureThreshold: {{ $liveness.livenessProbe.failureThreshold }} + httpGet: + path: {{ $liveness.livenessProbe.httpGet.path }} + port: {{ $liveness.livenessProbe.httpGet.port }} + scheme: {{ $liveness.livenessProbe.httpGet.scheme }} + initialDelaySeconds: {{ $liveness.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ $liveness.livenessProbe.periodSeconds }} + successThreshold: {{ $liveness.livenessProbe.successThreshold }} + timeoutSeconds: {{ $liveness.livenessProbe.timeoutSeconds }} + {{- end}} + {{- $readiness := .Values.server_config.healths.readiness }} + {{- if $readiness.enabled }} + readinessProbe: + failureThreshold: {{ $readiness.readinessProbe.failureThreshold }} + httpGet: + path: {{ $readiness.readinessProbe.httpGet.path }} + port: {{ $readiness.readinessProbe.httpGet.port }} + scheme: {{ $readiness.readinessProbe.httpGet.scheme }} + initialDelaySeconds: {{ $readiness.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ $readiness.readinessProbe.periodSeconds }} + successThreshold: {{ $readiness.readinessProbe.successThreshold }} + timeoutSeconds: {{ $readiness.readinessProbe.timeoutSeconds }} + {{- end}} + {{- $startup := .Values.server_config.healths.startup }} + {{- if $startup.enabled }} + startupProbe: + failureThreshold: {{ $startup.startupProbe.failureThreshold }} + httpGet: + path: {{ $startup.startupProbe.httpGet.path }} + port: {{ $startup.startupProbe.httpGet.port }} + scheme: {{ $startup.startupProbe.httpGet.scheme }} + initialDelaySeconds: {{ $startup.startupProbe.initialDelaySeconds }} + periodSeconds: {{ $startup.startupProbe.periodSeconds }} + successThreshold: {{ $startup.startupProbe.successThreshold }} + timeoutSeconds: {{ $startup.startupProbe.timeoutSeconds }} + {{- end}} + ports: + {{- if $liveness.enabled }} + - name: liveness + protocol: TCP + containerPort: {{ $liveness.port }} + {{- end}} + {{- if $readiness.enabled }} + - name: readiness + protocol: TCP + containerPort: {{ $readiness.port }} + {{- end}} + - name: grpc + protocol: TCP + containerPort: {{ default 8081 .Values.grpc }} + - name: pprof + protocol: TCP + containerPort: {{ default 6060 .Values.pprof }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: {{ .Values.name }}-config + mountPath: /etc/server + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + restartPolicy: Always + volumes: + - name: {{ .Values.name }}-config + configMap: + defaultMode: 420 + name: {{ .Values.name }}-config + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + + {{- if .Values.nodeName }} + nodeName: {{ .Values.nodeName }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: + {{- toYaml .Values.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + {{- end }} + {{- if .Values.podPriority }} + {{- if .Values.podPriority.enabled }} + priorityClassName: {{ .Release.Namespace }}-{{ .Values.name }}-priority + {{- end }} + {{- end }} diff --git a/charts/vald-benchmark-operator/templates/service.yaml b/charts/vald-benchmark-operator/templates/service.yaml new file mode 100644 index 0000000000..0be6a1a882 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/service.yaml @@ -0,0 +1,51 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +{{- if .Values.service.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.name }} + {{- if .Values.service.annotations }} + annotations: + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} + labels: + app.kubernetes.io/name: {{ include "vald.name" . }} + helm.sh/chart: {{ include "vald.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.Version }} + app.kubernetes.io/component: helm-operator + {{- if .Values.service.labels }} + {{- toYaml .Values.service.labels | nindent 4 }} + {{- end }} +spec: + ports: + - name: prometheus + port: {{ .Values.server_config.metrics.pprof.port }} + targetPort: {{ .Values.server_config.metrics.pprof.port }} + protocol: TCP + selector: + app.kubernetes.io/name: {{ include "vald.name" . }} + app.kubernetes.io/component: helm-operator + {{- if eq .Values.service.type "ClusterIP" }} + clusterIP: None + {{- end }} + type: {{ .Values.service.type }} + {{- if .Values.service.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} + {{- end }} +{{- end }} diff --git a/charts/vald-benchmark-operator/templates/serviceaccount.yaml b/charts/vald-benchmark-operator/templates/serviceaccount.yaml new file mode 100644 index 0000000000..f07cdf57b9 --- /dev/null +++ b/charts/vald-benchmark-operator/templates/serviceaccount.yaml @@ -0,0 +1,22 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceAccount.name }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/vald-benchmark-operator/values.schema.json b/charts/vald-benchmark-operator/values.schema.json index 0764934803..6ed6f1764f 100644 --- a/charts/vald-benchmark-operator/values.schema.json +++ b/charts/vald-benchmark-operator/values.schema.json @@ -3,261 +3,502 @@ "title": "Values", "type": "object", "properties": { - "client_config": { + "affinity": { "type": "object", "description": "affinity" }, + "annotations": { + "type": "object", + "description": "deployment annotations" + }, + "image": { "type": "object", "properties": { - "addrs": { - "type": "array", - "description": "gRPC client addresses", - "items": { "type": "string" } + "pullPolicy": { + "type": "string", + "description": "image pull policy", + "enum": ["Always", "Never", "IfNotPresent"] }, - "backoff": { - "type": "object", - "properties": { - "backoff_factor": { - "type": "number", - "description": "gRPC client backoff factor" - }, - "backoff_time_limit": { - "type": "string", - "description": "gRPC client backoff time limit" - }, - "enable_error_log": { - "type": "boolean", - "description": "gRPC client backoff log enabled" - }, - "initial_duration": { - "type": "string", - "description": "gRPC client backoff initial duration" - }, - "jitter_limit": { - "type": "string", - "description": "gRPC client backoff jitter limit" - }, - "maximum_duration": { - "type": "string", - "description": "gRPC client backoff maximum duration" - }, - "retry_count": { - "type": "integer", - "description": "gRPC client backoff retry count" - } - } + "repository": { "type": "string", "description": "image repository" }, + "tag": { "type": "string", "description": "image tag" } + } + }, + "logging": { + "type": "object", + "properties": { + "format": { + "type": "string", + "description": "logging format. logging format must be `raw` or `json`", + "enum": ["raw", "json"] }, - "call_option": { "type": "object" }, - "circuit_breaker": { + "level": { + "type": "string", + "description": "logging level. logging level must be `debug`, `info`, `warn`, `error` or `fatal`.", + "enum": ["debug", "info", "warn", "error", "fatal"] + }, + "logger": { + "type": "string", + "description": "logger name. currently logger must be `glg` or `zap`.", + "enum": ["glg", "zap"] + } + } + }, + "name": { "type": "string", "description": "name of the deployment" }, + "nodeSelector": { + "type": "object", + "description": "node labels for pod assignment" + }, + "observability": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" }, + "otlp": { "type": "object", "properties": { - "closed_error_rate": { - "type": "number", - "description": "gRPC client circuitbreaker closed error rate" - }, - "closed_refresh_timeout": { - "type": "string", - "description": "gRPC client circuitbreaker closed refresh timeout" - }, - "half_open_error_rate": { - "type": "number", - "description": "gRPC client circuitbreaker half-open error rate" - }, - "min_samples": { - "type": "integer", - "description": "gRPC client circuitbreaker minimum sampling count" + "attribute": { + "type": "object", + "properties": { + "metrics": { + "type": "object", + "properties": { + "enable_cgo": { "type": "boolean" }, + "enable_goroutine": { "type": "boolean" }, + "enable_memory": { "type": "boolean" }, + "enable_version_info": { "type": "boolean" }, + "version_info_labels": { + "type": "array", + "items": { "type": "string" } + } + } + }, + "namespace": { "type": "string" }, + "node_name": { "type": "string" }, + "pod_name": { "type": "string" }, + "service_name": { "type": "string" } + } }, - "open_timeout": { - "type": "string", - "description": "gRPC client circuitbreaker open timeout" - } + "collector_endpoint": { "type": "string" }, + "metrics_export_interval": { "type": "string" }, + "metrics_export_timeout": { "type": "string" }, + "trace_batch_timeout": { "type": "string" }, + "trace_export_timeout": { "type": "string" }, + "trace_max_export_batch_size": { "type": "integer" }, + "trace_max_queue_size": { "type": "integer" } } }, - "connection_pool": { + "trace": { "type": "object", "properties": { - "enable_dns_resolver": { - "type": "boolean", - "description": "enables gRPC client connection pool dns resolver, when enabled vald uses ip handshake exclude dns discovery which improves network performance" - }, - "enable_rebalance": { - "type": "boolean", - "description": "enables gRPC client connection pool rebalance" - }, - "old_conn_close_duration": { - "type": "string", - "description": "makes delay before gRPC client connection closing during connection pool rebalance" - }, - "rebalance_duration": { - "type": "string", - "description": "gRPC client connection pool rebalance duration" - }, - "size": { - "type": "integer", - "description": "gRPC client connection pool size" - } + "enabled": { "type": "boolean" }, + "sampling_rate": { "type": "integer" } } + } + } + }, + "podAnnotations": { "type": "object", "description": "pod annotations" }, + "podSecurityContext": { + "type": "object", + "description": "security context for pod" + }, + "rbac": { + "type": "object", + "properties": { + "create": { + "type": "boolean", + "description": "required roles and rolebindings will be created" }, - "dial_option": { + "name": { + "type": "string", + "description": "name of roles and rolebindings" + } + } + }, + "replicas": { + "type": "integer", + "description": "the number of replica for deployment" + }, + "resources": { + "type": "object", + "description": "kubernetes resources of pod", + "properties": { + "limits": { "type": "object" }, + "requests": { "type": "object" } + } + }, + "securityContext": { + "type": "object", + "description": "security context for container" + }, + "server_config": { + "type": "object", + "properties": { + "full_shutdown_duration": { "type": "string" }, + "healths": { "type": "object", "properties": { - "backoff_base_delay": { - "type": "string", - "description": "gRPC client dial option base backoff delay" - }, - "backoff_jitter": { - "type": "number", - "description": "gRPC client dial option base backoff delay" - }, - "backoff_max_delay": { - "type": "string", - "description": "gRPC client dial option max backoff delay" - }, - "backoff_multiplier": { - "type": "number", - "description": "gRPC client dial option base backoff delay" - }, - "enable_backoff": { - "type": "boolean", - "description": "gRPC client dial option backoff enabled" - }, - "initial_connection_window_size": { - "type": "integer", - "description": "gRPC client dial option initial connection window size" - }, - "initial_window_size": { - "type": "integer", - "description": "gRPC client dial option initial window size" - }, - "insecure": { - "type": "boolean", - "description": "gRPC client dial option insecure enabled" - }, - "interceptors": { - "type": "array", - "description": "gRPC client interceptors", - "items": { "type": "string", "enum": ["TraceInterceptor"] } - }, - "keepalive": { + "liveness": { "type": "object", "properties": { - "permit_without_stream": { - "type": "boolean", - "description": "gRPC client keep alive permit without stream" + "enabled": { "type": "boolean" }, + "host": { "type": "string" }, + "livenessProbe": { + "type": "object", + "properties": { + "failureThreshold": { + "type": "integer", + "description": "liveness probe failure threshold" + }, + "httpGet": { + "type": "object", + "properties": { + "path": { + "type": "string", + "description": "readiness probe path" + }, + "port": { + "type": "string", + "description": "readiness probe port" + }, + "scheme": { + "type": "string", + "description": "readiness probe scheme" + } + } + }, + "initialDelaySeconds": { + "type": "integer", + "description": "liveness probe initial delay seconds" + }, + "periodSeconds": { + "type": "integer", + "description": "liveness probe period seconds" + }, + "successThreshold": { + "type": "integer", + "description": "liveness probe success threshold" + }, + "timeoutSeconds": { + "type": "integer", + "description": "liveness probe timeout seconds" + } + } }, - "time": { - "type": "string", - "description": "gRPC client keep alive time" + "port": { "type": "integer" }, + "server": { + "type": "object", + "properties": { + "http": { + "type": "object", + "properties": { + "idle_timeout": { "type": "string" }, + "read_header_timeout": { "type": "string" }, + "read_timeout": { "type": "string" }, + "shutdown_duration": { "type": "string" }, + "timeout": { "type": "string" }, + "write_timeout": { "type": "string" } + } + }, + "mode": { "type": "string" }, + "network": { "type": "string" }, + "probe_wait_time": { "type": "string" }, + "socket_path": { "type": "string" } + } }, - "timeout": { - "type": "string", - "description": "gRPC client keep alive timeout" - } + "servicePort": { "type": "integer" } } }, - "max_msg_size": { - "type": "integer", - "description": "gRPC client dial option max message size" + "readiness": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" }, + "host": { "type": "string" }, + "port": { "type": "integer" }, + "readinessProbe": { + "type": "object", + "properties": { + "failureThreshold": { + "type": "integer", + "description": "readiness probe failure threshold" + }, + "httpGet": { + "type": "object", + "properties": { + "path": { + "type": "string", + "description": "readiness probe path" + }, + "port": { + "type": "string", + "description": "readiness probe port" + }, + "scheme": { + "type": "string", + "description": "readiness probe scheme" + } + } + }, + "initialDelaySeconds": { + "type": "integer", + "description": "readiness probe initial delay seconds" + }, + "periodSeconds": { + "type": "integer", + "description": "readiness probe period seconds" + }, + "successThreshold": { + "type": "integer", + "description": "readiness probe success threshold" + }, + "timeoutSeconds": { + "type": "integer", + "description": "readiness probe timeout seconds" + } + } + }, + "server": { + "type": "object", + "properties": { + "http": { + "type": "object", + "properties": { + "handler_timeout": { "type": "string" }, + "idle_timeout": { "type": "string" }, + "read_header_timeout": { "type": "string" }, + "read_timeout": { "type": "string" }, + "shutdown_duration": { "type": "string" }, + "write_timeout": { "type": "string" } + } + }, + "mode": { "type": "string" }, + "network": { "type": "string" }, + "probe_wait_time": { "type": "string" }, + "socket_path": { "type": "string" } + } + }, + "servicePort": { "type": "integer" } + } }, - "min_connection_timeout": { - "type": "string", - "description": "gRPC client dial option minimum connection timeout" + "startup": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "enable startup probe." + } + } }, - "net": { + "startupProbe": { "type": "object", "properties": { - "dialer": { + "failureThreshold": { + "type": "integer", + "description": "startupProbe probe failure threshold" + }, + "httpGet": { "type": "object", "properties": { - "dual_stack_enabled": { - "type": "boolean", - "description": "gRPC client TCP dialer dual stack enabled" + "path": { + "type": "string", + "description": "startup probe path" }, - "keepalive": { + "port": { "type": "string", - "description": "gRPC client TCP dialer keep alive" + "description": "startup probe port" }, - "timeout": { + "scheme": { "type": "string", - "description": "gRPC client TCP dialer timeout" + "description": "startup probe scheme" } } }, - "dns": { + "initialDelaySeconds": { + "type": "integer", + "description": "startup probe initial delay seconds" + }, + "periodSeconds": { + "type": "integer", + "description": "startup probe period seconds" + }, + "successThreshold": { + "type": "integer", + "description": "startup probe success threshold" + }, + "timeoutSeconds": { + "type": "integer", + "description": "startup probe timeout seconds" + } + } + } + } + }, + "metrics": { + "type": "object", + "properties": { + "pprof": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" }, + "host": { "type": "string" }, + "port": { "type": "integer" }, + "server": { "type": "object", "properties": { - "cache_enabled": { - "type": "boolean", - "description": "gRPC client TCP DNS cache enabled" + "http": { + "type": "object", + "properties": { + "handler_timeout": { "type": "string" }, + "idle_timeout": { "type": "string" }, + "read_header_timeout": { "type": "string" }, + "read_timeout": { "type": "string" }, + "shutdown_duration": { "type": "string" }, + "write_timeout": { "type": "string" } + } }, - "cache_expiration": { - "type": "string", - "description": "gRPC client TCP DNS cache expiration" + "mode": { "type": "string" }, + "network": { "type": "string" }, + "probe_wait_time": { "type": "string" }, + "socket_path": { "type": "string" } + } + } + } + } + } + }, + "servers": { + "type": "object", + "properties": { + "grpc": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" }, + "host": { "type": "string" }, + "name": { "type": "string" }, + "port": { "type": "integer" }, + "server": { + "type": "object", + "properties": { + "grpc": { + "type": "object", + "properties": { + "bidirectional_stream_concurrency": { + "type": "integer" + }, + "connection_timeout": { "type": "string" }, + "enable_reflection": { "type": "boolean" }, + "header_table_size": { "type": "integer" }, + "initial_conn_window_size": { "type": "integer" }, + "initial_window_size": { "type": "integer" }, + "interceptors": { + "type": "array", + "items": { "type": "string" } + }, + "keepalive": { + "type": "object", + "properties": { + "max_conn_age": { + "type": "string", + "description": "gRPC server keep alive max connection age" + }, + "max_conn_age_grace": { + "type": "string", + "description": "gRPC server keep alive max connection age grace" + }, + "max_conn_idle": { + "type": "string", + "description": "gRPC server keep alive max connection idle" + }, + "min_time": { + "type": "string", + "description": "gRPC server keep alive min_time" + }, + "permit_without_stream": { + "type": "boolean", + "description": "gRPC server keep alive permit_without_stream" + }, + "time": { + "type": "string", + "description": "gRPC server keep alive time" + }, + "timeout": { + "type": "string", + "description": "gRPC server keep alive timeout" + } + } + }, + "max_header_list_size": { "type": "integer" }, + "max_receive_message_size": { "type": "integer" }, + "max_send_msg_size": { "type": "integer" }, + "read_buffer_size": { "type": "integer" }, + "write_buffer_size": { "type": "integer" } + } }, - "refresh_duration": { - "type": "string", - "description": "gRPC client TCP DNS cache refresh duration" - } + "mode": { "type": "string" }, + "network": { "type": "string" }, + "probe_wait_time": { "type": "string" }, + "restart": { "type": "boolean" }, + "socket_path": { "type": "string" } } }, - "socket_option": { "type": "" }, - "tls": { "type": "" } + "servicePort": { "type": "integer" } } }, - "read_buffer_size": { - "type": "integer", - "description": "gRPC client dial option read buffer size" - }, - "timeout": { - "type": "string", - "description": "gRPC client dial option timeout" - }, - "write_buffer_size": { - "type": "integer", - "description": "gRPC client dial option write buffer size" + "rest": { + "type": "object", + "properties": { "enabled": { "type": "boolean" } } } } }, - "health_check_duration": { - "type": "string", - "description": "gRPC client health check duration" - }, - "max_recv_msg_size": { "type": "integer" }, - "max_retry_rpc_buffer_size": { "type": "integer" }, - "max_send_msg_size": { "type": "integer" }, - "tls": { "type": "" }, - "wait_for_ready": { "type": "boolean" } + "tls": { + "type": "object", + "properties": { + "ca": { "type": "string" }, + "cert": { "type": "string" }, + "enabled": { "type": "boolean" }, + "insecure_skip_verify": { + "type": "boolean", + "description": "enable/disable skip SSL certificate verification" + }, + "key": { "type": "string" } + } + } } }, - "dataset": { + "service": { "type": "object", - "description": "dataset information", "properties": { - "group": { - "type": "string", - "description": "the hdf5 group name of dataset" + "annotations": { + "type": "object", + "description": "service annotations" }, - "indexes": { - "type": "integer", - "description": "the amount of indexes" + "enabled": { "type": "boolean", "description": "service enabled" }, + "externalTrafficPolicy": { + "type": "string", + "description": "external traffic policy (can be specified when service type is LoadBalancer or NodePort) : Cluster or Local" }, - "name": { "type": "string", "description": "the name of dataset" }, - "range": { - "type": "object", - "description": "the data range of indexes", - "properties": { - "end": { "type": "integer", "description": "end index number" }, - "start": { "type": "integer", "description": "start index number" } - } + "labels": { "type": "object", "description": "service labels" }, + "type": { + "type": "string", + "description": "service type: ClusterIP, LoadBalancer or NodePort", + "enum": ["ClusterIP", "LoadBalancer", "NodePort"] } } }, - "jobs": { - "type": "array", - "description": "benchmark jobs", - "items": { "type": "object" } + "serviceAccount": { + "type": "object", + "properties": { + "create": { + "type": "boolean", + "description": "service account will be created" + }, + "name": { "type": "string", "description": "name of service account" } + } }, - "target": { + "time_zone": { "type": "string", "description": "time_zone" }, + "tolerations": { "type": "array", - "description": "target cluster host\u0026port", + "description": "tolerations", "items": { "type": "object" } + }, + "version": { + "type": "string", + "description": "version of benchmark-operator config" } } } diff --git a/charts/vald-benchmark-operator/values.yaml b/charts/vald-benchmark-operator/values.yaml index 064136e226..587bcd9121 100644 --- a/charts/vald-benchmark-operator/values.yaml +++ b/charts/vald-benchmark-operator/values.yaml @@ -14,261 +14,483 @@ # limitations under the License. # -# @schema {"name": "dataset", "type": "object"} -# dataset -- dataset information -dataset: - # @schema {"name": "dataset.name", "type": "string" } - # dataset.name -- the name of dataset - name: "fashion-mnist" - # @schema {"name": "dataset.indexes", "type": "integer"} - # dataset.indexes -- the amount of indexes - indexes: 10000 - # @schema {"name": "dataset.group", "type": "string"} - # dataset.group -- the hdf5 group name of dataset - group: "train" - # @schema {"name": "dataset.range", "type": "object"} - # dataset.range -- the data range of indexes - range: - # @schema {"name": "dataset.range.start", "type": "integer"} - # dataset.range.start -- start index number - start: 0 - # @schema {"name": "dataset.range.end", "type": "integer"} - # dataset.range.end -- end index number - end: 10000 +# @schema {"name": "name", "type": "string"} +# name -- name of the deployment +name: vald-benchmark-operator -# @schema {"name": "target", "type": "object"} -# target -- target cluster host&port -target: - # @schema {"name": "target.host", "type": "string"} - # target.host -- target cluster host - host: "vald-lb-gateway.vald.svc.cluster.local" - # @schema {"name": "target.port", "type": "integer"} - # target.port -- target cluster port - port: 8081 +# @schema {"name": "replicas", "type": "integer"} +# replicas -- the number of replica for deployment +replicas: 1 -# @schema {"name": "jobs", "type": "array", "items": {"type": "object"}} -# jobs -- benchmark jobs -jobs: - # @schema {"name": "jobs.items.dataset", "type": "object"} - - dataset: - name: "fashion-mnist" - indexes: 10000 - group: "train" - range: - start: 0 - end: 10000 - repetition: 1 - replica: 1 - dimension: 784 - target: - host: "localhost" - port: "8081" - rules: [] - search_config: - epsilon: 0.1 - radius: -1 - num: 10 - min_num: 5 - timeout: "1m" - # @schema {"name": "client_config", "type": "object", "anchor": "client_config"} - client_config: - # @schema {"name": "client_config.addrs", "type": "array", "items": {"type": "string"}} - # client_config.addrs -- gRPC client addresses - addrs: [] - # @schema {"name": "client_config.health_check_duration", "type": "string"} - # client_config.health_check_duration -- gRPC client health check duration - health_check_duration: "1s" - # @schema {"name": "client_config.connection_pool", "type": "object"} - connection_pool: - # @schema {"name": "client_config.connection_pool.enable_dns_resolver", "type": "boolean"} - # client_config.connection_pool.enable_dns_resolver -- enables gRPC client connection pool dns resolver, when enabled vald uses ip handshake exclude dns discovery which improves network performance - enable_dns_resolver: true - # @schema {"name": "client_config.connection_pool.enable_rebalance", "type": "boolean"} - # client_config.connection_pool.enable_rebalance -- enables gRPC client connection pool rebalance - enable_rebalance: true - # @schema {"name": "client_config.connection_pool.rebalance_duration", "type": "string"} - # client_config.connection_pool.rebalance_duration -- gRPC client connection pool rebalance duration - rebalance_duration: 30m - # @schema {"name": "client_config.connection_pool.size", "type": "integer"} - # client_config.connection_pool.size -- gRPC client connection pool size - size: 3 - # @schema {"name": "client_config.connection_pool.old_conn_close_duration", "type": "string"} - # client_config.connection_pool.old_conn_close_duration -- makes delay before gRPC client connection closing during connection pool rebalance - old_conn_close_duration: "2m" - # @schema {"name": "client_config.backoff", "type": "object", "anchor": "backoff"} - backoff: - # @schema {"name": "client_config.backoff.initial_duration", "type": "string"} - # client_config.backoff.initial_duration -- gRPC client backoff initial duration - initial_duration: 5ms - # @schema {"name": "client_config.backoff.backoff_time_limit", "type": "string"} - # client_config.backoff.backoff_time_limit -- gRPC client backoff time limit - backoff_time_limit: 5s - # @schema {"name": "client_config.backoff.maximum_duration", "type": "string"} - # client_config.backoff.maximum_duration -- gRPC client backoff maximum duration - maximum_duration: 5s - # @schema {"name": "client_config.backoff.jitter_limit", "type": "string"} - # client_config.backoff.jitter_limit -- gRPC client backoff jitter limit - jitter_limit: 100ms - # @schema {"name": "client_config.backoff.backoff_factor", "type": "number"} - # client_config.backoff.backoff_factor -- gRPC client backoff factor - backoff_factor: 1.1 - # @schema {"name": "client_config.backoff.retry_count", "type": "integer"} - # client_config.backoff.retry_count -- gRPC client backoff retry count - retry_count: 100 - # @schema {"name": "client_config.backoff.enable_error_log", "type": "boolean"} - # client_config.backoff.enable_error_log -- gRPC client backoff log enabled - enable_error_log: true - # @schema {"name": "client_config.circuit_breaker", "type": "object"} - circuit_breaker: - # @schema {"name": "client_config.circuit_breaker.closed_error_rate", "type": "number"} - # client_config.circuit_breaker.closed_error_rate -- gRPC client circuitbreaker closed error rate - closed_error_rate: 0.7 - # @schema {"name": "client_config.circuit_breaker.half_open_error_rate", "type": "number"} - # client_config.circuit_breaker.half_open_error_rate -- gRPC client circuitbreaker half-open error rate - half_open_error_rate: 0.5 - # @schema {"name": "client_config.circuit_breaker.min_samples", "type": "integer"} - # client_config.circuit_breaker.min_samples -- gRPC client circuitbreaker minimum sampling count - min_samples: 1000 - # @schema {"name": "client_config.circuit_breaker.open_timeout", "type": "string"} - # client_config.circuit_breaker.open_timeout -- gRPC client circuitbreaker open timeout - open_timeout: "1s" - # @schema {"name": "client_config.circuit_breaker.closed_refresh_timeout", "type": "string"} - # client_config.circuit_breaker.closed_refresh_timeout -- gRPC client circuitbreaker closed refresh timeout - closed_refresh_timeout: "10s" - # @schema {"name": "client_config.call_option", "type": "object"} - call_option: - # @schema {"name": "client_config.wait_for_ready", "type": "boolean"} - # client_config.call_option.wait_for_ready -- gRPC client call option wait for ready - wait_for_ready: true - # @schema {"name": "client_config.max_retry_rpc_buffer_size", "type": "integer"} - # client_config.call_option.max_retry_rpc_buffer_size -- gRPC client call option max retry rpc buffer size - max_retry_rpc_buffer_size: 0 - # @schema {"name": "client_config.max_recv_msg_size", "type": "integer"} - # client_config.call_option.max_recv_msg_size -- gRPC client call option max receive message size - max_recv_msg_size: 0 - # @schema {"name": "client_config.max_send_msg_size", "type": "integer"} - # client_config.call_option.max_send_msg_size -- gRPC client call option max send message size - max_send_msg_size: 0 - # @schema {"name": "client_config.dial_option", "type": "object"} - dial_option: - # @schema {"name": "client_config.dial_option.write_buffer_size", "type": "integer"} - # client_config.dial_option.write_buffer_size -- gRPC client dial option write buffer size - write_buffer_size: 0 - # @schema {"name": "client_config.dial_option.read_buffer_size", "type": "integer"} - # client_config.dial_option.read_buffer_size -- gRPC client dial option read buffer size - read_buffer_size: 0 - # @schema {"name": "client_config.dial_option.initial_window_size", "type": "integer"} - # client_config.dial_option.initial_window_size -- gRPC client dial option initial window size - initial_window_size: 0 - # @schema {"name": "client_config.dial_option.initial_connection_window_size", "type": "integer"} - # client_config.dial_option.initial_connection_window_size -- gRPC client dial option initial connection window size - initial_connection_window_size: 0 - # @schema {"name": "client_config.dial_option.max_msg_size", "type": "integer"} - # client_config.dial_option.max_msg_size -- gRPC client dial option max message size - max_msg_size: 0 - # @schema {"name": "client_config.dial_option.backoff_max_delay", "type": "string"} - # client_config.dial_option.backoff_max_delay -- gRPC client dial option max backoff delay - backoff_max_delay: "120s" - # @schema {"name": "client_config.dial_option.backoff_base_delay", "type": "string"} - # client_config.dial_option.backoff_base_delay -- gRPC client dial option base backoff delay - backoff_base_delay: "1s" - # @schema {"name": "client_config.dial_option.backoff_multiplier", "type": "number"} - # client_config.dial_option.backoff_multiplier -- gRPC client dial option base backoff delay - backoff_multiplier: 1.6 - # @schema {"name": "client_config.dial_option.backoff_jitter", "type": "number"} - # client_config.dial_option.backoff_jitter -- gRPC client dial option base backoff delay - backoff_jitter: 0.2 - # @schema {"name": "client_config.dial_option.min_connection_timeout", "type": "string"} - # client_config.dial_option.min_connection_timeout -- gRPC client dial option minimum connection timeout - min_connection_timeout: "20s" - # @schema {"name": "client_config.dial_option.enable_backoff", "type": "boolean"} - # client_config.dial_option.enable_backoff -- gRPC client dial option backoff enabled - enable_backoff: false - # @schema {"name": "client_config.dial_option.insecure", "type": "boolean"} - # client_config.dial_option.insecure -- gRPC client dial option insecure enabled - insecure: true - # @schema {"name": "client_config.dial_option.timeout", "type": "string"} - # client_config.dial_option.timeout -- gRPC client dial option timeout - timeout: "" - # @schema {"name": "client_config.dial_option.interceptors", "type": "array", "items": {"type": "string", "enum": ["TraceInterceptor"]}} - # client_config.dial_option.interceptors -- gRPC client interceptors - interceptors: [] - # @schema {"name": "client_config.dial_option.net", "type": "object", "anchor": "net"} - net: - # @schema {"name": "client_config.dial_option.net.dns", "type": "object"} - dns: - # @schema {"name": "client_config.dial_option.net.dns.cache_enabled", "type": "boolean"} - # client_config.dial_option.net.dns.cache_enabled -- gRPC client TCP DNS cache enabled - cache_enabled: true - # @schema {"name": "client_config.dial_option.net.dns.refresh_duration", "type": "string"} - # client_config.dial_option.net.dns.refresh_duration -- gRPC client TCP DNS cache refresh duration - refresh_duration: 30m - # @schema {"name": "client_config.dial_option.net.dns.cache_expiration", "type": "string"} - # client_config.dial_option.net.dns.cache_expiration -- gRPC client TCP DNS cache expiration - cache_expiration: 1h - # @schema {"name": "client_config.dial_option.net.dialer", "type": "object"} - dialer: - # @schema {"name": "client_config.dial_option.net.dialer.timeout", "type": "string"} - # client_config.dial_option.net.dialer.timeout -- gRPC client TCP dialer timeout - timeout: "" - # @schema {"name": "client_config.dial_option.net.dialer.keepalive", "type": "string"} - # client_config.dial_option.net.dialer.keepalive -- gRPC client TCP dialer keep alive - keepalive: "" - # @schema {"name": "client_config.dial_option.net.dialer.dual_stack_enabled", "type": "boolean"} - # client_config.dial_option.net.dialer.dual_stack_enabled -- gRPC client TCP dialer dual stack enabled - dual_stack_enabled: true - # @schema {"name": "client_config.dial_option.net.tls"} - tls: - # client_config.dial_option.net.tls.enabled -- TLS enabled - enabled: false - # client_config.dial_option.net.tls.cert -- TLS cert path - cert: /path/to/cert - # client_config.dial_option.net.tls.key -- TLS key path - key: /path/to/key - # client_config.dial_option.net.tls.ca -- TLS ca path - ca: /path/to/ca - # client_config.dial_option.net.tls.insecure_skip_verify -- enable/disable skip SSL certificate verification - insecure_skip_verify: false - # @schema {"name": "client_config.dial_option.net.socket_option"} - socket_option: - # client_config.dial_option.net.socket_option.reuse_port -- server listen socket option for reuse_port functionality - reuse_port: true - # client_config.dial_option.net.socket_option.reuse_addr -- server listen socket option for reuse_addr functionality - reuse_addr: true - # client_config.dial_option.net.socket_option.tcp_fast_open -- server listen socket option for tcp_fast_open functionality - tcp_fast_open: true - # client_config.dial_option.net.socket_option.tcp_no_delay -- server listen socket option for tcp_no_delay functionality - tcp_no_delay: true - # client_config.dial_option.net.socket_option.tcp_cork -- server listen socket option for tcp_cork functionality - tcp_cork: false - # client_config.dial_option.net.socket_option.tcp_quick_ack -- server listen socket option for tcp_quick_ack functionality - tcp_quick_ack: true - # client_config.dial_option.net.socket_option.tcp_defer_accept -- server listen socket option for tcp_defer_accept functionality - tcp_defer_accept: true - # client_config.dial_option.net.socket_option.ip_transparent -- server listen socket option for ip_transparent functionality - ip_transparent: false - # client_config.dial_option.net.socket_option.ip_recover_destination_addr -- server listen socket option for ip_recover_destination_addr functionality - ip_recover_destination_addr: false - # @schema {"name": "client_config.dial_option.keepalive", "type": "object"} - keepalive: - # @schema {"name": "client_config.dial_option.keepalive.time", "type": "string"} - # client_config.dial_option.keepalive.time -- gRPC client keep alive time - time: "120s" - # @schema {"name": "client_config.dial_option.keepalive.timeout", "type": "string"} - # client_config.dial_option.keepalive.timeout -- gRPC client keep alive timeout - timeout: "30s" - # @schema {"name": "client_config.dial_option.keepalive.permit_without_stream", "type": "boolean"} - # client_config.dial_option.keepalive.permit_without_stream -- gRPC client keep alive permit without stream - permit_without_stream: true - # @schema {"name": "client_config.tls"} - tls: - # client_config.tls.enabled -- TLS enabled - enabled: false - # client_config.tls.cert -- TLS cert path - cert: /path/to/cert - # client_config.tls.key -- TLS key path - key: /path/to/key - # client_config.tls.ca -- TLS ca path - ca: /path/to/ca - # client_config.tls.insecure_skip_verify -- enable/disable skip SSL certificate verification - insecure_skip_verify: false +# @schema {"name": "version", "type": "string"} +# version -- version of benchmark-operator config +version: v0.0.0 + +# @schema {"name": "time_zone", "type": "string"} +# time_zone -- time_zone +time_zone: "" + +# @schema {"name": "image", "type": "object"} +image: + # @schema {"name": "image.repository", "type": "string"} + # image.repository -- image repository + repository: vdaas/vald-benchmark-operator + # @schema {"name": "image.tag", "type": "string"} + # image.tag -- image tag + tag: v1.7.5 + # @schema {"name": "image.pullPolicy", "type": "string", "enum": ["Always", "Never", "IfNotPresent"]} + # image.pullPolicy -- image pull policy + pullPolicy: Always + +# @schema {"name": "rbac", "type": "object"} +rbac: + # @schema {"name": "rbac.create", "type": "boolean"} + # rbac.create -- required roles and rolebindings will be created + create: true + # @schema {"name": "rbac.name", "type": "string"} + # rbac.name -- name of roles and rolebindings + name: vald-benchmark-operator + +# @schema {"name": "serviceAccount", "type": "object"} +serviceAccount: + # @schema {"name": "serviceAccount.create", "type": "boolean"} + # serviceAccount.create -- service account will be created + create: true + # @schema {"name": "serviceAccount.name", "type": "string"} + # serviceAccount.name -- name of service account + name: vald-benchmark-operator + +# @schema {"name": "service", "type": "object"} +service: + # @schema {"name": "service.enabled", "type": "boolean"} + # service.enabled -- service enabled + enabled: true + # @schema {"name": "service.annotations", "type": "object"} + # service.annotations -- service annotations + annotations: {} + # @schema {"name": "service.labels", "type": "object"} + # service.labels -- service labels + labels: {} + # @schema {"name": "service.type", "type": "string", "enum": ["ClusterIP", "LoadBalancer", "NodePort"]} + # service.type -- service type: ClusterIP, LoadBalancer or NodePort + type: ClusterIP + # @schema {"name": "service.externalTrafficPolicy", "type": "string"} + # service.externalTrafficPolicy -- external traffic policy (can be specified when service type is LoadBalancer or NodePort) : Cluster or Local + externalTrafficPolicy: "" + +# @schema {"name": "annotations", "type": "object"} +# annotations -- deployment annotations +annotations: {} + +# @schema {"name": "podAnnotations", "type": "object"} +# podAnnotations -- pod annotations +podAnnotations: {} + +# @schema {"name": "securityContext", "type": "object"} +# securityContext -- security context for container +securityContext: + runAsUser: 65532 + runAsNonRoot: true + runAsGroup: 65532 + privileged: false + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + +# @schema {"name": "podSecurityContext", "type": "object"} +# podSecurityContext -- security context for pod +podSecurityContext: + runAsUser: 65532 + runAsNonRoot: true + runAsGroup: 65532 + fsGroup: 65532 + fsGroupChangePolicy: "OnRootMismatch" + +# @schema {"name": "resources", "type": "object"} +# resources -- kubernetes resources of pod +resources: + # @schema {"name": "resources.limits", "type": "object"} + limits: + cpu: 300m + memory: 300Mi + # @schema {"name": "resources.requests", "type": "object"} + requests: + cpu: 200m + memory: 200Mi + +# @schema {"name": "nodeSelector", "type": "object"} +# nodeSelector -- node labels for pod assignment +nodeSelector: {} + +# @schema {"name": "tolerations", "type": "array", "items": {"type": "object"}} +# tolerations -- tolerations +tolerations: [] + +# @schema {"name": "affinity", "type": "object"} +# affinity -- affinity +affinity: {} + +# @schema {"name": "logging", "type": "object"} +logging: + # @schema {"name": "logging.logger", "type": "string", "enum": ["glg", "zap"]} + # logging.logger -- logger name. + # currently logger must be `glg` or `zap`. + logger: glg + # @schema {"name": "logging.level", "type": "string", "enum": ["debug", "info", "warn", "error", "fatal"]} + # logging.level -- logging level. + # logging level must be `debug`, `info`, `warn`, `error` or `fatal`. + level: debug + # @schema {"name": "logging.format", "type": "string", "enum": ["raw", "json"]} + # logging.format -- logging format. + # logging format must be `raw` or `json` + format: raw + +# @schema {"name": "server_config", "type": "object"} +server_config: + # @schema {"name": "server_config.servers", "type": "object"} + servers: + # @schema {"name": "server_config.servers.rest", "type": "object"} + rest: + # @schema {"name": "server_config.servers.rest.enabled", "type": "boolean"} + enabled: false + # @schema {"name": "server_config.servers.grpc", "type": "object"} + grpc: + # @schema {"name": "server_config.servers.grpc.enabled", "type": "boolean"} + enabled: true + # @schema {"name": "server_config.servers.grpc.name", "type": "string"} + name: grpc + # @schema {"name": "server_config.servers.grpc.host", "type": "string"} + host: 0.0.0.0 + # @schema {"name": "server_config.servers.grpc.port", "type": "integer"} + port: 8081 + # @schema {"name": "server_config.servers.grpc.servicePort", "type": "integer"} + serviecPort: 8081 + # @schema {"name": "server_config.servers.grpc.server", "type": "object"} + server: + # @schema {"name": "server_config.servers.grpc.server.mode", "type": "string"} + mode: GRPC + # @schema {"name": "server_config.servers.grpc.server.probe_wait_time", "type": "string"} + probe_wait_time: 3s + # @schema {"name": "server_config.servers.grpc.server.network", "type": "string"} + network: tcp + # @schema {"name": "server_config.servers.grpc.server.socket_path", "type": "string"} + socket_path: "" + # @schema {"name": "server_config.servers.grpc.server.grpc", "type": "object"} + grpc: + # @schema {"name": "server_config.servers.grpc.server.grpc.bidirectional_stream_concurrency", "type": "integer"} + bidirectional_stream_concurrency: 20 + # @schema {"name": "server_config.servers.grpc.server.grpc.connection_timeout", "type": "string"} + connection_timeout: "" + # @schema {"name": "server_config.servers.grpc.server.grpc.header_table_size", "type": "integer"} + header_table_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.initial_conn_window_size", "type": "integer"} + initial_conn_window_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.initial_window_size", "type": "integer"} + initial_window_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.interceptors", "type": "array", "items": {"type": "string"}} + interceptors: [] + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive", "type": "object"} + keepalive: + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.max_conn_idle", "type": "string"} + # server_config.servers.grpc.server.grpc.keepalive.max_conn_idle -- gRPC server keep alive max connection idle + max_conn_idle: "" + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.max_conn_age", "type": "string"} + # server_config.servers.grpc.server.grpc.keepalive.max_conn_age -- gRPC server keep alive max connection age + max_conn_age: "" + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.max_conn_age_grace", "type": "string"} + # server_config.servers.grpc.server.grpc.keepalive.max_conn_age_grace -- gRPC server keep alive max connection age grace + max_conn_age_grace: "" + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.time", "type": "string"} + # server_config.servers.grpc.server.grpc.keepalive.time -- gRPC server keep alive time + time: "120s" + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.timeout", "type": "string"} + # server_config.servers.grpc.server.grpc.keepalive.timeout -- gRPC server keep alive timeout + timeout: "30s" + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.min_time", "type": "string"} + # server_config.servers.grpc.server.grpc.keepalive.min_time -- gRPC server keep alive min_time + min_time: "60s" + # @schema {"name": "server_config.servers.grpc.server.grpc.keepalive.permit_without_stream", "type": "boolean"} + # server_config.servers.grpc.server.grpc.keepalive.permit_without_stream -- gRPC server keep alive permit_without_stream + permit_without_stream: true + # @schema {"name": "server_config.servers.grpc.server.grpc.max_header_list_size", "type": "integer"} + max_header_list_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.max_receive_message_size", "type": "integer"} + max_receive_message_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.max_send_msg_size", "type": "integer"} + max_send_message_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.read_buffer_size", "type": "integer"} + read_buffer_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.write_buffer_size", "type": "integer"} + write_buffer_size: 0 + # @schema {"name": "server_config.servers.grpc.server.grpc.enable_reflection", "type": "boolean"} + enable_reflection: true + # @schema {"name": "server_config.servers.grpc.server.restart", "type": "boolean"} + restart: true + # @schema {"name": "server_config.healths", "type": "object"} + # health_check_servers: + healths: + # @schema {"name": "server_config.healths.liveness", "type": "object"} + liveness: + # @schema {"name": "server_config.healths.liveness.enabled", "type": "boolean"} + enabled: true + # @schema {"name": "server_config.healths.liveness.host", "type": "string"} + host: 0.0.0.0 + # @schema {"name": "server_config.healths.liveness.port", "type": "integer"} + port: 3000 + # @schema {"name": "server_config.healths.liveness.servicePort", "type": "integer"} + servicePort: 3000 + # @schema {"name": "server_config.healths.liveness.livenessProbe", "type": "object"} + livenessProbe: + # @schema {"name": "server_config.healths.liveness.livenessProbe.httpGet", "type": "object"} + httpGet: + # @schema {"name": "server_config.healths.liveness.livenessProbe.httpGet.path", "type": "string"} + # server_config.healths.liveness.livenessProbe.httpGet.path -- readiness probe path + path: /liveness + # @schema {"name": "server_config.healths.liveness.livenessProbe.httpGet.port", "type": "string"} + # server_config.healths.liveness.livenessProbe.httpGet.port -- readiness probe port + port: liveness + # @schema {"name": "server_config.healths.liveness.livenessProbe.httpGet.scheme", "type": "string"} + # server_config.healths.liveness.livenessProbe.httpGet.scheme -- readiness probe scheme + scheme: HTTP + # @schema {"name": "server_config.healths.liveness.livenessProbe.initialDelaySeconds", "type": "integer"} + # server_config.healths.liveness.livenessProbe.initialDelaySeconds -- liveness probe initial delay seconds + initialDelaySeconds: 15 + # @schema {"name": "server_config.healths.liveness.livenessProbe.periodSeconds", "type": "integer"} + # server_config.healths.liveness.livenessProbe.periodSeconds -- liveness probe period seconds + periodSeconds: 20 + # @schema {"name": "server_config.healths.liveness.livenessProbe.successThreshold", "type": "integer"} + # server_config.healths.liveness.livenessProbe.successThreshold -- liveness probe success threshold + successThreshold: 1 + # @schema {"name": "server_config.healths.liveness.livenessProbe.failureThreshold", "type": "integer"} + # server_config.healths.liveness.livenessProbe.failureThreshold -- liveness probe failure threshold + failureThreshold: 2 + # @schema {"name": "server_config.healths.liveness.livenessProbe.timeoutSeconds", "type": "integer"} + # server_config.healths.liveness.livenessProbe.timeoutSeconds -- liveness probe timeout seconds + timeoutSeconds: 5 + # @schema {"name": "server_config.healths.liveness.server", "type": "object"} + server: + # @schema {"name": "server_config.healths.liveness.server.mode", "type": "string"} + mode: "" + # @schema {"name": "server_config.healths.liveness.server.probe_wait_time", "type": "string"} + probe_wait_time: 3s + # @schema {"name": "server_config.healths.liveness.server.network", "type": "string"} + network: tcp + # @schema {"name": "server_config.healths.liveness.server.socket_path", "type": "string"} + socket_path: "" + # @schema {"name": "server_config.healths.liveness.server.http", "type": "object"} + http: + # @schema {"name": "server_config.healths.liveness.server.http.timeout", "type": "string"} + handler_timeout: "" + # @schema {"name": "server_config.healths.liveness.server.http.idle_timeout", "type": "string"} + idle_timeout: "" + # @schema {"name": "server_config.healths.liveness.server.http.read_header_timeout", "type": "string"} + read_header_timeout: "" + # @schema {"name": "server_config.healths.liveness.server.http.read_timeout", "type": "string"} + read_timeout: "" + # @schema {"name": "server_config.healths.liveness.server.http.shutdown_duration", "type": "string"} + shutdown_duration: 5s + # @schema {"name": "server_config.healths.liveness.server.http.write_timeout", "type": "string"} + write_timeout: "" + # @schema {"name": "server_config.healths.readiness", "type": "object"} + readiness: + # @schema {"name": "server_config.healths.readiness.enabled", "type": "boolean"} + enabled: true + # @schema {"name": "server_config.healths.readiness.host", "type": "string"} + host: 0.0.0.0 + # @schema {"name": "server_config.healths.readiness.port", "type": "integer"} + port: 3001 + # @schema {"name": "server_config.healths.readiness.servicePort", "type": "integer"} + servicePort: 3001 + # @schema {"name": "server_config.healths.readiness.readinessProbe", "type": "object"} + readinessProbe: + # @schema {"name": "server_config.healths.readiness.readinessProbe.httpGet", "type": "object"} + httpGet: + # @schema {"name": "server_config.healths.readiness.readinessProbe.httpGet.path", "type": "string"} + # server_config.healths.readiness.readinessProbe.httpGet.path -- readiness probe path + path: /readiness + # @schema {"name": "server_config.healths.readiness.readinessProbe.httpGet.port", "type": "string"} + # server_config.healths.readiness.readinessProbe.httpGet.port -- readiness probe port + port: readiness + # @schema {"name": "server_config.healths.readiness.readinessProbe.httpGet.scheme", "type": "string"} + # server_config.healths.readiness.readinessProbe.httpGet.scheme -- readiness probe scheme + scheme: HTTP + # @schema {"name": "server_config.healths.readiness.readinessProbe.initialDelaySeconds", "type": "integer"} + # server_config.healths.readiness.readinessProbe.initialDelaySeconds -- readiness probe initial delay seconds + initialDelaySeconds: 10 + # @schema {"name": "server_config.healths.readiness.readinessProbe.periodSeconds", "type": "integer"} + # server_config.healths.readiness.readinessProbe.periodSeconds -- readiness probe period seconds + periodSeconds: 3 + # @schema {"name": "server_config.healths.readiness.readinessProbe.successThreshold", "type": "integer"} + # server_config.healths.readiness.readinessProbe.successThreshold -- readiness probe success threshold + successThreshold: 1 + # @schema {"name": "server_config.healths.readiness.readinessProbe.failureThreshold", "type": "integer"} + # server_config.healths.readiness.readinessProbe.failureThreshold --readiness probe failure threshold + failureThreshold: 2 + # @schema {"name": "server_config.healths.readiness.readinessProbe.timeoutSeconds", "type": "integer"} + # server_config.healths.readiness.readinessProbe.timeoutSeconds -- readiness probe timeout seconds + timeoutSeconds: 2 + # @schema {"name": "server_config.healths.readiness.server", "type": "object"} + server: + # @schema {"name": "server_config.healths.readiness.server.mode", "type": "string"} + mode: "" + # @schema {"name": "server_config.healths.readiness.server.probe_wait_time", "type": "string"} + probe_wait_time: 3s + # @schema {"name": "server_config.healths.readiness.server.network", "type": "string"} + network: tcp + # @schema {"name": "server_config.healths.readiness.server.socket_path", "type": "string"} + socket_path: "" + # @schema {"name": "server_config.healths.readiness.server.http", "type": "object"} + http: + # @schema {"name": "server_config.healths.readiness.server.http.handler_timeout", "type": "string"} + handler_timeout: "" + # @schema {"name": "server_config.healths.readiness.server.http.idle_timeout", "type": "string"} + idle_timeout: "" + # @schema {"name": "server_config.healths.readiness.server.http.read_header_timeout", "type": "string"} + read_header_timeout: "" + # @schema {"name": "server_config.healths.readiness.server.http.read_timeout", "type": "string"} + read_timeout: "" + # @schema {"name": "server_config.healths.readiness.server.http.shutdown_duration", "type": "string"} + shutdown_duration: 0s + # @schema {"name": "server_config.healths.readiness.server.http.write_timeout", "type": "string"} + write_timeout: "" + # @schema {"name": "server_config.healths.startup", "type": "object"} + startup: + # @schema {"name": "server_config.healths.startup.enabled", "type": "boolean"} + # server_config.healths.startup.enabled -- enable startup probe. + enabled: true + # @schema {"name": "server_config.healths.startupProbe", "type": "object"} + startupProbe: + # @schema {"name": "server_config.healths.startupProbe.httpGet", "type": "object"} + httpGet: + # @schema {"name": "server_config.healths.startupProbe.httpGet.path", "type": "string"} + # server_config.healths.startupProbe.httpGet.path -- startup probe path + path: /liveness + # @schema {"name": "server_config.healths.startupProbe.httpGet.port", "type": "string"} + # server_config.healths.startupProbe.httpGet.port -- startup probe port + port: liveness + # @schema {"name": "server_config.healths.startupProbe.httpGet.scheme", "type": "string"} + # server_config.healths.startupProbe.httpGet.scheme -- startup probe scheme + scheme: HTTP + # @schema {"name": "server_config.healths.startupProbe.initialDelaySeconds", "type": "integer"} + # server_config.healths.startupProbe.initialDelaySeconds -- startup probe initial delay seconds + initialDelaySeconds: 5 + # @schema {"name": "server_config.healths.startupProbe.periodSeconds", "type": "integer"} + # server_config.healths.startupProbe.periodSeconds -- startup probe period seconds + periodSeconds: 5 + # @schema {"name": "server_config.healths.startupProbe.successThreshold", "type": "integer"} + # server_config.healths.startupProbe.successThreshold -- startup probe success threshold + successThreshold: 1 + # @schema {"name": "server_config.healths.startupProbe.failureThreshold", "type": "integer"} + # server_config.healths.startupProbe.failureThreshold -- startupProbe probe failure threshold + failureThreshold: 30 + # @schema {"name": "server_config.healths.startupProbe.timeoutSeconds", "type": "integer"} + # server_config.healths.startupProbe.timeoutSeconds -- startup probe timeout seconds + timeoutSeconds: 2 + # @schema {"name": "server_config.metrics", "type": "object"} + metrics: + # @schema {"name": "server_config.metrics.pprof", "type": "object"} + pprof: + # @schema {"name": "server_config.metrics.pprof.enabled", "type": "boolean"} + enabled: false + # @schema {"name": "server_config.metrics.pprof.host", "type": "string"} + host: 0.0.0.0 + # @schema {"name": "server_config.metrics.pprof.port", "type": "integer"} + port: 6060 + # @schema {"name": "server_config.metrics.pprof.server", "type": "object"} + server: + # @schema {"name": "server_config.metrics.pprof.server.mode", "type": "string"} + mode: REST + # @schema {"name": "server_config.metrics.pprof.server.probe_wait_time", "type": "string"} + probe_wait_time: 3s + # @schema {"name": "server_config.metrics.pprof.server.network", "type": "string"} + network: tcp + # @schema {"name": "server_config.metrics.pprof.server.socket_path", "type": "string"} + socket_path: "" + # @schema {"name": "server_config.metrics.pprof.server.http", "type": "object"} + http: + # @schema {"name": "server_config.metrics.pprof.server.http.handler_timeout", "type": "string"} + handler_timeout: 5s + # @schema {"name": "server_config.metrics.pprof.server.http.idle_timeout", "type": "string"} + idle_timeout: 2s + # @schema {"name": "server_config.metrics.pprof.server.http.read_header_timeout", "type": "string"} + read_header_timeout: 1s + # @schema {"name": "server_config.metrics.pprof.server.http.read_timeout", "type": "string"} + read_timeout: 1s + # @schema {"name": "server_config.metrics.pprof.server.http.shutdown_duration", "type": "string"} + shutdown_duration: 5s + # @schema {"name": "server_config.metrics.pprof.server.http.write_timeout", "type": "string"} + write_timeout: 1m + # @schema {"name": "server_config.full_shutdown_duration", "type": "string"} + full_shutdown_duration: 600s + # @schema {"name": "server_config.tls", "type": "object"} + tls: + # @schema {"name": "server_config.tls.enabled", "type": "boolean"} + enabled: false + # @schema {"name": "server_config.tls.ca", "type": "string"} + ca: /path/to/ca + # @schema {"name": "server_config.tls.cert", "type": "string"} + cert: /path/to/cert + # @schema {"name": "server_config.tls.key", "type": "string"} + key: /path/to/key + # @schema {"name": "server_config.tls.insecure_skip_verify", "type": "boolean"} + # server_config.tls.insecure_skip_verify -- enable/disable skip SSL certificate verification + insecure_skip_verify: false + +# @schema {"name": "observability", "type": "object"} +observability: + # @schema {"name": "observability.enabled", "type": "boolean"} + enabled: false + # @schema {"name": "observability.otlp", "type": "object"} + otlp: + # @schema {"name": "observability.otlp.collector_endpoint", "type": "string"} + collector_endpoint: "" + # @schema {"name": "observability.otlp.trace_batch_timeout", "type": "string"} + trace_batch_timeout: "1s" + # @schema {"name": "observability.otlp.trace_export_timeout", "type": "string"} + trace_export_timeout: "1m" + # @schema {"name": "observability.otlp.trace_max_export_batch_size", "type": "integer"} + trace_max_export_batch_size: 1024 + # @schema {"name": "observability.otlp.trace_max_queue_size", "type": "integer"} + trace_max_queue_size: 256 + # @schema {"name": "observability.otlp.metrics_export_interval", "type": "string"} + metrics_export_interval: "1s" + # @schema {"name": "observability.otlp.metrics_export_timeout", "type": "string"} + metrics_export_timeout: "1m" + # @schema {"name": "observability.otlp.attribute", "type": "object"} + attribute: + # @schema {"name": "observability.otlp.attribute.namespace", "type": "string"} + namespace: "_MY_POD_NAMESPACE_" + # @schema {"name": "observability.otlp.attribute.pod_name", "type": "string"} + pod_name: "_MY_POD_NAME_" + # @schema {"name": "observability.otlp.attribute.node_name", "type": "string"} + node_name: "_MY_NODE_NAME_" + # @schema {"name": "observability.otlp.attribute.service_name", "type": "string"} + service_name: "vald-benchmark-operator" + # @schema {"name": "observability.otlp.attribute.metrics", "type": "object"} + metrics: + # @schema {"name": "observability.otlp.attribute.metrics.enable_cgo", "type": "boolean"} + enable_cgo: true + # @schema {"name": "observability.otlp.attribute.metrics.enable_goroutine", "type": "boolean"} + enable_goroutine: true + # @schema {"name": "observability.otlp.attribute.metrics.enable_memory", "type": "boolean"} + enable_memory: true + # @schema {"name": "observability.otlp.attribute.metrics.enable_version_info", "type": "boolean"} + enable_version_info: true + # @schema {"name": "observability.otlp.attribute.metrics.version_info_labels", "type": "array", "items": {"type": "string"}} + version_info_labels: + - vald_version + - server_name + - git_commit + - build_time + - go_version + - go_os + - go_arch + - ngt_version + # @schema {"name": "observability.trace", "type": "object"} + trace: + # @schema {"name": "observability.trace.enabled", "type": "boolean"} + enabled: false + # @schema {"name": "observability.trace.sampling_rate", "type": "integer"} + sampling_rate: 1 diff --git a/charts/vald-benchmark-operator/values/benchmark-job.yaml b/charts/vald-benchmark-operator/values/benchmark-job.yaml new file mode 100644 index 0000000000..c8c13e1f3a --- /dev/null +++ b/charts/vald-benchmark-operator/values/benchmark-job.yaml @@ -0,0 +1,45 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: vald.vdaas.org/v1 +kind: ValdBenchmarkJob +metadata: + name: sample-search-job + namespace: default +spec: + dataset: + name: "fashion-mnist" + indexes: 1000 + group: "test" + range: + start: 1 + end: 1000 + job_type: "search" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + client_config: + health_check_duration: "10s" + rps: 1000 + search_config: + epsilon: 0.1 + radius: -1 + num: 10 + min_num: 10 + timeout: "1m" + target: + host: "vald-lb-gateway.default.svc.cluster.local" + port: 8081 diff --git a/charts/vald-benchmark-operator/values/benchmark-scenario.yaml b/charts/vald-benchmark-operator/values/benchmark-scenario.yaml new file mode 100644 index 0000000000..4a0068eb20 --- /dev/null +++ b/charts/vald-benchmark-operator/values/benchmark-scenario.yaml @@ -0,0 +1,185 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: vald.vdaas.org/v1 +kind: ValdBenchmarkScenario +metadata: + name: sample-scenario + namespace: default +spec: + # @schema {"name": "dataset", "type": "object"} + # dataset -- dataset information + dataset: + # @schema {"name": "dataset.name", "type": "string" } + # dataset.name -- the name of dataset + name: "fashion-mnist" + # @schema {"name": "dataset.indexes", "type": "integer"} + # dataset.indexes -- the amount of indexes + indexes: 1000 + # @schema {"name": "dataset.group", "type": "string"} + # dataset.group -- the hdf5 group name of dataset + group: "test" + # @schema {"name": "dataset.range", "type": "object"} + # dataset.range -- the data range of indexes + range: + # @schema {"name": "dataset.range.start", "type": "integer"} + # dataset.range.start -- start index number + start: 1 + # @schema {"name": "dataset.range.end", "type": "integer"} + # dataset.range.end -- end index number + end: 1000 + # @schema {"name": "jobs", "type": "array", "items": {"type": "object"}} + # jobs -- benchmark jobs + jobs: + # @schema {"name": "jobs.items.dataset", "type": "object"} + - job_type: "insert" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 10000 + group: "train" + range: + start: 1 + end: 10000 + insert_config: + skip_strict_exist_check: true + client_config: + health_check_duration: "10s" + rps: 500 + - job_type: "update" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 10000 + group: "train" + range: + start: 10001 + end: 20000 + update_config: + skip_strict_exist_check: true + client_config: + health_check_duration: "10s" + rps: 500 + - job_type: "search" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + search_config: + epsilon: 0.1 + radius: -1 + num: 10 + min_num: 10 + timeout: "1m" + client_config: + health_check_duration: "10s" + rps: 2000 + - job_type: "upsert" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 30000 + group: "train" + range: + start: 10001 + end: 40000 + upsert_config: + skip_strict_exist_check: true + client_config: + health_check_duration: "10s" + rps: 1000 + - job_type: "search" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 20000 + group: "test" + range: + start: 1 + end: 20000 + search_config: + epsilon: 0.1 + radius: -1 + num: 10 + min_num: 10 + timeout: "1m" + client_config: + health_check_duration: "10s" + rps: 4000 + - job_type: "exists" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 20000 + group: "train" + range: + start: 1 + end: 20000 + client_config: + health_check_duration: "10s" + rps: 1000 + - job_type: "getobject" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 20000 + group: "train" + range: + start: 1 + end: 20000 + client_config: + health_check_duration: "10s" + rps: 1000 + - job_type: "remove" + dimension: 784 + repetition: 1 + replica: 1 + rules: [] + dataset: + name: "fashion-mnist" + indexes: 30000 + group: "train" + range: + start: 1 + end: 30000 + remove_config: + skip_strict_exist_check: true + client_config: + health_check_duration: "10s" + rps: 1000 + + # @schema {"name": "target", "type": "array", "items": {"type": "object"}} + # target -- target cluster host&port + target: + host: "vald-lb-gateway.default.svc.cluster.local" + port: 8081 diff --git a/internal/k8s/crd/benchmark/valdbenchmarkscenario.yaml b/internal/k8s/crd/benchmark/valdbenchmarkscenario.yaml deleted file mode 100644 index 32010539ef..0000000000 --- a/internal/k8s/crd/benchmark/valdbenchmarkscenario.yaml +++ /dev/null @@ -1,429 +0,0 @@ -# -# Copyright (C) 2019-2023 vdaas.org vald team -# -# 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. -# -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: valdbenchmarkscenarios.vald.vdaas.org -spec: - group: vald.vdaas.org - names: - kind: ValdBenchmarkScenario - listKind: ValdBenchmarkScenarioList - plural: valdbenchmarkscenarios - singular: valdbenchmarkscenario - shortNames: - - vbo - - vbos - scope: Namespaced - versions: - - name: v1 - served: true - storage: true - subresources: - status: {} - additionalPrinterColumns: - - jsonPath: .status - name: STATUS - type: string - schema: - openAPIV3Schema: - description: ValdBenchmarkScenario is the Schema for the valdbenchmarkscenarios API - type: object - properties: - apiVersion: - description: - "APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" - type: string - kind: - description: - "Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" - type: string - metadata: - type: object - status: - description: ValdBenchmarkScenarioStatus defines the observed state of ValdBenchmarkScenario - enum: - - NotReady - - Completed - - Available - - Healthy - type: string - spec: - description: ValdBenchmarkScenarioSpec defines the desired state of ValdBenchmarkScenario - type: object - properties: - dataset: - description: BenchmarkDataset defines the desired state of BenchmarkDateset - properties: - group: - type: string - indexes: - type: integer - name: - type: string - range: - description: BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange - properties: - end: - type: integer - start: - type: integer - required: - - end - - start - type: object - required: - - group - - indexes - - name - type: object - target: - properties: - host: - type: string - port: - type: integer - required: - - host - - port - type: object - jobs: - type: array - items: - description: BenchmarkJobSpec defines the desired state of ValdBenchmarkJob - type: object - properties: - target: - description: BenchmarkTarget defines the desired state of BenchmarkTarget - properties: - host: - type: string - port: - type: integer - required: - - host - - port - type: object - dataset: - description: BenchmarkDataset defines the desired state of BenchmarkDateset - properties: - group: - type: string - indexes: - type: integer - name: - type: string - range: - description: BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange - properties: - end: - type: integer - start: - type: integer - required: - - end - - start - type: object - required: - - group - - indexes - - name - type: object - dimension: - type: integer - job_type: - type: string - repetition: - type: integer - replica: - type: integer - rules: - items: - description: BenchmarkJobRule defines the desired state of BenchmarkJobRule - properties: - name: - type: string - type: - type: string - required: - - name - - type - type: object - type: array - rps: - type: integer - insert_config: - description: InsertConfig defines the desired state of insert config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - type: object - remove_config: - description: RemoveConfig defines the desired state of remove config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - type: object - search_config: - description: SearchConfig defines the desired state of search config - properties: - epsilon: - type: number - min_num: - format: int32 - type: integer - num: - format: int32 - type: integer - radius: - type: number - timeout: - type: string - type: object - update_config: - description: UpdateConfig defines the desired state of update config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - disable_balanced_update: - type: boolean - type: object - upsert_config: - description: UpsertConfig defines the desired state of upsert config - properties: - skip_strict_exist_check: - type: boolean - timestamp: - type: string - disable_balanced_update: - type: boolean - type: object - client_config: - description: ClientConfig represents the configurations for gRPC client. - properties: - addrs: - items: - type: string - type: array - backoff: - description: Backoff represents the configuration for the internal backoff package. - properties: - backoff_factor: - type: number - backoff_time_limit: - type: string - enable_error_log: - type: boolean - initial_duration: - type: string - jitter_limit: - type: string - maximum_duration: - type: string - retry_count: - type: integer - type: object - call_option: - description: CallOption represents the configurations for call option. - properties: - max_recv_msg_size: - type: integer - max_retry_rpc_buffer_size: - type: integer - max_send_msg_size: - type: integer - wait_for_ready: - type: boolean - type: object - circuit_breaker: - description: CircuitBreaker represents the configuration for the internal circuitbreaker package. - properties: - closed_error_rate: - type: number - closed_refresh_timeout: - type: string - half_open_error_rate: - type: number - min_samples: - format: int64 - type: integer - open_timeout: - type: string - type: object - connection_pool: - description: ConnectionPool represents the configurations for connection pool. - properties: - enable_rebalance: - type: boolean - old_conn_close_duration: - type: string - rebalance_duration: - type: string - resolve_dns: - type: boolean - size: - type: integer - type: object - dial_option: - description: DialOption represents the configurations for dial option. - properties: - backoff_base_delay: - type: string - backoff_jitter: - type: number - backoff_max_delay: - type: string - backoff_multiplier: - type: number - enable_backoff: - type: boolean - initial_connection_window_size: - type: integer - initial_window_size: - type: integer - insecure: - type: boolean - interceptors: - items: - type: string - type: array - keepalive: - description: GRPCClientKeepalive represents the configurations for gRPC keep-alive. - properties: - permit_without_stream: - type: boolean - time: - type: string - timeout: - type: string - type: object - max_msg_size: - type: integer - minimum_connection_timeout: - type: string - net: - description: Net represents the network configuration tcp, udp, unix domain socket. - properties: - dialer: - description: Dialer represents the configuration for dial. - properties: - dual_stack_enabled: - type: boolean - fallback_delay: - type: string - keepalive: - type: string - timeout: - type: string - type: object - dns: - description: DNS represents the configuration for resolving DNS. - properties: - cache_enabled: - type: boolean - cache_expiration: - type: string - refresh_duration: - type: string - type: object - socket_option: - description: SocketOption represents the socket configurations. - properties: - ip_recover_destination_addr: - type: boolean - ip_transparent: - type: boolean - reuse_addr: - type: boolean - reuse_port: - type: boolean - tcp_cork: - type: boolean - tcp_defer_accept: - type: boolean - tcp_fast_open: - type: boolean - tcp_no_delay: - type: boolean - tcp_quick_ack: - type: boolean - type: object - tls: - description: TLS represent the TLS configuration for server. - properties: - ca: - description: CA represent the CA certificate environment variable key used to start server. - type: string - cert: - description: Cert represent the certificate environment variable key used to start server. - type: string - enabled: - description: Enable represent the server enable TLS or not. - type: boolean - insecure_skip_verify: - description: InsecureSkipVerify represent enable/disable skip SSL certificate verification - type: boolean - key: - description: Key represent the private key environment variable key used to start server. - type: string - type: object - type: object - read_buffer_size: - type: integer - timeout: - type: string - write_buffer_size: - type: integer - type: object - health_check_duration: - type: string - tls: - description: TLS represent the TLS configuration for server. - properties: - ca: - description: CA represent the CA certificate environment variable key used to start server. - type: string - cert: - description: Cert represent the certificate environment variable key used to start server. - type: string - enabled: - description: Enable represent the server enable TLS or not. - type: boolean - insecure_skip_verify: - description: InsecureSkipVerify represent enable/disable skip SSL certificate verification - type: boolean - key: - description: Key represent the private key environment variable key used to start server. - type: string - type: object - type: object - required: - - job_type - - dimension - required: - - jobs - - dataset - - target diff --git a/internal/k8s/vald/benchmark/job/job_template.go b/internal/k8s/vald/benchmark/job/job_template.go index 884addcde5..0368e6a5b5 100644 --- a/internal/k8s/vald/benchmark/job/job_template.go +++ b/internal/k8s/vald/benchmark/job/job_template.go @@ -27,7 +27,8 @@ type benchmarkJobTemplate = batchv1.Job const ( SvcAccountName = "vald-benchmark-operator" ContainerName = "vald-benchmark-job" - ContainerImage = "local-registry:5000/vdaas/vald-benchmark-job:latest" + // TODO: Fix + ContainerImage = "vdaas/vald-benchmark-job:pr-2027" RestartPolicyAlways corev1.RestartPolicy = "Always" RestartPolicyOnFailure corev1.RestartPolicy = "OnFailure" diff --git a/internal/test/data/hdf5/hdf5_test.go b/internal/test/data/hdf5/hdf5_test.go new file mode 100644 index 0000000000..d308048781 --- /dev/null +++ b/internal/test/data/hdf5/hdf5_test.go @@ -0,0 +1,1447 @@ +// +// Copyright (C) 2019-2023 vdaas.org vald team +// +// 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. +// + +// Package hdf5 is load hdf5 file +package hdf5 + +import ( + "log" + "os" + "reflect" + "testing" + + "github.com/vdaas/vald/internal/errors" + "github.com/vdaas/vald/internal/test/goleak" + "gonum.org/v1/hdf5" +) + +func TestDatasetName_String(t *testing.T) { + type want struct { + want string + } + type test struct { + name string + d DatasetName + want want + checkFunc func(want, string) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got string) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got := test.d.String() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func TestDatasetUrl_String(t *testing.T) { + type want struct { + want string + } + type test struct { + name string + d DatasetUrl + want want + checkFunc func(want, string) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got string) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got := test.d.String() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_hdf5Key_String(t *testing.T) { + type want struct { + want string + } + type test struct { + name string + h hdf5Key + want want + checkFunc func(want, string) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got string) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got := test.h.String() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func TestNew(t *testing.T) { + type args struct { + opts []Option + } + type want struct { + want Data + err error + } + type test struct { + name string + args args + want want + checkFunc func(want, Data, error) error + beforeFunc func(*testing.T, args) + afterFunc func(*testing.T, args) + } + defaultCheckFunc := func(w want, got Data, err error) error { + if !errors.Is(err, w.err) { + return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) + } + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + args: args { + opts:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + args: args { + opts:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt, test.args) + } + if test.afterFunc != nil { + defer test.afterFunc(tt, test.args) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got, err := New(test.args.opts...) + if err := checkFunc(test.want, got, err); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_Download(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + err error + } + type test struct { + name string + fields fields + want want + checkFunc func(want, error) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, err error) error { + if !errors.Is(err, w.err) { + return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) + } + return nil + } + tests := []test{ + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + err := d.Download() + if err := checkFunc(test.want, err); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_Read(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + err error + } + type test struct { + name string + fields fields + want want + checkFunc func(want, error) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, err error) error { + if !errors.Is(err, w.err) { + return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + err := d.Read() + if err := checkFunc(test.want, err); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_GetName(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + want DatasetName + } + type test struct { + name string + fields fields + want want + checkFunc func(want, DatasetName) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got DatasetName) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + got := d.GetName() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_GetPath(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + want string + } + type test struct { + name string + fields fields + want want + checkFunc func(want, string) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got string) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + got := d.GetPath() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_GetByGroupName(t *testing.T) { + type args struct { + name string + } + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + want [][]float32 + } + type test struct { + name string + args args + fields fields + want want + checkFunc func(want, [][]float32) error + beforeFunc func(*testing.T, args) + afterFunc func(*testing.T, args) + } + defaultCheckFunc := func(w want, got [][]float32) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + args: args { + name:"", + }, + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + args: args { + name:"", + }, + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt, test.args) + } + if test.afterFunc != nil { + defer test.afterFunc(tt, test.args) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + got := d.GetByGroupName(test.args.name) + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_GetTrain(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + want [][]float32 + } + type test struct { + name string + fields fields + want want + checkFunc func(want, [][]float32) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got [][]float32) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + got := d.GetTrain() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_GetTest(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + want [][]float32 + } + type test struct { + name string + fields fields + want want + checkFunc func(want, [][]float32) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got [][]float32) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + got := d.GetTest() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_data_GetNeighbors(t *testing.T) { + type fields struct { + name DatasetName + path string + train [][]float32 + test [][]float32 + neighbors [][]int + } + type want struct { + want [][]int + } + type test struct { + name string + fields fields + want want + checkFunc func(want, [][]int) error + beforeFunc func(*testing.T) + afterFunc func(*testing.T) + } + defaultCheckFunc := func(w want, got [][]int) error { + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + fields: fields { + name:nil, + path:"", + train:nil, + test:nil, + neighbors:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T,) { + t.Helper() + }, + afterFunc: func(t *testing.T,) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt) + } + if test.afterFunc != nil { + defer test.afterFunc(tt) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + d := &data{ + name: test.fields.name, + path: test.fields.path, + train: test.fields.train, + test: test.fields.test, + neighbors: test.fields.neighbors, + } + + got := d.GetNeighbors() + if err := checkFunc(test.want, got); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func Test_downloadFile(t *testing.T) { + type args struct { + url string + path string + } + type want struct { + err error + } + type test struct { + name string + args args + want want + checkFunc func(want, error) error + beforeFunc func(*testing.T, args) + afterFunc func(*testing.T, args) + } + defaultBeforeFunc := func(t *testing.T, _ args) { + t.Helper() + err := os.Mkdir("tmp", os.ModePerm) + if err != nil { + log.Fatal(err) + } + } + defaultAfterFunc := func(t *testing.T, _ args) { + t.Helper() + err := os.RemoveAll("tmp") + if err != nil { + log.Fatal(err) + } + } + defaultCheckFunc := func(w want, err error) error { + if !errors.Is(err, w.err) { + return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) + } + return nil + } + tests := []test{ + { + name: "success download hdf5 file", + args: args{ + url: "https://ann-benchmarks.com/fashion-mnist-784-euclidean.hdf5", + path: "./tmp/data", + }, + want: want{ + err: nil, + }, + beforeFunc: defaultBeforeFunc, + afterFunc: defaultAfterFunc, + checkFunc: defaultCheckFunc, + }, + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt, test.args) + } + if test.afterFunc != nil { + defer test.afterFunc(tt, test.args) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + err := downloadFile(test.args.url, test.args.path) + if err := checkFunc(test.want, err); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func TestReadDatasetF32(t *testing.T) { + type args struct { + file *hdf5.File + key hdf5Key + } + type want struct { + want [][]float32 + err error + } + type test struct { + name string + args args + want want + checkFunc func(want, [][]float32, error) error + beforeFunc func(*testing.T, args) + afterFunc func(*testing.T, args) + } + defaultCheckFunc := func(w want, got [][]float32, err error) error { + if !errors.Is(err, w.err) { + return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) + } + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + args: args { + file:nil, + key:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + args: args { + file:nil, + key:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt, test.args) + } + if test.afterFunc != nil { + defer test.afterFunc(tt, test.args) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got, err := ReadDatasetF32(test.args.file, test.args.key) + if err := checkFunc(test.want, got, err); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} + +func TestReadDatasetI32(t *testing.T) { + type args struct { + file *hdf5.File + key hdf5Key + } + type want struct { + want [][]int32 + err error + } + type test struct { + name string + args args + want want + checkFunc func(want, [][]int32, error) error + beforeFunc func(*testing.T, args) + afterFunc func(*testing.T, args) + } + defaultCheckFunc := func(w want, got [][]int32, err error) error { + if !errors.Is(err, w.err) { + return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) + } + if !reflect.DeepEqual(got, w.want) { + return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) + } + return nil + } + tests := []test{ + // TODO test cases + /* + { + name: "test_case_1", + args: args { + file:nil, + key:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + }, + */ + + // TODO test cases + /* + func() test { + return test { + name: "test_case_2", + args: args { + file:nil, + key:nil, + }, + want: want{}, + checkFunc: defaultCheckFunc, + beforeFunc: func(t *testing.T, args args) { + t.Helper() + }, + afterFunc: func(t *testing.T, args args) { + t.Helper() + }, + } + }(), + */ + } + + for _, tc := range tests { + test := tc + t.Run(test.name, func(tt *testing.T) { + tt.Parallel() + defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) + if test.beforeFunc != nil { + test.beforeFunc(tt, test.args) + } + if test.afterFunc != nil { + defer test.afterFunc(tt, test.args) + } + checkFunc := test.checkFunc + if test.checkFunc == nil { + checkFunc = defaultCheckFunc + } + + got, err := ReadDatasetI32(test.args.file, test.args.key) + if err := checkFunc(test.want, got, err); err != nil { + tt.Errorf("error = %v", err) + } + }) + } +} diff --git a/k8s/tools/benchmark/operator/clusterrole.yaml b/k8s/tools/benchmark/operator/clusterrole.yaml index 0b64888989..70ac264c95 100644 --- a/k8s/tools/benchmark/operator/clusterrole.yaml +++ b/k8s/tools/benchmark/operator/clusterrole.yaml @@ -1,3 +1,4 @@ +--- # # Copyright (C) 2019-2023 vdaas.org vald team # @@ -16,7 +17,8 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: benchmark-operator-role + creationTimestamp: null + name: vald-benchmark-operator namespace: default rules: - apiGroups: @@ -47,6 +49,8 @@ rules: - vald.vdaas.org resources: - valdbenchmarkscenarios + - valdbenchmarkscenario + - valdbenchmarkjob - valdbenchmarkjobs verbs: - create @@ -60,13 +64,17 @@ rules: - vald.vdaas.org resources: - valdbenchmarkscenarios/finalizers + - valdbenchmarkscenario/finalizers + - valdbenchmarkjob/finalizers - valdbenchmarkjobs/finalizers verbs: - update - apiGroups: - vald.vdaas.org resources: + - valdbenchmarkscenario/status - valdbenchmarkscenarios/status + - valdbenchmarkjob/status - valdbenchmarkjobs/status verbs: - get diff --git a/k8s/tools/benchmark/operator/clusterrolebinding.yaml b/k8s/tools/benchmark/operator/clusterrolebinding.yaml index d450654516..ded68d5204 100644 --- a/k8s/tools/benchmark/operator/clusterrolebinding.yaml +++ b/k8s/tools/benchmark/operator/clusterrolebinding.yaml @@ -1,3 +1,4 @@ +--- # # Copyright (C) 2019-2023 vdaas.org vald team # @@ -13,15 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # -apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: benchmark-operator-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: benchmark-operator-role + name: vald-benchmark-operator + namespace: default subjects: - kind: ServiceAccount name: vald-benchmark-operator namespace: default +roleRef: + kind: ClusterRole + name: vald-benchmark-operator + apiGroup: rbac.authorization.k8s.io diff --git a/k8s/tools/benchmark/operator/configmap.yaml b/k8s/tools/benchmark/operator/configmap.yaml index 7ac38b6e51..05f7b34594 100644 --- a/k8s/tools/benchmark/operator/configmap.yaml +++ b/k8s/tools/benchmark/operator/configmap.yaml @@ -1,3 +1,4 @@ +--- # # Copyright (C) 2019-2023 vdaas.org vald team # @@ -18,68 +19,81 @@ kind: ConfigMap metadata: name: vald-benchmark-operator-config labels: - app.kubernetes.io/name: vald - app.kubernetes.io/component: vald-benchmark-operator + app.kubernetes.io/name: vald-benchmark-operator + helm.sh/chart: vald-benchmark-operator-v1.7.5 + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: release-name + app.kubernetes.io/version: v1.7.5 + app.kubernetes.io/component: benchmark-operator data: config.yaml: | --- version: v0.0.0 - time_zone: JST + time_zone: "" logging: - format: raw - level: debug - logger: glg + logger: "glg" + level: "debug" + format: "raw" server_config: servers: - name: grpc host: 0.0.0.0 port: 8081 + mode: GRPC + probe_wait_time: "3s" + network: "tcp" + socket_path: "" grpc: bidirectional_stream_concurrency: 20 connection_timeout: "" - header_table_size: 0 - initial_conn_window_size: 0 + max_receive_message_size: 0 + max_send_message_size: 0 initial_window_size: 0 - interceptors: [] + initial_conn_window_size: 0 keepalive: + max_conn_idle: "" max_conn_age: "" max_conn_age_grace: "" - max_conn_idle: "" - time: "" - timeout: "" - max_header_list_size: 0 - max_receive_message_size: 0 - max_send_message_size: 0 - read_buffer_size: 0 + time: "120s" + timeout: "30s" + min_time: "60s" + permit_without_stream: true write_buffer_size: 0 - mode: GRPC - probe_wait_time: 3s + read_buffer_size: 0 + max_header_list_size: 0 + header_table_size: 0 + interceptors: [] + enable_reflection: true restart: true health_check_servers: - name: liveness host: 0.0.0.0 port: 3000 + mode: "" + probe_wait_time: "3s" + network: "tcp" + socket_path: "" http: + shutdown_duration: "5s" handler_timeout: "" idle_timeout: "" read_header_timeout: "" read_timeout: "" - shutdown_duration: 5s write_timeout: "" - mode: "" - probe_wait_time: 3s - name: readiness host: 0.0.0.0 port: 3001 + mode: "" + probe_wait_time: "3s" + network: "tcp" + socket_path: "" http: + shutdown_duration: "0s" handler_timeout: "" idle_timeout: "" read_header_timeout: "" read_timeout: "" - shutdown_duration: 0s write_timeout: "" - mode: "" - probe_wait_time: 3s metrics_servers: startup_strategy: - liveness @@ -87,80 +101,40 @@ data: - readiness full_shutdown_duration: 600s tls: - ca: /path/to/ca - cert: /path/to/cert enabled: false - key: /path/to/key + cert: "/path/to/cert" + key: "/path/to/key" + ca: "/path/to/ca" + insecure_skip_verify: false observability: enabled: false - collector: - duration: 5s - metrics: - enable_cgo: true - enable_goroutine: true - enable_memory: true - enable_version_info: true - version_info_labels: - - vald_version - - server_name - - git_commit - - build_time - - go_version - - go_os - - go_arch - - ngt_version + otlp: + collector_endpoint: "" + trace_batch_timeout: "1s" + trace_export_timeout: "1m" + trace_max_export_batch_size: 1024 + trace_max_queue_size: 256 + metrics_export_interval: "1s" + metrics_export_timeout: "1m" + attribute: + namespace: "_MY_POD_NAMESPACE_" + pod_name: "_MY_POD_NAME_" + node_name: "_MY_NODE_NAME_" + service_name: "vald-benchmark-operator" + metrics: + enable_version_info: true + version_info_labels: + - vald_version + - server_name + - git_commit + - build_time + - go_version + - go_os + - go_arch + - ngt_version + enable_memory: true + enable_goroutine: true + enable_cgo: true trace: enabled: false sampling_rate: 1 - prometheus: - enabled: false - endpoint: /metrics - namespace: vald - jaeger: - enabled: false - collector_endpoint: "" - agent_endpoint: "jaeger-agent.default.svc.cluster.local:6831" - username: "" - password: "" - service_name: "vald-benchmark-job" - buffer_max_count: 10 - stackdriver: - project_id: "" - client: - api_key: "" - audiences: [] - authentication_enabled: true - credentials_file: "" - credentials_json: "" - endpoint: "" - quota_project: "" - request_reason: "" - scopes: [] - telemetry_enabled: true - user_agent: "" - exporter: - bundle_count_threshold: 0 - bundle_delay_threshold: "0" - location: "" - metric_prefix: vald.vdaas.org - monitoring_enabled: false - number_of_workers: 1 - reporting_interval: 1m - skip_cmd: false - timeout: 5s - trace_spans_buffer_max_bytes: 0 - tracing_enabled: false - profiler: - enabled: false - service: "vald-benchmark-job" - service_version: "" - debug_logging: false - mutex_profiling: true - cpu_profiling: true - alloc_profiling: true - heap_profiling: true - goroutine_profiling: true - alloc_force_gc: false - api_addr: "" - instance: "" - zone: "" diff --git a/k8s/tools/benchmark/operator/crds/valdbenchmarkjob.yaml b/k8s/tools/benchmark/operator/crds/valdbenchmarkjob.yaml new file mode 100644 index 0000000000..de85714816 --- /dev/null +++ b/k8s/tools/benchmark/operator/crds/valdbenchmarkjob.yaml @@ -0,0 +1,362 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: valdbenchmarkjobs.vald.vdaas.org +spec: + group: vald.vdaas.org + names: + kind: ValdBenchmarkJob + listKind: ValdBenchmarkJobList + plural: valdbenchmarkjobs + singular: valdbenchmarkjob + shortNames: + - vbj + - vbjs + scope: Namespaced + versions: + - name: v1 + served: true + storage: true + subresources: + status: {} + additionalPrinterColumns: + - jsonPath: .spec.replica + name: REPLICAS + type: integer + - jsonPath: .status + name: STATUS + type: string + schema: + openAPIV3Schema: + description: ValdBenchmarkJob is the Schema for the valdbenchmarkjobs API + type: object + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + status: + description: ValdBenchmarkJobStatus defines the observed state of ValdBenchmarkJob + enum: + - NotReady + - Completed + - Available + - Healthy + type: string + spec: + type: object + properties: + client_config: + type: object + properties: + addrs: + type: array + items: + type: string + backoff: + type: object + properties: + backoff_factor: + type: number + backoff_time_limit: + type: string + enable_error_log: + type: boolean + initial_duration: + type: string + jitter_limit: + type: string + maximum_duration: + type: string + retry_count: + type: integer + call_option: + type: object + x-kubernetes-preserve-unknown-fields: true + circuit_breaker: + type: object + properties: + closed_error_rate: + type: number + closed_refresh_timeout: + type: string + half_open_error_rate: + type: number + min_samples: + type: integer + open_timeout: + type: string + connection_pool: + type: object + properties: + enable_dns_resolver: + type: boolean + enable_rebalance: + type: boolean + old_conn_close_duration: + type: string + rebalance_duration: + type: string + size: + type: integer + dial_option: + type: object + properties: + backoff_base_delay: + type: string + backoff_jitter: + type: number + backoff_max_delay: + type: string + backoff_multiplier: + type: number + enable_backoff: + type: boolean + initial_connection_window_size: + type: integer + initial_window_size: + type: integer + insecure: + type: boolean + interceptors: + type: array + items: + type: string + enum: + - TraceInterceptor + keepalive: + type: object + properties: + permit_without_stream: + type: boolean + time: + type: string + timeout: + type: string + max_msg_size: + type: integer + min_connection_timeout: + type: string + net: + type: object + properties: + dialer: + type: object + properties: + dual_stack_enabled: + type: boolean + keepalive: + type: string + timeout: + type: string + dns: + type: object + properties: + cache_enabled: + type: boolean + cache_expiration: + type: string + refresh_duration: + type: string + socket_option: + type: object + properties: + ip_recover_destination_addr: + type: boolean + ip_transparent: + type: boolean + reuse_addr: + type: boolean + reuse_port: + type: boolean + tcp_cork: + type: boolean + tcp_defer_accept: + type: boolean + tcp_fast_open: + type: boolean + tcp_no_delay: + type: boolean + tcp_quick_ack: + type: boolean + tls: + type: object + properties: + ca: + type: string + cert: + type: string + enabled: + type: boolean + insecure_skip_verify: + type: boolean + key: + type: string + read_buffer_size: + type: integer + timeout: + type: string + write_buffer_size: + type: integer + health_check_duration: + type: string + max_recv_msg_size: + type: integer + max_retry_rpc_buffer_size: + type: integer + max_send_msg_size: + type: integer + tls: + type: object + properties: + ca: + type: string + cert: + type: string + enabled: + type: boolean + insecure_skip_verify: + type: boolean + key: + type: string + wait_for_ready: + type: boolean + dataset: + type: object + properties: + group: + type: string + minLength: 1 + indexes: + type: integer + minimum: 0 + name: + type: string + enum: + - fashion-mnist + range: + type: object + properties: + end: + type: integer + minimum: 1 + start: + type: integer + minimum: 1 + required: + - name + - indexes + - group + - range + dimension: + type: integer + minimum: 1 + insert_config: + type: object + properties: + skip_strict_exist_check: + type: boolean + timestamp: + type: string + job_type: + type: string + enum: + - insert + - update + - upsert + - search + - remove + - get_object + - exists + object_config: + type: object + properties: + filter_config: + type: object + properties: + host: + type: string + remove_config: + type: object + properties: + skip_strict_exist_check: + type: boolean + timestamp: + type: string + repetition: + type: integer + minimum: 1 + replica: + type: integer + minimum: 1 + rps: + type: integer + maximum: 65535 + minimum: 0 + rules: + type: array + items: + type: string + search_config: + type: object + properties: + epsilon: + type: number + min_num: + type: integer + num: + type: integer + radius: + type: number + timeout: + type: string + target: + type: object + properties: + host: + type: string + minLength: 1 + port: + type: integer + maximum: 65535 + minimum: 0 + required: + - host + - port + update_config: + type: object + properties: + disable_balance_update: + type: boolean + skip_strict_exist_check: + type: boolean + timestamp: + type: string + upsert_config: + type: object + properties: + disable_balance_update: + type: boolean + skip_strict_exist_check: + type: boolean + timestamp: + type: string diff --git a/k8s/tools/benchmark/operator/crds/valdbenchmarkoperatorrelease.yaml b/k8s/tools/benchmark/operator/crds/valdbenchmarkoperatorrelease.yaml new file mode 100644 index 0000000000..3451a48b38 --- /dev/null +++ b/k8s/tools/benchmark/operator/crds/valdbenchmarkoperatorrelease.yaml @@ -0,0 +1,510 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: valdbenchmarkoperatorreleases.vald.vdaas.org +spec: + group: vald.vdaas.org + names: + kind: ValdBenchmarkOperatorRelease + listKind: ValdBenchmarkOperatorReleaseList + plural: valdbenchmarkoperatorreleases + singular: valdbenchmarkoperatorrelease + shortNames: + - vbor + - vbors + scope: Namespaced + versions: + - name: v1 + served: true + storage: true + subresources: + status: {} + additionalPrinterColumns: + - jsonPath: .status + name: STATUS + type: string + schema: + openAPIV3Schema: + description: ValdBenchmarkScenario is the Schema for the valdbenchmarkscenarios API + type: object + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + status: + description: ValdBenchmarkScenarioStatus defines the observed state of ValdBenchmarkScenario + enum: + - NotReady + - Completed + - Available + - Healthy + type: string + spec: + type: object + properties: + affinity: + type: object + x-kubernetes-preserve-unknown-fields: true + annotations: + type: object + x-kubernetes-preserve-unknown-fields: true + image: + type: object + properties: + pullPolicy: + type: string + enum: + - Always + - Never + - IfNotPresent + repository: + type: string + tag: + type: string + logging: + type: object + properties: + format: + type: string + enum: + - raw + - json + level: + type: string + enum: + - debug + - info + - warn + - error + - fatal + logger: + type: string + enum: + - glg + - zap + name: + type: string + nodeSelector: + type: object + x-kubernetes-preserve-unknown-fields: true + observability: + type: object + properties: + enabled: + type: boolean + otlp: + type: object + properties: + attribute: + type: object + properties: + metrics: + type: object + properties: + enable_cgo: + type: boolean + enable_goroutine: + type: boolean + enable_memory: + type: boolean + enable_version_info: + type: boolean + version_info_labels: + type: array + items: + type: string + namespace: + type: string + node_name: + type: string + pod_name: + type: string + service_name: + type: string + collector_endpoint: + type: string + metrics_export_interval: + type: string + metrics_export_timeout: + type: string + trace_batch_timeout: + type: string + trace_export_timeout: + type: string + trace_max_export_batch_size: + type: integer + trace_max_queue_size: + type: integer + trace: + type: object + properties: + enabled: + type: boolean + sampling_rate: + type: integer + podAnnotations: + type: object + x-kubernetes-preserve-unknown-fields: true + podSecurityContext: + type: object + x-kubernetes-preserve-unknown-fields: true + rbac: + type: object + properties: + create: + type: boolean + name: + type: string + replicas: + type: integer + resources: + type: object + properties: + limits: + type: object + x-kubernetes-preserve-unknown-fields: true + requests: + type: object + x-kubernetes-preserve-unknown-fields: true + securityContext: + type: object + x-kubernetes-preserve-unknown-fields: true + server_config: + type: object + properties: + full_shutdown_duration: + type: string + healths: + type: object + properties: + liveness: + type: object + properties: + enabled: + type: boolean + host: + type: string + livenessProbe: + type: object + properties: + failureThreshold: + type: integer + httpGet: + type: object + properties: + path: + type: string + port: + type: string + scheme: + type: string + initialDelaySeconds: + type: integer + periodSeconds: + type: integer + successThreshold: + type: integer + timeoutSeconds: + type: integer + port: + type: integer + server: + type: object + properties: + http: + type: object + properties: + idle_timeout: + type: string + read_header_timeout: + type: string + read_timeout: + type: string + shutdown_duration: + type: string + timeout: + type: string + write_timeout: + type: string + mode: + type: string + network: + type: string + probe_wait_time: + type: string + socket_path: + type: string + servicePort: + type: integer + readiness: + type: object + properties: + enabled: + type: boolean + host: + type: string + port: + type: integer + readinessProbe: + type: object + properties: + failureThreshold: + type: integer + httpGet: + type: object + properties: + path: + type: string + port: + type: string + scheme: + type: string + initialDelaySeconds: + type: integer + periodSeconds: + type: integer + successThreshold: + type: integer + timeoutSeconds: + type: integer + server: + type: object + properties: + http: + type: object + properties: + handler_timeout: + type: string + idle_timeout: + type: string + read_header_timeout: + type: string + read_timeout: + type: string + shutdown_duration: + type: string + write_timeout: + type: string + mode: + type: string + network: + type: string + probe_wait_time: + type: string + socket_path: + type: string + servicePort: + type: integer + startup: + type: object + properties: + enabled: + type: boolean + startupProbe: + type: object + properties: + failureThreshold: + type: integer + httpGet: + type: object + properties: + path: + type: string + port: + type: string + scheme: + type: string + initialDelaySeconds: + type: integer + periodSeconds: + type: integer + successThreshold: + type: integer + timeoutSeconds: + type: integer + metrics: + type: object + properties: + pprof: + type: object + properties: + enabled: + type: boolean + host: + type: string + port: + type: integer + server: + type: object + properties: + http: + type: object + properties: + handler_timeout: + type: string + idle_timeout: + type: string + read_header_timeout: + type: string + read_timeout: + type: string + shutdown_duration: + type: string + write_timeout: + type: string + mode: + type: string + network: + type: string + probe_wait_time: + type: string + socket_path: + type: string + servers: + type: object + properties: + grpc: + type: object + properties: + enabled: + type: boolean + host: + type: string + name: + type: string + port: + type: integer + server: + type: object + properties: + grpc: + type: object + properties: + bidirectional_stream_concurrency: + type: integer + connection_timeout: + type: string + enable_reflection: + type: boolean + header_table_size: + type: integer + initial_conn_window_size: + type: integer + initial_window_size: + type: integer + interceptors: + type: array + items: + type: string + keepalive: + type: object + properties: + max_conn_age: + type: string + max_conn_age_grace: + type: string + max_conn_idle: + type: string + min_time: + type: string + permit_without_stream: + type: boolean + time: + type: string + timeout: + type: string + max_header_list_size: + type: integer + max_receive_message_size: + type: integer + max_send_msg_size: + type: integer + read_buffer_size: + type: integer + write_buffer_size: + type: integer + mode: + type: string + network: + type: string + probe_wait_time: + type: string + restart: + type: boolean + socket_path: + type: string + servicePort: + type: integer + rest: + type: object + properties: + enabled: + type: boolean + tls: + type: object + properties: + ca: + type: string + cert: + type: string + enabled: + type: boolean + insecure_skip_verify: + type: boolean + key: + type: string + service: + type: object + properties: + annotations: + type: object + x-kubernetes-preserve-unknown-fields: true + enabled: + type: boolean + externalTrafficPolicy: + type: string + labels: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + enum: + - ClusterIP + - LoadBalancer + - NodePort + serviceAccount: + type: object + properties: + create: + type: boolean + name: + type: string + time_zone: + type: string + tolerations: + type: array + items: + type: object + x-kubernetes-preserve-unknown-fields: true + version: + type: string diff --git a/k8s/tools/benchmark/operator/crds/valdbenchmarkscenario.yaml b/k8s/tools/benchmark/operator/crds/valdbenchmarkscenario.yaml new file mode 100644 index 0000000000..f705e7df6b --- /dev/null +++ b/k8s/tools/benchmark/operator/crds/valdbenchmarkscenario.yaml @@ -0,0 +1,109 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: valdbenchmarkscenarios.vald.vdaas.org +spec: + group: vald.vdaas.org + names: + kind: ValdBenchmarkScenario + listKind: ValdBenchmarkScenarioList + plural: valdbenchmarkscenarios + singular: valdbenchmarkscenario + shortNames: + - vbo + - vbos + scope: Namespaced + versions: + - name: v1 + served: true + storage: true + subresources: + status: {} + additionalPrinterColumns: + - jsonPath: .status + name: STATUS + type: string + schema: + openAPIV3Schema: + description: ValdBenchmarkScenario is the Schema for the valdbenchmarkscenarios API + type: object + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + status: + description: ValdBenchmarkScenarioStatus defines the observed state of ValdBenchmarkScenario + enum: + - NotReady + - Completed + - Available + - Healthy + type: string + spec: + type: object + properties: + dataset: + type: object + properties: + group: + type: string + minLength: 1 + indexes: + type: integer + minimum: 0 + name: + type: string + enum: + - fashion-mnist + range: + type: object + properties: + end: + type: integer + minimum: 1 + start: + type: integer + minimum: 1 + required: + - name + - indexes + - group + - range + jobs: + type: array + items: + type: object + x-kubernetes-preserve-unknown-fields: true + target: + type: object + properties: + host: + type: string + minLength: 1 + port: + type: integer + maximum: 65535 + minimum: 0 + required: + - host + - port diff --git a/k8s/tools/benchmark/operator/deployment.yaml b/k8s/tools/benchmark/operator/deployment.yaml index a5a5bd241b..7930e06334 100644 --- a/k8s/tools/benchmark/operator/deployment.yaml +++ b/k8s/tools/benchmark/operator/deployment.yaml @@ -1,3 +1,4 @@ +--- # # Copyright (C) 2019-2023 vdaas.org vald team # @@ -17,25 +18,63 @@ apiVersion: apps/v1 kind: Deployment metadata: name: vald-benchmark-operator + namespace: default labels: app: vald-benchmark-operator + app.kubernetes.io/name: vald-benchmark-operator + helm.sh/chart: vald-benchmark-operator-v1.7.5 + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: release-name + app.kubernetes.io/version: v1.7.5 + app.kubernetes.io/component: benchmark-operator spec: replicas: 1 selector: matchLabels: - app: vald-benchmark-operator + name: vald-benchmark-operator template: metadata: labels: - app: vald-benchmark-operator + name: vald-benchmark-operator + app.kubernetes.io/name: vald-benchmark-operator + app.kubernetes.io/instance: release-name + app.kubernetes.io/component: benchmark-operator spec: + serviceAccountName: vald-benchmark-operator containers: - name: vald-benchmark-operator - image: vdaas/vald-benchmark-operator:latest + image: "vdaas/vald-benchmark-operator:v1.7.5" imagePullPolicy: Always - volumeMounts: - - name: vald-benchmark-operator-config - mountPath: /etc/server/ + livenessProbe: + failureThreshold: 2 + httpGet: + path: /liveness + port: liveness + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 20 + successThreshold: 1 + timeoutSeconds: 5 + readinessProbe: + failureThreshold: 2 + httpGet: + path: /readiness + port: readiness + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 3 + successThreshold: 1 + timeoutSeconds: 2 + startupProbe: + failureThreshold: 30 + httpGet: + path: /liveness + port: liveness + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 2 ports: - name: liveness protocol: TCP @@ -43,7 +82,25 @@ spec: - name: readiness protocol: TCP containerPort: 3001 - serviceAccountName: vald-benchmark-operator + - name: grpc + protocol: TCP + containerPort: 8081 + - name: pprof + protocol: TCP + containerPort: 6060 + resources: + limits: + cpu: 300m + memory: 300Mi + requests: + cpu: 200m + memory: 200Mi + volumeMounts: + - name: vald-benchmark-operator-config + mountPath: /etc/server + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + restartPolicy: Always volumes: - name: vald-benchmark-operator-config configMap: diff --git a/k8s/tools/benchmark/operator/service.yaml b/k8s/tools/benchmark/operator/service.yaml new file mode 100644 index 0000000000..0cb8ba3770 --- /dev/null +++ b/k8s/tools/benchmark/operator/service.yaml @@ -0,0 +1,38 @@ +--- +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# 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. +# +apiVersion: v1 +kind: Service +metadata: + name: vald-benchmark-operator + labels: + app.kubernetes.io/name: vald-benchmark-operator + helm.sh/chart: vald-benchmark-operator-v1.7.5 + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: release-name + app.kubernetes.io/version: v1.7.5 + app.kubernetes.io/component: helm-operator +spec: + ports: + - name: prometheus + port: 6060 + targetPort: 6060 + protocol: TCP + selector: + app.kubernetes.io/name: vald-benchmark-operator + app.kubernetes.io/component: helm-operator + clusterIP: None + type: ClusterIP diff --git a/k8s/tools/benchmark/operator/serviceaccount.yaml b/k8s/tools/benchmark/operator/serviceaccount.yaml index 617a413a16..cf7ac3908d 100644 --- a/k8s/tools/benchmark/operator/serviceaccount.yaml +++ b/k8s/tools/benchmark/operator/serviceaccount.yaml @@ -1,3 +1,4 @@ +--- # # Copyright (C) 2019-2023 vdaas.org vald team #