Skip to content

Conversation

@mangelajo
Copy link
Member

@mangelajo mangelajo commented Oct 14, 2025

Summary by CodeRabbit

  • Enhancements

    • Lease resources now support beginTime and endTime, enabling explicit scheduling windows.
    • Duration becomes optional and, when omitted, is derived from endTime − beginTime. Must be positive if provided.
    • endTime can be updated to extend or shorten active leases.
  • Documentation

    • Clarified field descriptions for Lease spec and status, improving guidance and removing redundant wording.
  • Chores

    • Updated generation and test configurations to use consolidated CRD locations and narrower code paths.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Controller-gen targets updated to restrict paths and adjust CRD output directories. The Lease CRD schema adds beginTime and endTime, makes duration optional with clarified semantics, and tweaks a status description. Test setup now loads CRDs from the new Helm CRD directory.

Changes

Cohort / File(s) Summary
Build and codegen config
Makefile
Restricts controller-gen paths to ./api/... and ./internal/...; changes CRD output dir to deploy/helm/jumpstarter/crds/; keeps RBAC output under .../templates/rbac/; aligns generate target paths.
CRD schema updates
deploy/helm/jumpstarter/crds/jumpstarter.dev_leases.yaml
Adds spec.beginTime and spec.endTime (string, date-time); spec.duration becomes optional with computed semantics when both times provided; removes duration from required; refines status.beginTime description.
Test environment
internal/controller/suite_test.go
Updates CRD load path to deploy/helm/jumpstarter/crds from previous .../charts/jumpstarter-controller/templates/crds.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I twitch my whiskers at CRDs anew,
Begin and end, the leases queue.
Makefile paths hop neat and light,
Tests sniff CRDs in the right site.
Optional time? Carrot-fine!
I stamp, I thump—release on time.
🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title directly reflects the primary change of correcting the CRD generation command to output files in the intended directory and does so concisely without introducing ambiguity or extraneous information.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-crds

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

🧹 Nitpick comments (1)
deploy/helm/jumpstarter/crds/jumpstarter.dev_leases.yaml (1)

141-144: Consider clarifying the status description.

Line 144's description reads: "If the lease has been acquired an exporter name is assigned and then it can be used, it will be empty while still pending"

This could be reworded for clarity, perhaps:
"Set when the lease acquires an exporter. Empty while pending exporter assignment."

Apply this diff to improve clarity:

               description: |-
-                 If the lease has been acquired an exporter name is assigned
-                 and then it can be used, it will be empty while still pending
+                 Set when the lease acquires an exporter and becomes active.
+                 Empty while the lease is pending exporter assignment.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 441f24d and 0761a8b.

📒 Files selected for processing (3)
  • Makefile (1 hunks)
  • deploy/helm/jumpstarter/crds/jumpstarter.dev_leases.yaml (3 hunks)
  • internal/controller/suite_test.go (1 hunks)
⏰ 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). (6)
  • GitHub Check: lint-go
  • GitHub Check: deploy-kind
  • GitHub Check: tests
  • GitHub Check: e2e-tests (ubuntu-24.04)
  • GitHub Check: e2e-tests-28d6b1cc3b49ab9ae176918ab9709a2e2522c97e
  • GitHub Check: e2e-tests (ubuntu-24.04-arm)
🔇 Additional comments (5)
internal/controller/suite_test.go (1)

66-66: LGTM! CRD path correctly updated.

The test environment now loads CRDs from the new directory structure, aligning with the Makefile changes that generate CRDs to deploy/helm/jumpstarter/crds/.

Makefile (2)

52-54: LGTM! Improved controller-gen targeting.

Restricting paths to ./api/... and ./internal/... is better practice than ./... as it:

  • Avoids accidentally processing vendored dependencies
  • Excludes test code and fixtures
  • Makes manifest generation more deterministic

The CRD output directory change to deploy/helm/jumpstarter/crds/ aligns with the test configuration update.


58-58: LGTM! Consistent path narrowing for code generation.

Using narrower paths here matches the manifests target and follows the same best practices.

deploy/helm/jumpstarter/crds/jumpstarter.dev_leases.yaml (2)

134-136: LGTM! Correctly updated required fields.

Removing duration from the required list is consistent with the new schema where duration can be calculated from beginTime and endTime.


52-83: Validation covers all Lease time field combinations. The ReconcileLeaseTimeFields function in lease_helpers.go

  • computes Duration from BeginTime+EndTime,
  • computes BeginTime from EndTime+Duration,
  • rejects missing Duration (including EndTime-only or none provided),
  • and errors on any conflict between all three fields.
    No further controller changes required.

@mangelajo mangelajo merged commit 8e8ecb9 into main Oct 15, 2025
8 checks passed
@mangelajo mangelajo deleted the fix-crds branch October 15, 2025 08:54
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.

3 participants