Skip to content

Add Bulk Profile, Cluster Config & Recommendation Settings classes - #33

Open
bharathappali wants to merge 6 commits into
kruize:mvp_demofrom
bharathappali:feat-bulk-prof-3
Open

Add Bulk Profile, Cluster Config & Recommendation Settings classes#33
bharathappali wants to merge 6 commits into
kruize:mvp_demofrom
bharathappali:feat-bulk-prof-3

Conversation

@bharathappali

@bharathappali bharathappali commented Jun 25, 2026

Copy link
Copy Markdown
Member

This PR is built on top of #32

#32 needs to be merged before this PR

This PR adds Bulk Profile, Cluster Config & Recommendation Settings classes

Summary by Sourcery

Introduce bulk profile support in the optimizer client and data model to represent bulk profiles, cluster configuration, and recommendation settings.

New Features:

  • Add client API endpoints to fetch bulk profiles and individual bulk profile details from the optimizer service.
  • Define BulkProfile model to represent bulk optimization profiles including webhook configuration and lifecycle metadata.
  • Define ClusterConfig model to capture per-cluster targeting details such as datasources, namespaces, labels, experiment types, and metadata profile.
  • Define RecommendationSettings model to describe recommendation scheduling, terms, models, and measurement duration for bulk profiles.

Enhancements:

  • Extend optimizer client constants with bulk profile endpoint and query parameter names to support the new bulk profile APIs.

Signed-off-by: bharathappali <abharath@redhat.com>
@sourcery-ai

sourcery-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds client support and model classes for Kruize bulk profile APIs, including BulkProfile, ClusterConfig, and RecommendationSettings, wired via new constants and GET endpoints.

Sequence diagram for bulk profile retrieval via KruizeClient

sequenceDiagram
actor ClientApp
participant KruizeClient
participant KruizeService

alt all_profiles
  ClientApp->>KruizeClient: getBulkProfiles()
  KruizeClient->>KruizeService: GET /bulkProfiles
  KruizeService-->>KruizeClient: BulkProfile[] JSON
  KruizeClient-->>ClientApp: BulkProfile[]
else single_profile
  ClientApp->>KruizeClient: getBulkProfile(profileName)
  KruizeClient->>KruizeService: GET /bulkProfiles?profile_name=profileName
  KruizeService-->>KruizeClient: BulkProfile JSON
  KruizeClient-->>ClientApp: BulkProfile
end
Loading

File-Level Changes

Change Details Files
Extend KruizeClient with bulk profile retrieval endpoints.
  • Add getBulkProfiles() for listing bulk profiles via BULK_PROFILES_ENDPOINT.
  • Add getBulkProfile(profileName) to fetch a single bulk profile by name via query parameter.
  • Annotate new methods with JAX-RS @get, @path, and @produces for JSON responses.
src/main/java/com/kruize/optimizer/client/KruizeClient.java
Introduce constants for bulk profile API paths and query parameters.
  • Define BULK_PROFILES_ENDPOINT for bulk profile-related API routes.
  • Add PROFILE_NAME constant for bulk profile name query parameter.
src/main/java/com/kruize/optimizer/utils/OptimizerConstants.java
Add BulkProfile model representing Kruize bulk profiles.
  • Define fields for profile metadata, clusters, recommendation settings, webhook URL, enabled flag, and timestamps.
  • Annotate fields with @JsonProperty to align with Kruize bulk profile JSON schema.
  • Provide constructors, getters, and setters for all fields.
src/main/java/com/kruize/optimizer/model/kruize/BulkProfile.java
Add ClusterConfig model to represent per-cluster configuration in a bulk profile.
  • Define fields for cluster name, datasources, namespaces, labels, experiment types, and metadata profile.
  • Annotate fields with @JsonProperty for JSON mapping.
  • Provide constructors, getters, and setters.
src/main/java/com/kruize/optimizer/model/kruize/ClusterConfig.java
Add RecommendationSettings model to capture recommendation-related configuration in a bulk profile.
  • Define fields for scheduling, terms, models, and measurement duration.
  • Annotate fields with @JsonProperty for JSON mapping.
  • Provide constructors, getters, and setters.
src/main/java/com/kruize/optimizer/model/kruize/RecommendationSettings.java

Possibly linked issues

  • #Implement Bulk Profile API Integration for Dynamic Scheduling: PR implements bulk profile data models and client endpoints, covering key parts of the Bulk Profile API integration issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The bulk profile model classes use String for timestamp fields (createdAt, updatedAt) and other structured values like measurementDuration; consider using more specific types (e.g., Instant, Duration) to make parsing/validation less error-prone.
  • Several fields that have constrained domains (scheduling, experimentTypes, models, datasources) are represented as plain strings; introducing enums or dedicated value objects would help prevent invalid values and clarify expected options.
  • The new client methods for bulk profiles currently return raw String; if possible, consider returning typed model objects (e.g., BulkProfile or List<BulkProfile>) to avoid manual JSON handling and improve type safety in callers.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The bulk profile model classes use `String` for timestamp fields (`createdAt`, `updatedAt`) and other structured values like `measurementDuration`; consider using more specific types (e.g., `Instant`, `Duration`) to make parsing/validation less error-prone.
- Several fields that have constrained domains (`scheduling`, `experimentTypes`, `models`, `datasources`) are represented as plain strings; introducing enums or dedicated value objects would help prevent invalid values and clarify expected options.
- The new client methods for bulk profiles currently return raw `String`; if possible, consider returning typed model objects (e.g., `BulkProfile` or `List<BulkProfile>`) to avoid manual JSON handling and improve type safety in callers.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@bharathappali
bharathappali changed the base branch from main to mvp_demo June 25, 2026 12:10
@bharathappali bharathappali moved this to Under Review in Monitoring Jun 26, 2026
Signed-off-by: bharathappali <abharath@redhat.com>
Signed-off-by: bharathappali <abharath@redhat.com>
Signed-off-by: bharathappali <abharath@redhat.com>
Signed-off-by: bharathappali <abharath@redhat.com>
Signed-off-by: bharathappali <abharath@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Under Review

Development

Successfully merging this pull request may close these issues.

1 participant