Skip to content

HYPERFLEET-837 - feat: Add resource recreation design for adapters#150

Open
mliptak0 wants to merge 1 commit into
openshift-hyperfleet:mainfrom
mliptak0:HYPERFLEET-837
Open

HYPERFLEET-837 - feat: Add resource recreation design for adapters#150
mliptak0 wants to merge 1 commit into
openshift-hyperfleet:mainfrom
mliptak0:HYPERFLEET-837

Conversation

@mliptak0
Copy link
Copy Markdown
Contributor

@mliptak0 mliptak0 commented Jun 3, 2026

Summary

Define a design doc for recreation flow design in adapters

Test Plan

  • Unit tests added/updated
  • make test-all passes
  • make lint passes
  • Helm chart changes validated with make test-helm (if applicable)
  • Deployed to a development cluster and verified (if Helm/config changes)
  • E2E tests passed (if cross-component or major changes)

@openshift-ci openshift-ci Bot requested review from crizzo71 and rafabene June 3, 2026 06:54
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kuudori 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Warning

Review limit reached

@mliptak0, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 19 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 8acf4291-71c8-4b4d-92a2-4a28e5e60a26

📥 Commits

Reviewing files that changed from the base of the PR and between 528baf1 and 0b96717.

📒 Files selected for processing (1)
  • hyperfleet/components/adapter/framework/adapter-recreation-flow-design.md
📝 Walkthrough

Walkthrough

Adds a design document for adapter resource recreation workflow, specifying evaluation order between lifecycle.delete.when and lifecycle.recreate.when, delete+apply sequencing, handling of pending deletions across reconciliation loops including finalizers and async deletion, CEL evaluation context inputs, edge-case behavior for discovery failures, and rationale for the CEL-based trigger over the prior RecreateOnChange flag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a resource recreation design document for adapters, matching the documentation addition.
Description check ✅ Passed The description is related to the changeset, referencing the design doc addition and including relevant issue tracking and test plan context.
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.
Sec-02: Secrets In Log Output ✅ Passed PR adds only a markdown design document with no Go code or log statements containing secrets, tokens, passwords, or credentials.

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

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

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.

Copy link
Copy Markdown
Contributor

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hyperfleet/components/adapter/framework/adapter-recreation-flow-design.md`:
- Around line 89-95: The design must explicitly require the adapter to keep
status.Finalized=false while it returns Operation=Recreate with Reason="deletion
pending" during the post-delete discovery path, and only set
status.Finalized=true after a successful ApplyResource and subsequent post-apply
discovery; update any logic in the post-delete discovery and status reporting
paths (the code that sets Operation=Recreate / Reason="deletion pending", the
status.Finalized setter, and ApplyResource/post-apply discovery handlers) to
ensure Finalized is false during pending deletion and flipped to true only after
ApplyResource succeeds and the resource is confirmed present.
- Around line 46-52: The adapter recreation-flow design currently assigns CEL
decision logic to the executor while HyperFleet’s architecture expects Sentinel
to own those evaluations, so update the design to place
`lifecycle.recreate.when` decision-making in Sentinel or explicitly revise the
separation of concerns to allow adapter-side CEL evaluation. Also align the
design with the existing adapter implementation by adding
`lifecycle.recreate.when` support to the adapter config/schema and executor
flow, since the current code only handles `lifecycle.delete.when` and
`recreate_on_change`; reference the recreation flow section and the executor
decision logic in the design doc when updating.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 4987018a-1fb7-4552-907d-dd61bb92be66

📥 Commits

Reviewing files that changed from the base of the PR and between 346e4d8 and c646d6d.

📒 Files selected for processing (1)
  • hyperfleet/components/adapter/framework/adapter-recreation-flow-design.md

Comment thread hyperfleet/components/adapter/framework/adapter-recreation-flow-design.md Outdated
@mliptak0 mliptak0 force-pushed the HYPERFLEET-837 branch 3 times, most recently from 8e62cc2 to 0d7f54d Compare June 3, 2026 07:27
Copy link
Copy Markdown
Contributor

@ciaranRoche ciaranRoche left a comment

Choose a reason for hiding this comment

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

Nice work on this, couple of things inline and also a few follow up questions

  1. Post Processing, since we evalute conditions against resources, how will that be handled during recreation. We have a gaurd for deletion but curious how we will handle it during recreation
  2. Multi resource recreation, since we can have multi resource, how do we handle ordering of recreation

expression: |
# Recreate when the generation has changed (indicating spec changed)
resources.?job.hasValue()
&& string(generation) != resources.?job.metadata.annotations["hyperfleet.io/generation"]
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.

I am thinking of a potential gap we will need to solve here. What happens if delete is true and recreate is true?

For both to fire, they need deleted_time set and generation annotation mismatch, this will happen when deletion is set 🤔 so essentially both will be true. We should define this pattern :

  • Explicit evaluation ordering
  • Config author responsibility
  • Framework-level gaurd
  • Something else

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.

lifecycle.delete has priority in this case and if evaluates to true, then lifecycle.recreate should be ignored - not evaluated or set to false

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.

For multi-resource recreation, I updated the doc. From what I see, currently it's done sequentially, I think that can persist how it is


### Out of Scope

- Intermediate status conditions during recreation (future enhancement)
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.

Curious as to why this was pushed out of scope? What is the reasoning behind it?

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.

Thanks for pointing out, this was a left-over comment. It should be now specified how status conditions will reflect the state

```

**Requirements when `lifecycle.recreate` is configured:**
- `discovery` block must exist — pre-discovery populates resource state so CEL expressions can compare current vs. desired state
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.

Do we reject configs if the block does not exist? We might want to be explicit here if we do to ensure we cover it and have a test case for it

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.

Edited the doc to be explicit that if there is lifecycle.recreate, the pre-discovery must be present, otherwise lifecycle.recreate should be omitted

@mliptak0 mliptak0 force-pushed the HYPERFLEET-837 branch 3 times, most recently from e726c45 to 528baf1 Compare June 4, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants