Skip to content

Support Claw CR idling#745

Merged
alexeykazakov merged 1 commit into
codeready-toolchain:masterfrom
alexeykazakov:idler
May 22, 2026
Merged

Support Claw CR idling#745
alexeykazakov merged 1 commit into
codeready-toolchain:masterfrom
alexeykazakov:idler

Conversation

@alexeykazakov
Copy link
Copy Markdown
Contributor

@alexeykazakov alexeykazakov commented May 21, 2026

Related PR: codeready-toolchain/claw-operator#133

Paired with codeready-toolchain/toolchain-e2e#1281

Summary by CodeRabbit

Release Notes

  • New Features

    • The idler controller now supports idling and scaling Claw custom resources by setting their idle state, extending resource management capabilities.
  • Tests

    • Extended test coverage to validate Claw resource idling and running behavior across multiple scenarios and ownership chains.

@openshift-ci openshift-ci Bot requested review from fbm3307 and xcoulon May 21, 2026 00:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Walkthrough

The PR extends the idler controller to support the Claw custom resource type. It adds RBAC permissions for Claw resources, implements idling logic via patching spec.idle, and extends test infrastructure with assertions and coverage for Claw resource state validation.

Changes

Claw resource idling support

Layer / File(s) Summary
Claw resource idling in the controller
controllers/idler/idler_controller.go, controllers/idler/owners.go
Kubebuilder RBAC annotation grants get;list;patch permissions for Claw resources. scaleOwnerToZero recognizes "Claw" as an owner kind and delegates to idleClaw, which reads spec.idle from the Claw CR and conditionally patches it to true via merge patch if not already idled.
Test assertion and discovery support
test/idler_assertion.go, controllers/idler/owners_test.go
IdleablePayloadAssertion adds ClawIdled and ClawRunning methods that fetch Claw from the dynamic client and assert spec.idle values. Test configuration and fake API discovery are extended to register the Claw resource (claw.sandbox.redhat.com/v1alpha1) and define the expected Claw-to-Deployment-to-ReplicaSet-to-Pod owner chain.
Test coverage with Claw fixtures
controllers/idler/idler_controller_test.go
Shared test fixture adds a claw field to the payloads struct and newClaw helper to construct Claw objects. preparePayloads now creates Claw instances, wires them into Deployment/ReplicaSet chains, and generates pods owned by those ReplicaSets. Multiple test scenarios extended to assert Claw idling/running state alongside existing InferenceService checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

feature, test

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly reflects the main change: adding support for Claw CR idling across multiple controller and test files.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@sonarqubecloud
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot added feature New feature or request test Work that adds, fixes, or maintains automated tests or coverage (unit, integration, e2e, flakiness) labels May 21, 2026
@alexeykazakov
Copy link
Copy Markdown
Contributor Author

/retest

Copy link
Copy Markdown
Contributor

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

👍

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, MatousJobanek, metlos, rajivnathan, xcoulon

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,alexeykazakov,metlos,rajivnathan,xcoulon]

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

@alexeykazakov alexeykazakov merged commit 53d2e64 into codeready-toolchain:master May 22, 2026
9 of 11 checks passed
@alexeykazakov alexeykazakov deleted the idler branch May 22, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved feature New feature or request test Work that adds, fixes, or maintains automated tests or coverage (unit, integration, e2e, flakiness)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants