Skip to content

move default target configs to ConfigMap#113

Merged
bennyz merged 1 commit into
centos-automotive-suite:mainfrom
bennyz:default-config-map
Feb 19, 2026
Merged

move default target configs to ConfigMap#113
bennyz merged 1 commit into
centos-automotive-suite:mainfrom
bennyz:default-config-map

Conversation

@bennyz

@bennyz bennyz commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Target build defaults now load from a dedicated configuration source for improved flexibility and separation of concerns.
  • Refactor

    • Restructured target configuration to separate flash-specific settings from build defaults.
    • Simplified target mapping by removing redundant configuration options.
    • Updated configuration management to use new defaults source instead of previous partition-based approach.

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

coderabbitai Bot commented Feb 14, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR refactors the target configuration system by introducing a new JumpstarterTarget type for flash-specific mappings, removing Architecture and ExtraArgs fields from the CRD's JumpstarterTargetMapping, and establishing a separate ConfigMap (aib-target-defaults) to source per-target build defaults via YAML.

Changes

Cohort / File(s) Summary
CRD and Type Definitions
api/v1alpha1/operatorconfig_types.go, api/v1alpha1/zz_generated.deepcopy.go, config/crd/bases/automotive.sdv.cloud.redhat.com_operatorconfigs.yaml, internal/buildapi/types.go
Removed Architecture and ExtraArgs fields from JumpstarterTargetMapping in CRD; introduced new JumpstarterTarget type with Selector and FlashCmd; modified TargetDefaults to remove Selector field; updated OperatorConfigResponse to map JumpstarterTargets to JumpstarterTarget and added new TargetDefaults field.
Build API Server
internal/buildapi/server.go, internal/buildapi/server_test.go
Added loadTargetDefaultsFn helper to read target defaults from ConfigMap via YAML; updated handleGetOperatorConfig to populate JumpstarterTargets using JumpstarterTarget and load TargetDefaults from the new ConfigMap; added gopkg.in/yaml.v3 import.
CLI and Test Updates
cmd/caib/main.go, cmd/caib/main_test.go
Changed applyTargetDefaults to read from config.TargetDefaults instead of config.JumpstarterTargets; renamed field JumpstarterTargets to TargetDefaults in test configuration mappings; updated log messages to reference "target defaults".
Controller and Resources
internal/controller/operatorconfig/controller.go, internal/controller/operatorconfig/resources_test.go
Renamed createOrUpdatePartitionConfig to createOrUpdateTargetDefaults; introduced targetDefaultsYAML variable; changed ConfigMap name from aib-partition-config to aib-target-defaults and data key from partition-rules.yaml to target-defaults.yaml; added YAML parsing tests.
Tekton Tasks
internal/common/tasks/tasks.go, internal/common/tasks/scripts/push_artifact.sh
Updated ConfigMap volume mount from aib-partition-config to aib-target-defaults and path from /etc/partition-config to /etc/target-defaults; added logic to read default partitions from target-defaults configuration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • bkhizgiy

Poem

🐰 Flash configs now hop to a separate nest,
Target defaults from ConfigMaps do their best,
Architecture and ExtraArgs find new ground,
JumpstarterTarget makes the separation sound!

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 accurately summarizes the primary change: moving default target configurations from being embedded in the CRD struct to being sourced from a ConfigMap resource, which is reflected across all modified files.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
internal/controller/operatorconfig/controller.go (2)

42-83: Consider declaring targetDefaultsYAML as const.

Since this is a raw string literal intended to be immutable default configuration, using const instead of var prevents accidental mutation and communicates intent more clearly.

-var targetDefaultsYAML = `targets:
+const targetDefaultsYAML = `targets:

618-644: Function name createOrUpdateTargetDefaults is misleading — it only creates.

The implementation (lines 633-643) explicitly skips updates to preserve user changes. The name suggests update behavior. Consider renaming to ensureTargetDefaults or createTargetDefaultsIfAbsent to match the actual semantics.


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.

@bennyz bennyz requested a review from bkhizgiy February 15, 2026 07:08
@bennyz bennyz merged commit 26043b2 into centos-automotive-suite:main Feb 19, 2026
4 checks passed
@bennyz bennyz deleted the default-config-map branch February 19, 2026 13:15
@coderabbitai coderabbitai Bot mentioned this pull request Mar 2, 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.

2 participants