Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #2832 to release/v1.7 for Add metadata to target host for benchmark job #2870

Conversation

vdaas-ci
Copy link
Collaborator

@vdaas-ci vdaas-ci commented Feb 19, 2025

Description

SSIA

Related Issue

Versions

  • Vald Version: v1.7.16
  • Go Version: v1.23.5
  • Rust Version: v1.83.0
  • Docker Version: v27.4.0
  • Kubernetes Version: v1.32.0
  • Helm Version: v3.16.3
  • NGT Version: v2.3.5
  • Faiss Version: v1.9.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • New Features
    • Introduced a flexible metadata field for benchmark job and scenario configurations. Users can now include additional custom key-value data, including tokens, in the target settings.
    • Expanded the configuration schemas and deployment settings to support optional metadata, enhancing the customization and integration capabilities without altering existing functionality.

* ✨ update chart

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

* ♻️ Bind metadata

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

* ♻️ update charts

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

---------

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

cloudflare-workers-and-pages bot commented Feb 19, 2025

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 570875e
Status: ✅  Deploy successful!
Preview URL: https://0dee9737.vald.pages.dev
Branch Preview URL: https://backport-release-v1-7-impl-b.vald.pages.dev

View logs

Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

📝 Walkthrough

Walkthrough

The changes add a new meta property within the target section across multiple configuration files, JSON/YAML schemas, CRDs, and Helm values. Internally, the modifications extend the configuration structs and introduce utility functions and options to propagate metadata via gRPC. The additions include both schema modifications and code-level changes to support metadata handling in benchmark jobs and scenarios without altering existing required configurations.

Changes

File(s) Group Change Summary
charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml, charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml, k8s/.../crds/valdbenchmarkjob.yaml, k8s/.../crds/valdbenchmarkscenario.yaml Added a new property meta of type object under spec.target with the annotation x-kubernetes-preserve-unknown-fields: true in CRDs.
charts/vald-benchmark-operator/schemas/job-values.schema.json, charts/vald-benchmark-operator/schemas/scenario-values.schema.json Augmented JSON schemas by adding a meta property with the description "metadata for target host."
charts/vald-benchmark-operator/schemas/job-values.yaml, charts/vald-benchmark-operator/schemas/scenario-values.yaml Introduced a meta object containing key-value pairs under the target section in YAML schemas.
charts/vald-benchmark-operator/values/benchmark-job.yaml, charts/vald-benchmark-operator/values/benchmark-scenario.yaml, example/helm/benchmark/job-values.yaml, example/helm/benchmark/scenario-values.yaml Added a meta field with a token key ("sample-token") in the target section for benchmark job/scenario values.
internal/config/benchmark.go Added a Meta map[string]string field to the BenchmarkTarget struct.
internal/net/grpc/metadata.go Introduced a new function NewMetadata to create gRPC metadata from a map.
pkg/tools/benchmark/job/service/job.go Added a meta grpc.MD field to the job struct and modified the Start method to wrap the context with metadata if present.
pkg/tools/benchmark/job/service/option.go Added a new function WithMetadata to set metadata on job options using grpc.NewMetadata.
pkg/tools/benchmark/job/usecase/benchmarkd.go Updated the job initialization to pass metadata via service.WithMetadata(cfg.Job.Target.Meta).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant JobService
    participant GRPC
    Client->>JobService: Submit job configuration (includes target.meta)
    JobService->>JobService: Initialize job with metadata option (WithMetadata)
    JobService->>GRPC: Create metadata using NewMetadata(map)
    JobService->>JobService: Wrap original context with metadata (NewOutgoingContext)
    JobService->>Client: Execute job using updated context
Loading

Possibly related PRs

Suggested labels

priority/low, size/XXXL, area/helm, area/internal, type/feature, actions/backport/release/v1.7

Suggested reviewers

  • vankichi
  • kmrmt

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 golangci-lint (1.62.2)

level=warning msg="[config_reader] The configuration option run.skip-dirs is deprecated, please use issues.exclude-dirs."
level=warning msg="[config_reader] The configuration option output.format is deprecated, please use output.formats"
level=warning msg="[config_reader] The configuration option linters.govet.check-shadowing is deprecated. Please enable shadow instead, if you are not using enable-all."
Error: can't load config: the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)
Failed executing command with error: can't load config: the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml (1)

108-110: Metadata Schema Addition in CRD:
The addition of the meta field under the target section—with type: object and x-kubernetes-preserve-unknown-fields: true—is implemented correctly. This provides the flexibility to include additional metadata without enforcing a strict structure.

Consider adding a brief descriptive comment that explains the intended usage of the meta field to aid future maintainers.

charts/vald-benchmark-operator/schemas/scenario-values.yaml (1)

26-30: Metadata Schema Definition in JSON Schema:
The update adds a meta object with fixed subfields key and value, which clearly documents the metadata structure for the target host.

Consider whether a more flexible map structure (allowing arbitrary key-value pairs) might be beneficial in the long term, should additional metadata fields be needed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8810da7 and 570875e.

📒 Files selected for processing (17)
  • charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml (1 hunks)
  • charts/vald-benchmark-operator/crds/valdbenchmarkscenario.yaml (1 hunks)
  • charts/vald-benchmark-operator/schemas/job-values.schema.json (1 hunks)
  • charts/vald-benchmark-operator/schemas/job-values.yaml (1 hunks)
  • charts/vald-benchmark-operator/schemas/scenario-values.schema.json (1 hunks)
  • charts/vald-benchmark-operator/schemas/scenario-values.yaml (1 hunks)
  • charts/vald-benchmark-operator/values/benchmark-job.yaml (1 hunks)
  • charts/vald-benchmark-operator/values/benchmark-scenario.yaml (1 hunks)
  • example/helm/benchmark/job-values.yaml (1 hunks)
  • example/helm/benchmark/scenario-values.yaml (1 hunks)
  • internal/config/benchmark.go (1 hunks)
  • internal/net/grpc/metadata.go (1 hunks)
  • k8s/tools/benchmark/operator/crds/valdbenchmarkjob.yaml (1 hunks)
  • k8s/tools/benchmark/operator/crds/valdbenchmarkscenario.yaml (1 hunks)
  • pkg/tools/benchmark/job/service/job.go (3 hunks)
  • pkg/tools/benchmark/job/service/option.go (2 hunks)
  • pkg/tools/benchmark/job/usecase/benchmarkd.go (1 hunks)
🔇 Additional comments (15)
internal/net/grpc/metadata.go (1)

28-30: LGTM!

The NewMetadata function is a clean and focused wrapper around metadata.New. It follows the package's naming conventions and is well-placed in the grpc package.

pkg/tools/benchmark/job/service/option.go (1)

260-268: LGTM!

The WithMetadata function is well-documented and follows the established option pattern. It includes proper validation by checking for non-empty map before setting metadata.

pkg/tools/benchmark/job/usecase/benchmarkd.go (1)

128-128: LGTM!

The addition of metadata configuration to job service initialization is clean and aligns with the PR objectives.

pkg/tools/benchmark/job/service/job.go (2)

84-88: LGTM! Clean addition of metadata field.

The meta field is appropriately typed as grpc.MD for gRPC metadata handling.


290-295: LGTM! Proper metadata propagation implementation.

The implementation correctly:

  • Only creates new context when metadata exists
  • Uses debug logging for observability
  • Properly propagates metadata via gRPC context
charts/vald-benchmark-operator/values/benchmark-job.yaml (1)

46-47: LGTM! Clear example of metadata configuration.

The metadata configuration provides a clear example with a token, which is helpful for users implementing authentication.

charts/vald-benchmark-operator/schemas/scenario-values.schema.json (1)

59-59: LGTM! Well-defined schema for metadata.

The metadata schema is:

  • Correctly typed as an object
  • Well-documented with a clear description
  • Optional, maintaining backward compatibility
example/helm/benchmark/job-values.yaml (1)

57-58: LGTM! Consistent example configuration.

The metadata example aligns with the schema and other configuration files, providing a clear template for users.

k8s/tools/benchmark/operator/crds/valdbenchmarkscenario.yaml (1)

108-110: Consistent Metadata Schema in Internal CRD:
The new meta property is added in a consistent manner within the internal CRD definition. The use of x-kubernetes-preserve-unknown-fields: true ensures that any extra key-value metadata is preserved correctly.

charts/vald-benchmark-operator/values/benchmark-scenario.yaml (1)

179-180: Metadata Token in Scenario Values:
The new meta field with the token key is correctly integrated into the target section. This sample token ("sample-token") aligns with the intended use of metadata for target configuration in benchmark scenarios.

Please confirm that the sample value meets the requirements for your environment, and update it if necessary.

example/helm/benchmark/scenario-values.yaml (1)

199-200: Metadata Token Addition in Helm Values:
The addition of the meta field containing the token key is correctly applied, ensuring consistency with similar changes in other configuration files.

charts/vald-benchmark-operator/crds/valdbenchmarkjob.yaml (1)

793-795: New meta property added in CRD.
The new meta field under the target properties is correctly defined as an object and includes the annotation x-kubernetes-preserve-unknown-fields: true. This allows users to pass arbitrary metadata without schema validation issues. Ensure downstream tools and documentation are updated to reflect this new capability.

k8s/tools/benchmark/operator/crds/valdbenchmarkjob.yaml (1)

793-795: Consistent addition of the meta field in the operator CRD.
The new meta field, together with its preservation annotation, is properly integrated in the target section. This change mirrors similar modifications in other CRDs, ensuring consistency across configurations.

charts/vald-benchmark-operator/schemas/job-values.schema.json (1)

1199-1199: Added meta property to JSON schema.
The new "meta" property is defined as an object with a clear description ("metadata for target host"). This extension increases schema flexibility without affecting existing properties.

charts/vald-benchmark-operator/schemas/job-values.yaml (1)

26-30: New meta object added in target configuration.
The diff introduces a meta section with key and value fields under the target object. This structured approach to including metadata for the target host is clear and consistent. Consider documenting the accepted values and usage scenarios for better end-user guidance.

@vdaas-ci
Copy link
Collaborator Author

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

@vdaas-ci
Copy link
Collaborator Author

[WARNING:INTCFG] Changes in interal/config may require you to change Helm charts. Please check.

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Please upload report for BASE (release/v1.7@8810da7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/tools/benchmark/job/service/job.go 0.00% 6 Missing ⚠️
pkg/tools/benchmark/job/service/option.go 0.00% 6 Missing ⚠️
pkg/tools/benchmark/job/usecase/benchmarkd.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##             release/v1.7    #2870   +/-   ##
===============================================
  Coverage                ?   16.92%           
===============================================
  Files                   ?      136           
  Lines                   ?    15057           
  Branches                ?        0           
===============================================
  Hits                    ?     2548           
  Misses                  ?    12210           
  Partials                ?      299           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vankichi vankichi merged commit 685a7d2 into release/v1.7 Feb 20, 2025
159 of 160 checks passed
@vankichi vankichi deleted the backport/release/v1.7/impl/benchmark/add-metadata-to-target-host branch February 20, 2025 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants