Skip to content

Conversation

@vsibirsk
Copy link
Contributor

@vsibirsk vsibirsk commented Dec 11, 2025

Short description:

on multi-arch clusters multiple templates of same OS (with diff arch) exists
added optional architecture param

More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:

Summary by CodeRabbit

  • New Features

    • Templates can include an optional architecture label in addition to OS, workload, and flavor.
  • Improvements

    • Labels now use a consistent boolean format (e.g., =true) for OS, workload, and flavor.
    • Architecture is optional, preserving backward compatibility with existing templates.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 11, 2025

Warning

Rate limit exceeded

@vsibirsk has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b99804f and 1186737.

📒 Files selected for processing (1)
  • ocp_resources/template.py (2 hunks)

Walkthrough

Added an Architecture namespace and ARCHITECTURE label constant; modified Template.generate_template_labels(os, workload, flavor, architecture=None) to append =true to OS/WORKLOAD/FLAVOR labels and to optionally include an ARCHITECTURE=<architecture> label when provided.

Changes

Cohort / File(s) Change Summary
Template constants & label generation
ocp_resources/template.py
Added Template.Architecture inner class with AMD64, ARM64, S390X; added ARCHITECTURE constant to Template.Labels; changed generate_template_labels() signature to accept optional architecture and updated label outputs to include =true suffix for OS/WORKLOAD/FLAVOR and an optional ARCHITECTURE=<architecture> entry.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify callers of generate_template_labels() handle the new optional architecture argument.
  • Confirm consumers (parsing/filters) expect the =true suffix on labels.
  • Check unit tests and update snapshots/assertions that depend on label formatting.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is largely incomplete, missing critical sections. Only the short description and a partial 'More details' section are filled in; 'What this PR does / why we need it' and other sections are empty. Complete the description by filling in 'What this PR does / why we need it' section and optionally add 'Special notes for reviewer' or issue references to provide context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change to the generate_template_labels method, which is the primary focus of the changeset.

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 and usage tips.

@rh-bot-1
Copy link

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Pre-commit Checks: pre-commit runs automatically if .pre-commit-config.yaml exists
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest python-module-install - Test Python package installation
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 0 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No WIP, hold, or conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

Copy link

@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 (1)
ocp_resources/template.py (1)

68-68: Remove unnecessary parentheses.

The parentheses around the f-string are not needed.

-(f"{Template.Labels.WORKLOAD}/{getattr(Template.Workload, workload.upper())}=true"),
+f"{Template.Labels.WORKLOAD}/{getattr(Template.Workload, workload.upper())}=true",
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e10b867 and 0b2058e.

📒 Files selected for processing (1)
  • ocp_resources/template.py (2 hunks)
🔇 Additional comments (2)
ocp_resources/template.py (2)

15-15: LGTM! Clean addition of architecture label constant.

The new ARCHITECTURE constant follows the established pattern and is properly namespaced.


65-73: The label format is correct and follows KubeVirt conventions.

The ARCHITECTURE label uses a different format intentionally: template.kubevirt.io/architecture={value} is the official KubeVirt convention for architecture labels, while OS, WORKLOAD, and FLAVOR follow the pattern {domain.kubevirt.io}/{value}=true for discrete template attribute labels.

This is not an inconsistency—KubeVirt's template label conventions deliberately distinguish between:

  • Attribute labels with values encoded in keys (OS, WORKLOAD, FLAVOR): multiple possible label keys, one per valid option
  • Flexible value labels (ARCHITECTURE): single key with variable architecture values

No changes needed.

Copy link

@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 (1)
ocp_resources/template.py (1)

71-72: Consider adding validation for the architecture parameter.

The workload and flavor parameters are validated using getattr with corresponding class constants (Template.Workload, Template.Flavor), but the architecture parameter is used directly without validation. For consistency and to catch invalid values early, consider whether architecture should also have a set of valid constants or validation.

If there's a finite set of supported architectures, you could add a class like:

class Architecture:
    AMD64 = "amd64"
    ARM64 = "arm64"
    PPC64LE = "ppc64le"
    S390X = "s390x"

Then validate the architecture parameter:

     if architecture:
-        labels.append(f"{Template.Labels.ARCHITECTURE}={architecture}")
+        labels.append(f"{Template.Labels.ARCHITECTURE}={getattr(Template.Architecture, architecture.upper())}")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b2058e and 053c3e8.

📒 Files selected for processing (1)
  • ocp_resources/template.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/template.py (1)
ocp_resources/resource.py (3)
  • NamespacedResource (1574-1684)
  • ApiGroup (468-581)
  • labels (1211-1218)
🔇 Additional comments (1)
ocp_resources/template.py (1)

15-15: LGTM!

The ARCHITECTURE constant follows the same pattern as other label constants in the class and correctly uses the TEMPLATE_KUBEVIRT_IO API group.

@rnetser
Copy link
Collaborator

rnetser commented Dec 11, 2025

a/approve
/lgtm

@rnetser
Copy link
Collaborator

rnetser commented Dec 11, 2025

/approve

on multi-arch clusters multiple templates of same OS (with diff arch)
exists
added optional architecture param
Copy link

@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: 0

🧹 Nitpick comments (1)
ocp_resources/template.py (1)

15-20: LGTM! Architecture constants follow Kubernetes conventions.

The new ARCHITECTURE label constant and Architecture namespace with lowercase values (amd64, arm64, s390x) are well-defined and match standard Kubernetes architecture labels. The architecture parameter is properly validated via getattr() in the generate_template_labels method.

Note: The architecture label format (template.kubevirt.io/architecture=<value>) differs from the OS/WORKLOAD/FLAVOR pattern (subdomain.template.kubevirt.io/<value>=true). Consider whether alignment with the existing label format convention is needed for consistency.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 053c3e8 and b99804f.

📒 Files selected for processing (1)
  • ocp_resources/template.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-11T16:42:29.245Z
Learnt from: servolkov
Repo: RedHatQE/openshift-python-wrapper PR: 2490
File: ocp_resources/route_advertisements.py:53-65
Timestamp: 2025-08-11T16:42:29.245Z
Learning: In the openshift-python-wrapper project, when raising MissingRequiredArgumentError, the convention is to include the "self." prefix in the argument name (e.g., `MissingRequiredArgumentError(argument="self.advertisements")`). This pattern is established in the code generator template at `class_generator/manifests/class_generator_template.j2` and followed consistently across most resource classes.

Applied to files:

  • ocp_resources/template.py
🧬 Code graph analysis (1)
ocp_resources/template.py (1)
ocp_resources/resource.py (3)
  • NamespacedResource (1574-1684)
  • ApiGroup (468-581)
  • labels (1211-1218)
🔇 Additional comments (2)
ocp_resources/template.py (2)

70-70: No verification needed—method has no callers in the codebase.

The architecture parameter addition is backward compatible (optional, at end of parameter list, conditionally used), but no callers exist to verify. No action required.


71-78: Verify label format compatibility before release.

The label format has changed:

  • OS/WORKLOAD/FLAVOR labels now include =true suffix: os.template.kubevirt.io/rhel9=true
  • Architecture label uses key=value format: template.kubevirt.io/architecture=amd64

If these labels are consumed by external tools or selectors for filtering or matching, verify that they can handle the new format. The inconsistent formats between OS/WORKLOAD/FLAVOR (using /value=true) and ARCHITECTURE (using =value) may also warrant standardization.

Positive note: Architecture now includes validation via getattr() (line 77).

Minor inconsistency: OS parameter (line 72) lacks validation, unlike workload, flavor, and architecture parameters.

@vsibirsk
Copy link
Contributor Author

/verified

@rnetser
Copy link
Collaborator

rnetser commented Dec 15, 2025

/approve
/lgtm

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.

5 participants