Skip to content

Use manifests specific to kruize-demos which runs load internally for techempower and petclinic benchmarks#177

Merged
dinogun merged 7 commits intokruize:mainfrom
kusumachalasani:internal_load
Apr 7, 2026
Merged

Use manifests specific to kruize-demos which runs load internally for techempower and petclinic benchmarks#177
dinogun merged 7 commits intokruize:mainfrom
kusumachalasani:internal_load

Conversation

@kusumachalasani
Copy link
Copy Markdown
Contributor

@kusumachalasani kusumachalasani commented Feb 27, 2026

Instead of running load externally in a tfb-benchmark, use the manifests of the benchmark which runs the load internally in the tfb-qrh pod.

Uses the manifests from kruize/benchmarks#71

Summary by Sourcery

Update local monitoring benchmark setup to run TechEmpower load generation from within the tfb container/manifests instead of externally and align helper script parameters with the new behavior.

Enhancements:

  • Adjust benchmark installation to use the internal tfb runtime manifests and simplify load application to target the second benchmark only.
  • Refine apply_benchmark_load helper to treat petclinic consistently as the primary benchmark argument and remove the unused secondary benchmark parameter.

Summary by Sourcery

Switch local monitoring demo benchmarks to use kruize-demos-specific manifests and internal load generation for TechEmpower and Petclinic, while centralizing Quarkus pod labeling and monitoring setup.

Enhancements:

  • Clean up existing TechEmpower and Petclinic load jobs before reinstalling benchmarks in the local demo setup.
  • Update benchmark installation to accept a manifests variant (e.g., kruize-demos) and apply Petclinic manifests from that path.
  • Remove the secondary benchmark parameter and treat Petclinic as a primary benchmark option in both benchmark installation and load application helpers.
  • Move Quarkus pod labeling and monitoring enablement into the main demo setup flow and remove the duplicated logic from the runtimes demo branch.

Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
@kusumachalasani kusumachalasani self-assigned this Feb 27, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Feb 27, 2026

Reviewer's Guide

Adjusts local monitoring demo setup and benchmark helpers to use kruize-demos manifests with in-cluster load generation for TechEmpower and Petclinic, while simplifying benchmark arguments and centralizing Quarkus labeling/setup logic.

Sequence diagram for updated benchmark install with in-cluster load generation

sequenceDiagram
    actor Developer
    participant LocalMonitoringScripts as local_monitoring_common_sh
    participant CommonHelper as common_common_helper_sh
    participant Kubernetes as KubernetesCluster

    Developer->>LocalMonitoringScripts: run kruize_local_demo_setup(demo=runtimes, experiments)
    LocalMonitoringScripts->>Kubernetes: create_namespace APP_NAMESPACE
    LocalMonitoringScripts->>Kubernetes: delete job petclinic-load-generator
    LocalMonitoringScripts->>Kubernetes: delete job tfb-qrh-load-generator

    Note over LocalMonitoringScripts,CommonHelper: Install TechEmpower with kruize-demos manifests
    LocalMonitoringScripts->>CommonHelper: benchmarks_install(APP_NAMESPACE, tfb, kruize-demos, bench2)
    CommonHelper->>Kubernetes: kubectl apply -f manifests/default_manifests for tfb
    Kubernetes-->>CommonHelper: tfb pods ready

    Note over LocalMonitoringScripts,CommonHelper: Install Petclinic with kruize-demos manifests
    LocalMonitoringScripts->>CommonHelper: benchmarks_install(APP_NAMESPACE, petclinic, kruize-demos)
    CommonHelper->>Kubernetes: kubectl apply -f manifests/kruize-demos for petclinic
    Kubernetes-->>CommonHelper: petclinic pods and internal load jobs ready

    Note over LocalMonitoringScripts,Kubernetes: Quarkus pod labeling and monitoring enablement
    alt CLUSTER_TYPE is minikube or kind
        LocalMonitoringScripts->>Kubernetes: kubectl get pod | grep tfb-qrh-sample
        LocalMonitoringScripts->>Kubernetes: kubectl label pod quarkus_label
        LocalMonitoringScripts->>LocalMonitoringScripts: enable_kube_state_metrics_labels.sh
    else CLUSTER_TYPE is openshift
        LocalMonitoringScripts->>Kubernetes: oc get pod | grep tfb-qrh-sample
        LocalMonitoringScripts->>Kubernetes: oc label pod quarkus_label
        LocalMonitoringScripts->>LocalMonitoringScripts: enable_user_workload_monitoring_openshift.sh
    end

    LocalMonitoringScripts-->>Developer: demo environment with in-cluster load ready
Loading

Updated class diagram for benchmark helper and demo setup functions

classDiagram
    class LocalMonitoringCommonSh {
        +kruize_local_demo_setup()
    }

    class CommonHelperSh {
        +benchmarks_install(APP_NAMESPACE, BENCHMARK, MANIFESTS)
        +apply_benchmark_load(APP_NAMESPACE, BENCHMARK, LOAD_DURATION)
    }

    LocalMonitoringCommonSh --> CommonHelperSh : uses

    class benchmarks_install_changes {
        - BENCHMARK2 parameter removed
        + BENCHMARK controls both tfb and petclinic install
        + kubectl apply -f manifests/MANIFESTS for petclinic
    }

    class apply_benchmark_load_changes {
        - BENCHMARK2 parameter removed
        + BENCHMARK selects tfb or petclinic load
        + petclinic load path keyed on BENCHMARK==petclinic
    }

    CommonHelperSh .. benchmarks_install_changes : updated behavior
    CommonHelperSh .. apply_benchmark_load_changes : updated behavior
Loading

File-Level Changes

Change Details Files
Switch benchmark installation to use kruize-demos manifests and install each benchmark explicitly.
  • Update kruize_local_demo_setup to pass the manifest set name "kruize-demos" into benchmarks_install for both primary and secondary benchmarks
  • Change benchmarks_install to treat the BENCHMARK argument as the selector for installing Petclinic instead of a separate BENCHMARK2 parameter
  • Apply Petclinic manifests from manifests/${MANIFESTS} to support multiple manifest flavors
monitoring/local_monitoring/common.sh
common/common_helper.sh
Remove external load generation wiring and clean up any existing load generator jobs before re-installing benchmarks.
  • Delete previous calls to apply_benchmark_load in kruize_local_demo_setup so load is generated internally by the tfb manifests
  • Add kubectl deletes for petclinic-load-generator and tfb-qrh-load-generator jobs with --ignore-not-found to ensure a clean start before re-running benchmarks
monitoring/local_monitoring/common.sh
Simplify benchmark helper function signatures to treat Petclinic as the primary benchmark argument.
  • Drop the BENCHMARK2 parameter from benchmarks_install and apply_benchmark_load function signatures
  • Update conditional logic in apply_benchmark_load so Petclinic load is keyed off BENCHMARK=="petclinic" instead of a separate BENCHMARK2 flag
common/common_helper.sh
Centralize and slightly adjust Quarkus pod labeling and monitoring enablement for the runtimes demo.
  • Move Quarkus labeling and monitoring setup from the runtimes branch of kruize_local_demo_setup into the earlier benchmark-install path, keyed on the tfb-qrh-sample pod name
  • Call the appropriate helper scripts for kube-state-metrics labels on minikube/kind and user workload monitoring on OpenShift in the new location
  • Remove the now-redundant Quarkus labeling/monitoring block from the runtimes demo branch
monitoring/local_monitoring/common.sh

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

@kusumachalasani kusumachalasani changed the title Use load with in tfb container Run the load internally in the tfb-qrh pod for TFB benchmark Feb 27, 2026
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

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:

  • Since apply_benchmark_load no longer takes BENCHMARK2, double-check all other call sites to ensure they only pass the updated argument list and are not still relying on a fourth parameter that will now be interpreted as LOAD_DURATION.
  • If tfb load is now always run inside the container and apply_benchmark_load is only used for petclinic, consider removing or clearly deprecating the tfb-specific branch in apply_benchmark_load to avoid confusion about how load is triggered for tfb.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since `apply_benchmark_load` no longer takes `BENCHMARK2`, double-check all other call sites to ensure they only pass the updated argument list and are not still relying on a fourth parameter that will now be interpreted as `LOAD_DURATION`.
- If tfb load is now always run inside the container and `apply_benchmark_load` is only used for petclinic, consider removing or clearly deprecating the tfb-specific branch in `apply_benchmark_load` to avoid confusion about how load is triggered for tfb.

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.

Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
@kusumachalasani kusumachalasani added this to the Kruize 0.9.1 Release milestone Mar 2, 2026
@kusumachalasani kusumachalasani moved this to Under Review in Monitoring Mar 2, 2026
@kusumachalasani kusumachalasani changed the title Run the load internally in the tfb-qrh pod for TFB benchmark Use manifests specific to kruize-demos which runs load internally for techempower and petclinic benchmarks Mar 2, 2026
@chandrams
Copy link
Copy Markdown
Contributor

@sourcery-ai review

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="monitoring/local_monitoring/common.sh" line_range="549" />
<code_context>
+			kubectl delete job petclinic-load-generator -n ${APP_NAMESPACE} --ignore-not-found >> "${LOG_FILE}" 2>&1
+			kubectl delete job tfb-qrh-load-generator -n ${APP_NAMESPACE} --ignore-not-found >> "${LOG_FILE}" 2>&1
+
+			benchmarks_install ${APP_NAMESPACE} ${bench} "kruize-demos" ${bench2} >> "${LOG_FILE}" 2>&1
+			benchmarks_install ${APP_NAMESPACE} ${bench2} "kruize-demos" >> "${LOG_FILE}" 2>&1
 			echo "✅ Completed!"
 		fi
</code_context>
<issue_to_address>
**suggestion:** Calls to `benchmarks_install` still pass a 4th argument that the function no longer uses.

These calls still pass a 4th argument (`${bench2}`) even though the function now only accepts three parameters. Please remove the extra argument so the call sites match the updated signature and don’t imply unused semantics.

```suggestion
			benchmarks_install ${APP_NAMESPACE} ${bench} "kruize-demos" >> "${LOG_FILE}" 2>&1
```
</issue_to_address>

### Comment 2
<location path="common/common_helper.sh" line_range="368-372" />
<code_context>
 			popd >/dev/null
 		fi
-		if [ ${BENCHMARK2} == "petclinic" ]; then
+		if [ ${BENCHMARK} == "petclinic" ]; then
 			echo "5. Installing spring petclinic benchmark into cluster"
 			pushd spring-petclinic >/dev/null

-			kubectl apply -f manifests -n ${APP_NAMESPACE}
+			kubectl apply -f manifests/${MANIFESTS} -n ${APP_NAMESPACE}
 			check_err "ERROR: spring petclinic failed to start, exiting"
 			popd >/dev/null
</code_context>
<issue_to_address>
**issue (bug_risk):** Switching petclinic to use `manifests/${MANIFESTS}` may break existing non–`kruize-demos` layouts.

Previously, petclinic always applied from `manifests/`. Now it uses `manifests/${MANIFESTS}` (defaulting to `default_manifests`), which will fail when only `manifests/` exists for non–`kruize-demos` layouts. Consider either appending `/${MANIFESTS}` only when `MANIFESTS` is not the default, or checking for `manifests/${MANIFESTS}` and falling back to `manifests/` to keep existing setups working.
</issue_to_address>

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.

Comment thread monitoring/local_monitoring/common.sh Outdated
Comment thread common/common_helper.sh Outdated
Comment thread monitoring/local_monitoring/common.sh Outdated
kubectl delete job petclinic-load-generator -n ${APP_NAMESPACE} --ignore-not-found >> "${LOG_FILE}" 2>&1
kubectl delete job tfb-qrh-load-generator -n ${APP_NAMESPACE} --ignore-not-found >> "${LOG_FILE}" 2>&1

benchmarks_install ${APP_NAMESPACE} ${bench} "kruize-demos" ${bench2} >> "${LOG_FILE}" 2>&1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove bench2 here as we are calling benchmarks_install again

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

kubectl delete job tfb-qrh-load-generator -n ${APP_NAMESPACE} --ignore-not-found >> "${LOG_FILE}" 2>&1

benchmarks_install ${APP_NAMESPACE} ${bench} "kruize-demos" ${bench2} >> "${LOG_FILE}" 2>&1
benchmarks_install ${APP_NAMESPACE} ${bench2} "kruize-demos" >> "${LOG_FILE}" 2>&1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also now that load is made internal, do you want to remove the benchmark and load related options in runtimes_demo script?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
@@ -78,26 +75,15 @@ export KRUIZE_OPERATOR_IMAGE=""
while getopts bc:d:kfi:lm:no:pstu: gopts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kusumachalasani Can you please update the readme with the missing options

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kusumachalasani Can you address this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
Copy link
Copy Markdown
Contributor

@chandrams chandrams left a comment

Choose a reason for hiding this comment

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

LGTM

@kusumachalasani kusumachalasani moved this from Under Review to Ready for merge in Monitoring Apr 6, 2026
@dinogun dinogun merged commit 19df1cb into kruize:main Apr 7, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Ready for merge to Done in Monitoring Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants