Skip to content

BIZ-794: separte managed and self-managed ACM capacity - #612

Open
jiri-fiala wants to merge 1 commit into
openshift:mainfrom
jiri-fiala:acm-mng-vs-slfmng-separation
Open

BIZ-794: separte managed and self-managed ACM capacity#612
jiri-fiala wants to merge 1 commit into
openshift:mainfrom
jiri-fiala:acm-mng-vs-slfmng-separation

Conversation

@jiri-fiala

Copy link
Copy Markdown

The newly introduced two rules are meant to separate the vCPU/core capacity reported for capacity connected to an ACM hub based on the product label of those connected cluster to support BIZ-794.

  • The rules need verification, they were only briefly checked (sample cluster telemetry)
  • The "self-managed" product labels are only "OpenShift" and "Microshift", everything else is considered as managed product (to receive the "managed" price point).
  • The "Other" product is placed in the "managed" category.

* Separates the capacity of clusters connected to an ACM hub into "managed"
  and "self-managed" categories based on the product label.

Signed-off-by: Jiri Fiala <jfiala@redhat.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 3, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@jiri-fiala: This pull request references BIZ-794 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature to target the "5.0.0" version, but no target version was set.

Details

In response to this:

The newly introduced two rules are meant to separate the vCPU/core capacity reported for capacity connected to an ACM hub based on the product label of those connected cluster to support BIZ-794.

  • The rules need verification, they were only briefly checked (sample cluster telemetry)
  • The "self-managed" product labels are only "OpenShift" and "Microshift", everything else is considered as managed product (to receive the "managed" price point).
  • The "Other" product is placed in the "managed" category.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds two ACM recording rules for connected-cluster worker cores. One rule selects OpenShift and MicroShift clusters. The other selects all remaining products. Both rules sum worker cores by hub _id.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the BIZ-794 change to separate managed and self-managed ACM capacity.
Description check ✅ Passed The description explains the two new rules, their product-label classification, and the need for verification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The commit changes only jsonnet/telemeter/rules.libsonnet; it adds recording rules and no Ginkgo test titles or test files.
Test Structure And Quality ✅ Passed The PR changes only jsonnet/telemeter/rules.libsonnet and adds no Ginkgo test code, so these test-structure requirements are not applicable.
Microshift Test Compatibility ✅ Passed The patch changes only jsonnet/telemeter/rules.libsonnet and adds recording rules; it adds no Ginkgo e2e tests or MicroShift-relevant test APIs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request changes only jsonnet/telemeter/rules.libsonnet and adds no Ginkgo e2e tests, so SNO compatibility checks do not apply.
Topology-Aware Scheduling Compatibility ✅ Passed The PR only adds two Prometheus recording rules in jsonnet/telemeter/rules.libsonnet; it does not modify deployment manifests, operators, controllers, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The patch changes only jsonnet/telemeter/rules.libsonnet; it adds no OTE/Ginkgo process code or stdout writes, and existing Go entrypoint logs use os.Stderr.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The pull request changes only jsonnet/telemeter/rules.libsonnet and adds Prometheus recording rules; it adds no Ginkgo tests or external network operations.
No-Weak-Crypto ✅ Passed The commit changes only two Prometheus recording rules; added lines contain no weak algorithms, crypto APIs, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The PR changes only jsonnet/telemeter/rules.libsonnet Prometheus recording rules; it adds no container or Kubernetes manifest and no prohibited privilege setting.
No-Sensitive-Data-In-Logs ✅ Passed The patch adds only Prometheus recording rules and comments; it contains no logging statements or password, token, API key, PII, hostname, or customer-data logging.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 97d189b7-d9f5-420c-8b3a-3ce8b29833ca

📥 Commits

Reviewing files that changed from the base of the PR and between 22ba170 and 3166c54.

📒 Files selected for processing (1)
  • jsonnet/telemeter/rules.libsonnet

Comment on lines +252 to +265
{
// Sum of ACM managed cluster cores that are considered to be self-managed connected clusters
// Unlike the above acm_capacity_effective_cpu_cores rule, this goes directly to acm_managed_cluster_worker_cores:max and further filters down based on product names.
record: acm:managed_cluster_worker_cores:self_managed:sum
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product=~"OpenShift|MicroShift"})
|||,
},
// Sum of ACM managed cluster cores that are considered to be managed connected clusters (mutually exclusive vs the previous ruke)
record: acm:managed_cluster_worker_cores:managed:sum
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product!~"OpenShift|MicroShift"})
|||,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

command -v jsonnetfmt >/dev/null
jsonnetfmt jsonnet/telemeter/rules.libsonnet >/dev/null

Repository: openshift/telemeter

Length of output: 157


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "jsonnetfmt available:"
command -v jsonnetfmt || true

echo
echo "Relevant file section:"
sed -n '245,272p' jsonnet/telemeter/rules.libsonnet | cat -n

echo
echo "Check Jsonnet parser/fmt behavior on the file:"
jsonnetfmt jsonnet/telemeter/rules.libsonnet || true

echo
echo "Search for similar record field syntax nearby:"
rg -n "record: [a-zA-Z_][^,\n]*:" jsonnet/telemeter/rules.libsonnet jsonnet -g '*.libsonnet' || true

Repository: openshift/telemeter

Length of output: 2697


Fix the Jsonnet syntax before merge.

The added recording-rule objects are malformed and prevent Jsonnet formatting from succeeding.

  • Quote the two record values that contain colons.
  • Add a comma after both record fields.
  • Add { before the second rule after the first rule-closing }.
Proposed fix
             {
-              record: acm:managed_cluster_worker_cores:self_managed:sum
+              record: 'acm:managed_cluster_worker_cores:self_managed:sum',
               expr: |||
                 sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product=~"OpenShift|MicroShift"})
               |||,
             },
+            {
               // Sum of ACM managed cluster cores that are considered to be managed connected clusters (mutually exclusive vs the previous ruke)
-              record: acm:managed_cluster_worker_cores:managed:sum
+              record: 'acm:managed_cluster_worker_cores:managed:sum',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
// Sum of ACM managed cluster cores that are considered to be self-managed connected clusters
// Unlike the above acm_capacity_effective_cpu_cores rule, this goes directly to acm_managed_cluster_worker_cores:max and further filters down based on product names.
record: acm:managed_cluster_worker_cores:self_managed:sum
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product=~"OpenShift|MicroShift"})
|||,
},
// Sum of ACM managed cluster cores that are considered to be managed connected clusters (mutually exclusive vs the previous ruke)
record: acm:managed_cluster_worker_cores:managed:sum
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product!~"OpenShift|MicroShift"})
|||,
},
{
// Sum of ACM managed cluster cores that are considered to be self-managed connected clusters
// Unlike the above acm_capacity_effective_cpu_cores rule, this goes directly to acm_managed_cluster_worker_cores:max and further filters down based on product names.
record: 'acm:managed_cluster_worker_cores:self_managed:sum',
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product=~"OpenShift|MicroShift"})
|||,
},
{
// Sum of ACM managed cluster cores that are considered to be managed connected clusters (mutually exclusive vs the previous ruke)
record: 'acm:managed_cluster_worker_cores:managed:sum',
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product!~"OpenShift|MicroShift"})
|||,
},

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jiri-fiala
Once this PR has been reviewed and has the lgtm label, please assign thibaultmg for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@simonpasquier
simonpasquier requested review from simonpasquier and removed request for machine424 August 3, 2026 12:22
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@jiri-fiala: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint 3166c54 link true /test lint
ci/prow/unit 3166c54 link true /test unit

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

// Sum of ACM managed cluster cores that are considered to be managed connected clusters (mutually exclusive vs the previous ruke)
record: acm:managed_cluster_worker_cores:managed:sum
expr: |||
sum by (_id) (acm_managed_cluster_worker_cores:max and on(hub_cluster_id, managed_cluster_id) acm_managed_cluster_info{product!~"OpenShift|MicroShift"})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a way to write this in such a way that it is looking for a specific product and not just the abscense of OpenShift|MicroShift ?

@simonpasquier

Copy link
Copy Markdown
Contributor

@jiri-fiala just to set expectations: you'll need unit tests to validate the output of the recording rules as in #554 for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants