feat: pin database image to prevent silent changes on CP upgrade#403
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR implements container image reconciliation and pinning for service instances. The orchestrator interface gains a new ChangesService Instance Spec Reconciliation with Image Pinning
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Up to standards ✅🟢 Issues
|
| Category | Results |
|---|---|
| Complexity | 2 medium |
🟢 Metrics 28 complexity · 0 duplication
Metric Results Complexity 28 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
This PR pins each database instance's container image at creation time by persisting it in
ResolvedImagewithin etcd. Subsequent reconciles use the storedResolvedImagedirectly rather than re-resolving the image from the manifest, ensuring that Control Plane upgrades cannot inadvertently change the image of an existing running database.Changes
ReconcileInstanceSpecinorchestrator/swarm/orchestrator.goto preserve the existingResolvedImagewhenPgEdgeVersionremains unchanged. This allowsresolveInstanceImages()to take the fast path and avoid manifest lookups during normal reconciles. When the version changes, the stale image pin is cleared and re-resolved from the manifest.resolveServiceImage()andReconcileServiceInstanceSpec()inorchestrator/swarm/orchestrator.go, extending image pinning behavior to MCP, RAG, and PostgREST service instances using the same pattern as PostgreSQL instances.ReconcileServiceInstanceSpec()to theOrchestratorinterface indatabase/orchestrator.go.database/service.goto invokes.orchestrator.ReconcileServiceInstanceSpec()before persisting service instance specifications.database/reconcile_versions.goso that when the instance monitor detects a version change and updatesPgEdgeVersion, it also clearsResolvedImage. This ensures the next reconcile derives the correct image for the new version and prevents no-op updates from reverting externally upgraded instances back to an older image.ReconcileServiceInstanceSpec()inorchestrator/systemd/orchestrator.goto maintain interface compatibility.Testing
Verification:
Test Scenarios
1. No Image Override
create_db_with_no_image.json
.
17.9-spock5.0.6-standard-2) is selected and stored inResolvedImage.2. User Image Override
my-custom-image)create_db.json
.
ResolvedImageis not persisted.3. External Upgrade Followed by No-Op Update
17.9to17.10).17.10and is not reverted to the previous image.