Skip to content

Reconcile loop bug that fetches images several times per second - #50

Merged
anton-paulovich merged 7 commits into
cobaltcore-dev:masterfrom
yahor-kurachkin:fix/reconcilation-loop
Sep 3, 2026
Merged

anton-paulovich merged 7 commits into
cobaltcore-dev:masterfrom
yahor-kurachkin:fix/reconcilation-loop

Conversation

@yahor-kurachkin

@yahor-kurachkin yahor-kurachkin commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a reconcile loop bug that fetches images several times per second instead of one time per 5 minute

Changes:

  • cloudprofilesync/ossync/provider/openstack/provider.go
  • cloudprofilesync/ossync/source/glance/os_source.go
  • cloudprofilesync/ossync/source/glance/os_source_test.go
  • cloudprofilesync/ossync/os_image_updater.go
  • cloudprofilesync/ossync/os_image_updater_test.go
  • controllers/cloud_profile.go
  • controllers/managedcloudprofile_controller.go

Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
…_source

Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
…ration

Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
Signed-off-by: C5421281 <yahor.kurachkin@sap.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 06:33

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.

🟢 Approval recommended

The changes directly address common sources of reconcile churn (no-op status patches, unstable ordering, and unstable expiration timestamps) and include targeted test coverage for the new Glance expiration behavior.

Pull request overview

Fixes a tight reconcile loop that was repeatedly re-fetching machine images by reducing no-op status patches and stabilizing CloudProfile updates (both provider config ordering and deprecated-image expiration date handling).

Changes:

  • Skip status subresource patching when ManagedCloudProfile.Status is unchanged, and only reconcile MCP updates on generation changes.
  • Preserve previously-written expiration dates for deprecated machine image versions when regenerating CloudProfile.Spec.
  • Stabilize OpenStack ProviderConfig region ordering and ensure Glance’s deprecated version gets an expiration date; adjust updater/tests accordingly.
File summaries
File Description
controllers/managedcloudprofile_controller.go Avoid no-op status patches and reduce reconcile triggers to generation changes for MCP objects.
controllers/cloud_profile.go Preserve deprecated image expiration dates across reconciles to prevent CloudProfile churn.
cloudprofilesync/ossync/source/glance/os_source.go Stamp an expiration date on the deprecated (oldest) version when missing.
cloudprofilesync/ossync/source/glance/os_source_test.go Adds coverage that deprecated Glance version receives an expiration date and supported does not.
cloudprofilesync/ossync/provider/openstack/provider.go Sort region mappings to make ProviderConfig JSON stable across reconciles.
cloudprofilesync/ossync/os_image_updater.go Simplifies expiration resolution to prefer existing values; avoids stamping new dates in updater paths.
cloudprofilesync/ossync/os_image_updater_test.go Removes the updater “stamp expiration when missing” test to match new behavior.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@anton-paulovich
anton-paulovich merged commit 6fac99f into cobaltcore-dev:master Sep 3, 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.

4 participants