Skip to content

support GEP-31 in place update#38

Merged
anton-paulovich merged 7 commits into
cobaltcore-dev:masterfrom
adziauho:support-GEP-31-in-place-update
Jun 22, 2026
Merged

support GEP-31 in place update#38
anton-paulovich merged 7 commits into
cobaltcore-dev:masterfrom
adziauho:support-GEP-31-in-place-update

Conversation

@adziauho

@adziauho adziauho commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Automatically detects in-place update support from source image features and propagates it to generated machine image versions, including scenarios that use a clean version.
  • Tests
    • Added/extended coverage to confirm in-place update support is set correctly in both default and capability-enabled/dual-write modes.
  • Chores
    • Updated the Go toolchain to 1.26.2.
    • Refreshed lint/typo and build configuration formatting (no functional impact).

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 96a8870b-4c96-435e-b4c7-db5856b36533

📥 Commits

Reviewing files that changed from the base of the PR and between f19d0e6 and d9a05fb.

📒 Files selected for processing (6)
  • .golangci.yaml
  • .typos.toml
  • Makefile.maker.yaml
  • cloudprofilesync/imageupdater.go
  • cloudprofilesync/imageupdater_test.go
  • cloudprofilesync/source.go
✅ Files skipped from review due to trivial changes (1)
  • .typos.toml
🚧 Files skipped from review as they are similar to previous changes (2)
  • cloudprofilesync/imageupdater_test.go
  • cloudprofilesync/imageupdater.go

📝 Walkthrough

Walkthrough

Exports Feature and capability-key constants in source.go, replacing inline string literals in validFeatureValues and GetVersions capability construction. In ImageUpdater.Update, computes supportInPlaceUpdate by checking whether Capabilities[FeatureCapability] contains USIFeature, and sets InPlaceUpdates{Supported: true} on MachineImageVersion entries for both legacy/tag and clean-version paths. Tests verify this behavior under both default and EnableCapabilities: true configurations. Go toolchain is bumped to 1.26.2, and linter/build configurations are updated.

Changes

USIFeature In-Place Update Support

Layer / File(s) Summary
Exported Feature and capability constants
cloudprofilesync/source.go
Introduces exported Feature string constants (ChostFeature, PXEFeature, SCIFeature, SCIBaseFeature, CAPIFeature, USIFeature, USIDevFeature) and capability-key constants (ArchitectureCapability, FeatureCapability), replacing inline string literals in the validFeatureValues allowlist map.
GetVersions using capability constants
cloudprofilesync/source.go
Updates GetVersions method to construct Capabilities map using ArchitectureCapability and FeatureCapability constants as keys instead of hard-coded string literals.
InPlaceUpdates flag on MachineImageVersion
cloudprofilesync/imageupdater.go
Computes supportInPlaceUpdate by checking Capabilities[FeatureCapability] for USIFeature, then conditionally sets InPlaceUpdates{Supported: true} on newly appended and existing MachineImageVersion entries in both legacy/tag and clean-version code paths.
Tests for InPlaceUpdates.Supported
cloudprofilesync/imageupdater_test.go
Adds Ginkgo test cases under flag OFF (default) and flag ON (EnableCapabilities: true) configurations, each asserting InPlaceUpdates.Supported == true on generated MachineImageVersion entries when source image carries USIFeature; updates an existing flag ON test with additional assertion.

Configuration and Toolchain Updates

Layer / File(s) Summary
Go toolchain and linter configuration
go.mod, .golangci.yaml
Updates go directive from 1.26 to 1.26.2; adjusts .golangci.yaml formatting for dupword, goconst, and gomoddirectives configurations; broadens go-version-pattern regex to allow optional patch components instead of only .0.
Build and spelling configuration
Makefile.maker.yaml, .typos.toml
Reformats Makefile.maker.yaml indentation for cloud-profile-sync binary entry and reuse.annotations blocks; adds ded to .typos.toml extend-words allowlist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • cobaltcore-dev/cloud-profile-sync#30: Introduces the feature-set capabilities support and dual-write plumbing for CleanVersion and Capabilities["feature"] that this PR relies on to populate InPlaceUpdates.Supported.
  • cobaltcore-dev/cloud-profile-sync#32: Both PRs touch cloudprofilesync/source.go's GetVersions logic around the architecture/feature annotation keys, with changes overlapping in the same code path.

Suggested reviewers

  • anton-paulovich
  • defo89
  • valeryia-hurynovich

Poem

🐇 Hop, hop, the rabbit declares with cheer,
Constants exported, so clean and clear!
USIFeature checked, InPlaceUpdates set,
Both legacy paths and clean ones yet—
No more hard strings hiding about,
The toolchain bumps; refactored, no doubt! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'support GEP-31 in place update' directly reflects the main change: adding support for in-place update capability propagation to MachineImageVersion entries based on feature detection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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)
cloudprofilesync/imageupdater.go (1)

91-93: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Existing versions are not reconciled for InPlaceUpdates.

Line 89 computes supportInPlaceUpdate, but existing-version paths only patch architectures. If a version already exists, InPlaceUpdates stays stale (never added/removed), so spec can drift from source capabilities.

Proposed fix pattern
 if idx, exists := existingVersions[sourceImage.Version]; exists {
 	image.Versions[idx].Architectures = sourceImage.Architectures
+	if supportInPlaceUpdate {
+		image.Versions[idx].InPlaceUpdates = &gardenerv1beta1.InPlaceUpdates{Supported: true}
+	} else {
+		image.Versions[idx].InPlaceUpdates = nil
+	}
 } else {
   ...
 }
@@
 if idx, exists := existingVersions[sourceImage.CleanVersion]; exists {
 	existing := &image.Versions[idx]
 	for _, arch := range sourceImage.Architectures {
 		if !slices.Contains(existing.Architectures, arch) {
 			existing.Architectures = append(existing.Architectures, arch)
 		}
 	}
+	if supportInPlaceUpdate {
+		existing.InPlaceUpdates = &gardenerv1beta1.InPlaceUpdates{Supported: true}
+	} else {
+		existing.InPlaceUpdates = nil
+	}
 } else {
   ...
 }

Also applies to: 118-124

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cloudprofilesync/imageupdater.go` around lines 91 - 93, When an existing
version is found in the existingVersions map within the block where `if idx,
exists := existingVersions[sourceImage.Version]; exists`, only the Architectures
field is being patched but the InPlaceUpdates field is not being reconciled. The
supportInPlaceUpdate variable that was computed should also be used to update
the InPlaceUpdates field of the existing version to prevent it from drifting
from source capabilities. Apply this same reconciliation pattern to both
occurrences of this existing version update logic.
🧹 Nitpick comments (1)
cloudprofilesync/source.go (1)

34-35: ⚡ Quick win

Rename misspelled exported constant before it spreads.

USIDevFeatrue at Line 34 is typoed (should be USIDevFeature). Since it is exported, this will leak a misspelled API name into consumers and tests.

Proposed fix
-	USIDevFeatrue = "_usidev"
+	USIDevFeature = "_usidev"
@@
-	USIDevFeatrue:  {},
+	USIDevFeature:  {},

Also applies to: 45-45

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cloudprofilesync/source.go` around lines 34 - 35, The exported constant
USIDevFeatrue contains a typo (should be USIDevFeature). Rename this constant to
the correct spelling USIDevFeature. Since this constant is exported and appears
in multiple locations (including line 45 as noted), search for all usages of the
misspelled constant name USIDevFeatrue throughout the codebase and update them
to use the corrected spelling USIDevFeature to ensure consistency across all
references.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cloudprofilesync/imageupdater_test.go`:
- Around line 341-358: The test case at the It block for "reflect inplace update
ability to machineimage" needs to be extended to cover the clean-version path.
Modify the mockSource.images SourceImage to include a CleanVersion field set to
a different value than the Version field (e.g., "1.0" while Version is "1.0.0").
After calling updater.Update and verifying the first version entry, add an
additional assertion to check that the clean-version entry also has
InPlaceUpdates.Supported set to true, ensuring the test exercises both the
legacy append path and the new clean-version path in ImageUpdater.Update.

---

Outside diff comments:
In `@cloudprofilesync/imageupdater.go`:
- Around line 91-93: When an existing version is found in the existingVersions
map within the block where `if idx, exists :=
existingVersions[sourceImage.Version]; exists`, only the Architectures field is
being patched but the InPlaceUpdates field is not being reconciled. The
supportInPlaceUpdate variable that was computed should also be used to update
the InPlaceUpdates field of the existing version to prevent it from drifting
from source capabilities. Apply this same reconciliation pattern to both
occurrences of this existing version update logic.

---

Nitpick comments:
In `@cloudprofilesync/source.go`:
- Around line 34-35: The exported constant USIDevFeatrue contains a typo (should
be USIDevFeature). Rename this constant to the correct spelling USIDevFeature.
Since this constant is exported and appears in multiple locations (including
line 45 as noted), search for all usages of the misspelled constant name
USIDevFeatrue throughout the codebase and update them to use the corrected
spelling USIDevFeature to ensure consistency across all references.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dca6ed2c-0edb-47dc-a74f-5d5c785a04d4

📥 Commits

Reviewing files that changed from the base of the PR and between d69a5c1 and afe7698.

📒 Files selected for processing (4)
  • cloudprofilesync/imageupdater.go
  • cloudprofilesync/imageupdater_test.go
  • cloudprofilesync/source.go
  • go.mod

Comment thread cloudprofilesync/imageupdater_test.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds propagation of in-place update support (GEP-31) from OCI source image capabilities into the generated CloudProfile machineImages[].versions[].inPlaceUpdates fields, with accompanying tests, and updates some Go/tooling metadata.

Changes:

  • Introduces feature/capability constants and uses them when parsing OCI annotations into Capabilities.
  • Derives and writes MachineImageVersion.InPlaceUpdates.Supported based on the presence of the _usi feature, and adds/extends test coverage.
  • Updates the module Go version and adjusts golangci-lint configuration.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
go.mod Updates the module Go version directive.
cloudprofilesync/source.go Adds feature/capability constants and updates capability construction/allowlisting.
cloudprofilesync/imageupdater.go Sets InPlaceUpdates on created machine image versions based on capabilities.
cloudprofilesync/imageupdater_test.go Adds tests asserting in-place update propagation behavior.
.golangci.yaml Minor formatting tweaks and updates go-version-pattern (currently with a regex issue).
Comments suppressed due to low confidence (1)

cloudprofilesync/imageupdater.go:93

  • When a version already exists in the CloudProfile, only Architectures is updated. If in-place update support is discovered later (or capabilities are added after initial reconcile), InPlaceUpdates will never be set for existing entries. Consider updating InPlaceUpdates in the exists branch as well (at least when support is true).
		supportInPlaceUpdate := slices.Contains(sourceImage.Capabilities[FeatureCapability], USIFeature)
		// Always write the full tag version (legacy path, safe for running Shoots).
		if idx, exists := existingVersions[sourceImage.Version]; exists {
			image.Versions[idx].Architectures = sourceImage.Architectures
		} else {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .golangci.yaml Outdated
Comment thread cloudprofilesync/source.go
Comment thread cloudprofilesync/imageupdater_test.go Outdated
Comment thread cloudprofilesync/imageupdater_test.go Outdated
Comment thread cloudprofilesync/imageupdater.go
Comment thread cloudprofilesync/source.go Outdated

@anton-paulovich anton-paulovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@anton-paulovich anton-paulovich merged commit aafeaff into cobaltcore-dev:master Jun 22, 2026
7 checks passed
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