Skip to content

initial jumpstarter integration#31

Merged
bennyz merged 3 commits into
centos-automotive-suite:mainfrom
bennyz:initial-jumpstarter
Jan 21, 2026
Merged

initial jumpstarter integration#31
bennyz merged 3 commits into
centos-automotive-suite:mainfrom
bennyz:initial-jumpstarter

Conversation

@bennyz

@bennyz bennyz commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Currently detects whether jumpstarter is available, and depends on a hardcoded config for flashing instructions

Summary by CodeRabbit

  • New Features

    • Optional Jumpstarter integration for device flashing with configurable target mappings in OperatorConfig
    • Operator auto-detects Jumpstarter availability and exposes a readiness indicator
    • Build responses now include Jumpstarter status and exporter/flash details when applicable
    • CLI prints Jumpstarter availability on build completion
  • Chores

    • CRD schema and operator permissions updated to support Jumpstarter detection and configuration

✏️ Tip: You can customize this high-level summary in your review settings.

Currently detects whether jumpstarter is available, and depends on a hardcoded config for flashing instructions

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@coderabbitai

coderabbitai Bot commented Jan 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
CRD Types & DeepCopy
api/v1alpha1/operatorconfig_types.go, api/v1alpha1/zz_generated.deepcopy.go
Added JumpstarterConfig and JumpstarterTargetMapping; added OperatorConfigSpec.Jumpstarter and OperatorConfigStatus.JumpstarterAvailable; generated DeepCopy methods and integrated Jumpstarter into spec deepcopy.
CRD Schema Manifests
config/crd/bases/automotive.sdv.cloud.redhat.com_operatorconfigs.yaml, bundle/manifests/..._operatorconfigs.yaml
Extended CRD OpenAPI schema with spec.jumpstarter.targetMappings (mapping → JumpstarterTargetMapping with required selector and optional flashCmd) and status.jumpstarterAvailable.
Controller Detection & Reconcile
internal/controller/operatorconfig/controller.go
Added detectJumpstarter() that queries exporters.jumpstarter.dev CRD via apiextensions/v1, cached IsJumpstarter field, integrated detection into reconcile, and added RBAC marker for CRD access.
Build API Types & Server
internal/buildapi/types.go, internal/buildapi/server.go
Added JumpstarterInfo and optional BuildResponse.Jumpstarter; on completed builds, read OperatorConfig and populate Jumpstarter metadata (including placeholder substitution in flashCmd) when mapping exists.
RBAC, Scheme & CSV
config/rbac/role.yaml, cmd/main.go, bundle/manifests/automotive-dev-operator.clusterserviceversion.yaml
Granted get,list,watch on customresourcedefinitions.apiextensions.k8s.io; registered apiextensions/v1 with runtime scheme; updated CSV permissions.
CLI Logging
cmd/caib/main.go
On build completion, print Jumpstarter availability and optional ExporterSelector/FlashCmd details to user output.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • fix golangci lint #32 — modifies internal/controller/operatorconfig/controller.go and reconciler structure; likely related to reconciler changes and CRD handling.

Poem

I’m a rabbit in a dev-field bright,
I sniff CRDs by morning light 🐇
Mappings found and status true,
Flash commands now peek through.
Hop—builds complete, the jumper’s right!

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'initial jumpstarter integration' accurately describes the main change, which introduces Jumpstarter CRD detection and optional configuration support across multiple components and manifests.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@coderabbitai

coderabbitai Bot commented Jan 21, 2026

Copy link
Copy Markdown

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #33

coderabbitai Bot added a commit that referenced this pull request Jan 21, 2026
Docstrings generation was requested by @bennyz.

* #31 (comment)

The following files were modified:

* `cmd/caib/main.go`
* `cmd/main.go`
* `internal/buildapi/server.go`

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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).

Comment thread internal/controller/operatorconfig/controller.go
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>
@bennyz bennyz merged commit a51e61a into centos-automotive-suite:main Jan 21, 2026
4 checks passed
@bennyz bennyz deleted the initial-jumpstarter branch January 21, 2026 17:41
This was referenced Jan 22, 2026
This was referenced Jan 31, 2026
This was referenced Feb 24, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 16, 2026
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.

1 participant