-
Notifications
You must be signed in to change notification settings - Fork 10
implement lease transfer #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis change introduces a lease transfer feature that enables updating a lease's client reference. The UpdateLease operation now accepts an optional target client identifier, validates the current lease is active and not ended, enforces namespace consistency, retrieves the target client, and updates the lease's client reference. A new utility function facilitates parsing client identifiers. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
this simply allows to update the lease with a different client Signed-off-by: Benny Zlotnik <[email protected]> Assisted-by: claude-sonnet-4
35f35cd to
59c9ec8
Compare
depends on jumpstarter-dev/jumpstarter-controller#199 Signed-off-by: Benny Zlotnik <[email protected]>
|
This is very cool, I believe that in the longer term we may want to create a new lease, and transfer the exporter to the new lease, end the current one. The reason for that will be that we may want to do accounting/billing. Also something very interesting that we can think about in the future is lease-sharing, but that is more complicated. |
There was a problem hiding this 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)
internal/service/client/v1/client_service.go (1)
247-268: Lease transfer flow is well‑guarded; consider a small optimization for no‑op transfersThis block correctly:
- Ensures only the current client (checked earlier) can request the transfer.
- Restricts transfers to active, non‑ended leases.
- Enforces same‑namespace transfers and validates the target client exists before updating
ClientRef.Name.One optional refinement: if
*req.Lease.Clientencodes the same client asjlease.Spec.ClientRef.Name, you could short‑circuit before parsing/GET to avoid an unnecessary API call, e.g. by comparing against the current client identifier the CLI already uses.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
internal/service/client/v1/client_service.go(1 hunks)internal/service/utils/identifier.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
internal/service/client/v1/client_service.go (3)
api/v1alpha1/lease_types.go (1)
Lease(80-86)api/v1alpha1/client_types.go (1)
Client(43-49)internal/service/utils/identifier.go (1)
ParseClientIdentifier(93-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e-test-operator
- GitHub Check: e2e-tests (ubuntu-24.04)
- GitHub Check: e2e-tests-release-0-7
- GitHub Check: e2e-tests (ubuntu-24.04-arm)
🔇 Additional comments (1)
internal/service/utils/identifier.go (1)
93-95: ParseClientIdentifier helper is consistent with existing identifier utilitiesThe wrapper cleanly reuses
ParseObjectIdentifierwith the"clients"kind and matches the existing exporter/lease helpers. No issues from a correctness or style standpoint.
this simply allows to update the lease with a different client
a corresponding jumpstarter cli update to
jmp update leasewill be madeSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.