Repository navigation
feat(chart): set the number of app replicas - #310
Conversation
Pin foca-common 0.3.0 and expose its cloudRegistry.replicas and cloudRegistry.podDisruptionBudget values (values.yaml, schema, a template for the PodDisruptionBudget), with chart tests, and document replicas and their caveats in the chart's README. Chart.lock and charts.sha256 still lock 0.2.0 until foca-common 0.3.0 is released. Closes #307 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test the schema's rejection of invalid replicas and budgets, split the budget tests by case, add the feature to the notes of 1.0.0rc1, keep "with FOCA 0.18" in the schema's comment, and take the library's updated schema of podDisruptionBudget.enabled (null allowed). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rolling updates replace pods one by one (a new pod first only with up to 3 replicas), spreading across nodes is not guaranteed, unready pods don't block drains (unhealthyPodEvictionPolicy of foca-common 0.3.0, now expected by the chart tests), and Gunicorn workers count as instances only with more than one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR upgrades the chart to foca-common 0.3.0 and exposes configurable application replicas with optional, replica-aware PodDisruptionBudget support. It updates schemas, templates, operational documentation, and release notes, with tests covering rendering defaults, budget configuration, disabling, and invalid values. The dependency lock and packaged checksum intentionally await publication of foca-common 0.3.0. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Update Chart.lock and charts.sha256 to the published foca-common 0.3.0 chart (ghcr.io digest sha256:accab959...), which adds app replicas and a PodDisruptionBudget. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #310 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 2368 2368
=========================================
Hits 2368 2368 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="deployment/README.md" line_range="738-740" />
<code_context>
kubectl scale deploy/cloud-registry -n <namespace> --replicas=1
```
+ With several replicas (see [Replicas](#replicas)), scale to
+ `cloudRegistry.replicas` instead, or run `helm upgrade` with the values
+ file, which restores it.
+
Once the new release works, delete a retained volume
</code_context>
<issue_to_address>
**Restore configured replica count**
The issue asks to replace the hard-coded --replicas=1 in the upgrade steps. The restore command still sets one replica; the added guidance asks multi-replica users to adjust it manually or run helm upgrade.
</issue_to_address>Linked issues
#307 feat(chart): set the number of app replicas · 4 of 6 met · 1 to check by hand
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Pin foca-common 0.3.0 and expose replicas and PodDisruptionBudget settings. | ✅ Met | Chart.yaml, Chart.lock, and charts.sha256 use 0.3.0; values, schema, template, and documentation links are updated. |
| 2 | Keep the default at one replica. | ✅ Met | values.yaml sets replicas to 1, and chart tests verify the default. |
| 3 | Set the ELIXIR On-Cloud deployment to two replicas. | 👀 Check by hand (external system) | Check the ELIXIR On-Cloud deployment's release values to confirm it sets cloudRegistry.replicas to 2. |
| 4 | Document replica operation and the listed multi-replica caveats. | ✅ Met | The README covers service-counter corrections, clock synchronization, MongoDB availability, and scaling back after stopped-app upgrades, among other caveats. |
| 5 | Replace the hard-coded --replicas=1 in the upgrade steps. | 🟡 Partly met | The README tells multi-replica users to scale to cloudRegistry.replicas or run helm upgrade, but the restore command still specifies --replicas=1. |
| 6 | Add chart tests for replicas and disruption budgets. | ✅ Met | Tests cover defaults, multiple replicas, budget bounds and disabling, invalid values, and resource names. |
Sourcery assessment
Needs a human reviewer. 1 finding to address first, and when configured for multiple replicas, the chart changes Kubernetes deployment and eviction behavior; a faulty replica count or disruption budget could cause downtime during node drains or upgrades. Reverting removes the configuration, but it cannot undo an outage that already occurred.
Blocking findings: deployment/README.md:740
Scale the app back to cloudRegistry.replicas after the restore in the legacy-chart migration, instead of a fixed single replica. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
Summary
Exposes the new values of foca-common 0.3.0 in Cloud Registry's chart:
cloudRegistry.replicas(1 by default) andcloudRegistry.podDisruptionBudget(enabled,minAvailable/maxUnavailable; rendered only with more than one replica,maxUnavailable: 1by default, unready pods always evictable) invalues.yaml,values.schema.json($defsof the library's 0.3.0 schema) and a newtemplates/poddisruptionbudget.yaml;deployment/README.md(also served asdocs/deployment.md): new "Replicas" section with the multi-replica caveats (counter off by one while a pod starts, node clocks for lock staleness, per-process memory and caches, rules changed in the database directly, single-pod MongoDB, scaling to 0 for upgrades), the restore step of the legacy-chart migration, and links to the library docs atchart-v0.3.0;test_names).Multi-replica safety
The app is correct with several replicas: it already runs as several instances (rolling updates, Gunicorn workers). Roles, invitations, locks, counters and types are in MongoDB, written atomically or with compare-and-swap; the startup tasks (
add_service_keys(),resume_renames(),add_service_creators(),reconcile_service_counts(),add_service_types(),sync_pending_services()) are written to run concurrently; FOCA's adapter records rule changes that every instance applies before its next request;_last_resumeinrename.pyonly throttles per worker, and_claim()resumes each rename once.Closes #307
Verification
deployment/charts/:pytest tests/test_chart.py tests/test_chart_readme.py tests/test_check_release_pins.py: all pass excepttest_library_dependencyandtest_packaged_chart_includes_library, which compare withChart.lock(still 0.2.0, see above).ruff check,ruff format --checkontests/: passed.Review
Adversarial and quality review; no high findings. Fixed: the medium ones (tests of schema rejections, release notes entry) and the lows (test split, "with FOCA 0.18" kept in the schema comment, README wording on rolling updates, spreading and Gunicorn workers). The finding on unready pods blocking drains was fixed in the library (
unhealthyPodEvictionPolicy: AlwaysAllow, foca#585).Declined review findings
NOTES.txtordocs/upgrading.md(low): defaults are unchanged, so no upgrade step is needed; the README covers them.Open questions
None; this PR only waits for the foca-common 0.3.0 release.
🤖 Generated with Claude Code
Summary by Sourcery
Support running the Cloud Registry chart with configurable app replicas and disruption protection while documenting the operational considerations.
New Features:
Enhancements:
Documentation:
Tests: