Skip to content

feat(resources): add FileRestoreOperator resource wrapper - #2802

Open
OhadRevah wants to merge 1 commit into
RedHatQE:mainfrom
OhadRevah:FileRestoreOperator-resource
Open

feat(resources): add FileRestoreOperator resource wrapper#2802
OhadRevah wants to merge 1 commit into
RedHatQE:mainfrom
OhadRevah:FileRestoreOperator-resource

Conversation

@OhadRevah

@OhadRevah OhadRevah commented Sep 1, 2026

Copy link
Copy Markdown
Contributor
Short description:

New CNV 5.0 resource from filerestore.kubevirt.io/v1alpha1, managed by HCO. Regenerated Pod, Ingress, Deployment to fix stale test manifests.

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

    • Added support for managing FileRestore resources, including image pull policies and TLS security profiles.
    • Added Pod scheduling group configuration and serialization.
    • Registered the FileRestore API group.
  • Bug Fixes

    • Removed obsolete Pod workload reference handling.
  • Documentation

    • Clarified deployment fields and the 250-route limit for component routes.
    • Updated Pod host user documentation.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • class_generator/schema/__resources-mappings.json.gz is excluded by !**/*.gz, !class_generator/schema/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: b7eaa19c-a6e7-4cb9-9de1-05f105ba27c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 8d73d969-4306-45d7-be28-9f23e61fcea4

📥 Commits

Reviewing files that changed from the base of the PR and between fffa67d and ee62ea1.

⛔ Files ignored due to path filters (3)
  • class_generator/schema/__cluster_version__.txt is excluded by !class_generator/schema/**
  • class_generator/schema/__resources-mappings.json.gz is excluded by !**/*.gz, !class_generator/schema/**
  • class_generator/schema/_definitions.json is excluded by !class_generator/schema/**
📒 Files selected for processing (10)
  • class_generator/tests/manifests/Deployment/deployment.py
  • class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py
  • class_generator/tests/manifests/Ingress/ingress_config_openshift_io.py
  • class_generator/tests/manifests/Pod/pod.py
  • class_generator/tests/test_class_generator.py
  • ocp_resources/deployment.py
  • ocp_resources/file_restore_operator.py
  • ocp_resources/ingress_config_openshift_io.py
  • ocp_resources/pod.py
  • ocp_resources/resource.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change adds FileRestoreOperator support, registers its API group, adds Pod scheduling group serialization, refreshes Deployment and Ingress documentation, and expands resource-kind parser coverage.

Changes

Generated resource updates

Layer / File(s) Summary
FileRestoreOperator support
ocp_resources/resource.py, ocp_resources/file_restore_operator.py, class_generator/tests/manifests/FileRestoreOperator/*, class_generator/tests/test_class_generator.py
Registers the FileRestore API group and adds FileRestoreOperator serialization for image pull policy and TLS security profile settings. Parser coverage includes the new resource kind.
Pod scheduling group serialization
ocp_resources/pod.py, class_generator/tests/manifests/Pod/pod.py
Adds the scheduling_group parameter and serializes it as spec.schedulingGroup. Updates related documentation.
Regenerated schema documentation and coverage
ocp_resources/deployment.py, class_generator/tests/manifests/Deployment/deployment.py, ocp_resources/ingress_config_openshift_io.py, class_generator/tests/manifests/Ingress/*
Updates Deployment field documentation and documents the 250-route limit for Ingress component routes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ee62e

This change adds a localized FileRestoreOperator resource wrapper without introducing an actionable merge-blocking risk. It is merge-ready after normal checks and review.

Suggested reviewers: myakove

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description identifies the new FileRestoreOperator resource and regenerated resources, but most template sections are empty. It does not explain the implementation purpose, linked issue, reviewer … Complete the More details, What this PR does / why we need it, Which issue(s) this PR fixes, Special notes for reviewer, and Bug sections. State explicitly when a section does not apply.
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: adding the FileRestoreOperator resource wrapper. It is concise and relevant to the pull request.
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.
Full details: Description check

Explanation

The description identifies the new FileRestoreOperator resource and regenerated resources, but most template sections are empty. It does not explain the implementation purpose, linked issue, reviewer notes, or bug status.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@redhat-qe-bot

Copy link
Copy Markdown
Contributor

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: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 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 (PR author or approvers)
  • /hold cancel - Unblock PR merging (PR author or approvers)
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

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

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

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. Status Checks: All required status checks must pass
  3. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  4. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (cursor/cursor-grok-4.6-high)
  • Cherry-Pick Conflict Resolution: Enabled (cursor/cursor-grok-4.6-high)
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • 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.

Comment thread ocp_resources/resource.py
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add FileRestoreOperator wrapper and refresh resource schemas

✨ Enhancement 🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds a generated FileRestoreOperator wrapper for CNV 5.0 resources.
• Registers filerestore.kubevirt.io and validates wrapper generation.
• Refreshes Kubernetes 1.36 Pod, Deployment, and Ingress schemas.
Diagram

graph TD
  S["Cluster Schemas"] --> G["Class Generator"] --> M["Expected Manifests"]
  G --> R["Resource Wrappers"] --> F["FileRestore Operator"] --> A["KubeVirt API"]
  R --> C["Core Resources"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Generic custom resource wrapper
  • ➕ Avoids adding a dedicated class for each new CRD.
  • ➕ Requires fewer generated files.
  • ➖ Loses typed constructor fields and discoverability.
  • ➖ Provides weaker serialization guarantees.
  • ➖ Does not align with the repository's generated-wrapper model.
2. Handwritten dedicated wrapper
  • ➕ Allows tailored validation and convenience methods.
  • ➕ Avoids regenerating unrelated schemas.
  • ➖ Can drift from the installed CRD schema.
  • ➖ Duplicates generator-supported behavior.
  • ➖ Requires additional long-term maintenance.

Recommendation: Keep the generated dedicated wrapper. It preserves the repository's typed resource interface, keeps expected manifests synchronized with cluster schemas, and provides better maintainability than either a generic or handwritten implementation.

Files changed (11) +256 / -160

Enhancement (2) +50 / -0
file_restore_operator.pyAdd the FileRestoreOperator resource wrapper +49/-0

Add the FileRestoreOperator resource wrapper

• Introduces a NamespacedResource wrapper for filerestore.kubevirt.io. It serializes optional imagePullPolicy and tlsSecurityProfile values into the resource spec.

ocp_resources/file_restore_operator.py

resource.pyRegister the FileRestore API group +1/-0

Register the FileRestore API group

• Adds filerestore.kubevirt.io to NamespacedResource.ApiGroup for use by the new wrapper.

ocp_resources/resource.py

Bug fix (1) +8 / -10
pod.pySupport Pod scheduling groups +8/-10

Support Pod scheduling groups

• Adds scheduling_group to Pod construction and serializes it as spec.schedulingGroup. Removes obsolete workload_ref support and refreshes host user documentation.

ocp_resources/pod.py

Tests (5) +133 / -85
deployment.pyRefresh the generated Deployment manifest +62/-63

Refresh the generated Deployment manifest

• Updates the embedded Pod specification documentation to expose schedulingGroup and remove the obsolete workloadRef schema.

class_generator/tests/manifests/Deployment/deployment.py

file_restore_operator.pyAdd the expected FileRestoreOperator manifest +49/-0

Add the expected FileRestoreOperator manifest

• Adds the generated test fixture for imagePullPolicy and tlsSecurityProfile serialization under the FileRestoreOperator spec.

class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py

ingress_config_openshift_io.pyRefresh Ingress component route documentation +2/-1

Refresh Ingress component route documentation

• Documents the platform limit of 250 configurable component routes in the generated Ingress fixture.

class_generator/tests/manifests/Ingress/ingress_config_openshift_io.py

pod.pyReplace workloadRef with schedulingGroup in the Pod fixture +8/-10

Replace workloadRef with schedulingGroup in the Pod fixture

• Adds schedulingGroup construction and serialization while removing obsolete workloadRef handling. It also refreshes host user documentation.

class_generator/tests/manifests/Pod/pod.py

test_class_generator.pyValidate FileRestoreOperator generation +12/-11

Validate FileRestoreOperator generation

• Adds FileRestoreOperator to the resource generation test matrix and reorders existing resource kinds.

class_generator/tests/test_class_generator.py

Documentation (2) +64 / -64
deployment.pyRefresh Deployment's embedded Pod schema +62/-63

Refresh Deployment's embedded Pod schema

• Updates generated Deployment documentation to reflect schedulingGroup instead of the removed workloadRef field.

ocp_resources/deployment.py

ingress_config_openshift_io.pyDocument the Ingress component route limit +2/-1

Document the Ingress component route limit

• Clarifies that no more than 250 component routes may be configured.

ocp_resources/ingress_config_openshift_io.py

Other (1) +1 / -1
__cluster_version__.txtAdvance the generation schema to Kubernetes 1.36.2 +1/-1

Advance the generation schema to Kubernetes 1.36.2

• Updates the recorded cluster schema version from 1.35.2 to 1.36.2, driving the regenerated resource definitions.

class_generator/schema/cluster_version.txt

@qodo-code-review

qodo-code-review Bot commented Sep 1, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (4) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. tls_security_profile uses generic Any 📘 Rule violation ⚙ Maintainability
Description
The new tls_security_profile parameter uses dict[str, Any] rather than a concrete TLS profile
type. No documented exception justifying Any is provided for this new API.
Code

ocp_resources/file_restore_operator.py[R18-20]

+        image_pull_policy: str | None = None,
+        tls_security_profile: dict[str, Any] | None = None,
+        **kwargs: Any,
Relevance

●● Moderate

No close precedent addresses generic Any in this specific generated API parameter; evidence is
indirect and mixed.

PR-#2437
PR-#2783

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1834714 prohibits generic Any in new parameters without a documented intentional
need. Both newly added FileRestoreOperator definitions annotate tls_security_profile as
dict[str, Any].

Rule 1834714: Require type hints on all new functions, methods, and parameters
ocp_resources/file_restore_operator.py[18-20]
class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[18-20]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new `tls_security_profile` parameter uses generic `Any`, contrary to the requirement for concrete parameter types.

## Issue Context
The generated resource and its test manifest contain the same signature. Define an appropriate typed structure for the TLS security profile and regenerate or update both copies.

## Fix Focus Areas
- ocp_resources/file_restore_operator.py[18-20]
- class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[18-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. scheduling_group uses generic Any ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
The new Pod scheduling_group parameter is typed as dict[str, Any] rather than a concrete
scheduling-group structure. No documented exception for this generic annotation accompanies the
change.
Code

ocp_resources/pod.py[55]

+        scheduling_group: dict[str, Any] | None = None,
Relevance

●● Moderate

No close precedent addresses generic Any for this parameter; related typing changes were accepted,
but context differs.

PR-#2437
PR-#2529

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1834714 requires concrete annotations for new parameters and disallows undocumented
Any. The new Pod parameter is declared as dict[str, Any] in both regenerated files.

Rule 1834714: Require type hints on all new functions, methods, and parameters
ocp_resources/pod.py[55-55]
class_generator/tests/manifests/Pod/pod.py[50-50]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The newly added `scheduling_group` parameter uses generic `Any` instead of a concrete type.

## Issue Context
The production Pod wrapper and generated test manifest must retain matching signatures. Introduce an appropriate typed structure for the scheduling group and apply it to both copies.

## Fix Focus Areas
- ocp_resources/pod.py[55-55]
- class_generator/tests/manifests/Pod/pod.py[50-50]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

3. to_dict() returns no dictionary 📘 Rule violation ⚙ Maintainability
Description
The new FileRestoreOperator.to_dict() is annotated to return None and has no dictionary return
statement. This fails the resource-class requirement that to_dict() return a dictionary.
Code

ocp_resources/file_restore_operator.py[R35-37]

+    def to_dict(self) -> None:
+
+        super().to_dict()
Relevance

● Weak

Recent generated-resource precedent rejected changing to_dict from None to returning a dictionary.

PR-#2765

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1834979 requires resource classes to define to_dict(self) -> dict and return a
dictionary. Both new definitions instead declare to_dict(self) -> None and finish after mutating
self.res.

Rule 1834979: Resource classes must define init and to_dict methods
ocp_resources/file_restore_operator.py[35-47]
class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[35-47]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`FileRestoreOperator.to_dict()` mutates internal state but returns no dictionary.

## Issue Context
Update the method annotation and implementation so it returns the completed serialized dictionary. Keep the generated test manifest synchronized with the production wrapper.

## Fix Focus Areas
- ocp_resources/file_restore_operator.py[35-47]
- class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[35-47]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Generated region lacks start marker 📘 Rule violation ⚙ Maintainability
Description
The new generated files contain the required end marker but no explicit generated-code start
boundary. The provenance header identifies the generator but does not state where the protected
generated region begins.
Code

ocp_resources/file_restore_operator.py[1]

+# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md
Relevance

● Weak

Recent generated-file precedent rejected requiring an explicit start marker alongside the existing
end marker.

PR-#2765

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1835157 requires generated regions to be wrapped by explicit start and end boundary
comments. Each new file has a provenance comment at line 1 and # End of generated code at line 49,
but no comment explicitly marking the start of the generated region.

Rule 1835157: Protect generated code regions with explicit boundary markers
ocp_resources/file_restore_operator.py[1-1]
ocp_resources/file_restore_operator.py[49-49]
class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[1-1]
class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[49-49]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The generated code region has an end marker but no explicit start boundary marker.

## Issue Context
Add the project-standard generated-code start marker before the generated class region while preserving the required first-line provenance comment and existing exact end marker.

## Fix Focus Areas
- ocp_resources/file_restore_operator.py[1-9]
- class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[1-9]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. FileRestoreOperator docstrings violate Google style 📘 Rule violation ⚙ Maintainability
Description
The class summary is not capitalized conventionally or terminated with a period, while the
constructor docstring starts directly with Args: and uses name (type): entries. Both newly added
copies therefore violate the required Google-style layout.
Code

ocp_resources/file_restore_operator.py[R10-12]

+    """
+    FileRestoreOperator is the Schema for the filerestoreoperators API
+    """
Relevance

● Weak

Recent generated-resource precedent rejected the same Google-style docstring reformatting request.

PR-#2765

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1834792 requires a capitalized summary sentence ending in a period and Google-style
name: description argument entries. The class summary lacks a period, and the constructor begins
with Args: and uses image_pull_policy (str): and tls_security_profile (dict[str, Any]):.

Rule 1834792: Inline docstrings must use Google-style triple-quoted blocks
ocp_resources/file_restore_operator.py[10-29]
class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[10-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new class and constructor docstrings do not meet the required Google-style summary and argument formatting rules.

## Issue Context
Add a capitalized summary sentence ending in a period to each docstring. Format constructor parameters as `name: description` beneath `Args:` and keep the generated fixture synchronized.

## Fix Focus Areas
- ocp_resources/file_restore_operator.py[10-29]
- class_generator/tests/manifests/FileRestoreOperator/file_restore_operator.py[10-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 18 rules
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread ocp_resources/file_restore_operator.py
Comment thread ocp_resources/pod.py Outdated
New CNV 5.0 resource from filerestore.kubevirt.io/v1alpha1, managed by HCO.

Signed-off-by: Ohad <orevah@redhat.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

3 participants