initial jumpstarter integration#31
Conversation
Currently detects whether jumpstarter is available, and depends on a hardcoded config for flashing instructions Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
📝 WalkthroughWalkthroughAdds optional Jumpstarter integration: new CRD types and schema, deepcopy support, controller detection of Jumpstarter CRDs, RBAC and scheme registration, Build API/CLI exposure of Jumpstarter metadata on completed builds, and CSV/CRD manifest updates. Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant KubeAPI as Kubernetes API
participant OperatorConfig
participant BuildAPI
participant Client
Controller->>KubeAPI: GET CRD exporters.jumpstarter.dev
KubeAPI-->>Controller: responds (exists / not found / error)
Controller->>OperatorConfig: update status.jumpstarterAvailable
OperatorConfig-->>KubeAPI: persist status update
Note over BuildAPI,Client: After build reaches Completed
Client->>BuildAPI: GET /build/{id}
BuildAPI->>OperatorConfig: Read spec & status
OperatorConfig-->>BuildAPI: Return Jumpstarter config & availability
BuildAPI->>BuildAPI: Substitute placeholders in flashCmd
BuildAPI-->>Client: Respond with BuildResponse including Jumpstarter info
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @bennyz. * #31 (comment) The following files were modified: * `cmd/caib/main.go` * `cmd/main.go` * `internal/buildapi/server.go`
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/buildapi/server.go (1)
1123-1169: FlashCmd placeholder mismatch will leave templates unexpanded.
The CRD example uses${IMAGE}, but substitution only replaces{image_uri}/{artifact_url}. Users following the example will get an unexpanded command. Consider supporting both placeholder styles (or updating docs + schema examples).🔧 Suggested fix (support both placeholder styles)
if flashCmd != "" { imageURI := build.Spec.ExportOCI if imageURI == "" { imageURI = build.Status.ArtifactURL } flashCmd = strings.ReplaceAll(flashCmd, "{image_uri}", imageURI) flashCmd = strings.ReplaceAll(flashCmd, "{artifact_url}", build.Status.ArtifactURL) + flashCmd = strings.ReplaceAll(flashCmd, "${IMAGE}", imageURI) + flashCmd = strings.ReplaceAll(flashCmd, "${ARTIFACT_URL}", build.Status.ArtifactURL) } jumpstarterInfo.FlashCmd = flashCmd
🤖 Fix all issues with AI agents
In `@internal/controller/operatorconfig/controller.go`:
- Around line 59-73: detectJumpstarter currently caches both positive and
negative results via r.IsJumpstarter, causing transient errors to be treated as
permanent; change it so only successful detection sets r.IsJumpstarter true and
non-nil, while errors that are not NotFound are logged (or returned) and
r.IsJumpstarter remains nil so subsequent reconciles can retry. Specifically, in
detectJumpstarter keep the existing GET of the CRD name
"exporters.jumpstarter.dev", but only assign r.IsJumpstarter = &detected when
err == nil, and for err != nil do not set r.IsJumpstarter to false—log
r.Log.Error(err, "failed to detect Jumpstarter CRD") or handle retry logic
instead; ensure callers of detectJumpstarter handle a nil r.IsJumpstarter
appropriately (or have detectJumpstarter return (bool, error) if preferred).
Only cache definitive detection results (success/NotFound) and allow retry for transient errors like RBAC or network issues. This prevents false negatives during controller startup or temporary connectivity problems. Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Currently detects whether jumpstarter is available, and depends on a hardcoded config for flashing instructions
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.