Repository navigation
feat: support temp volume as volumeClaimTemplate in StatefulSet - #1077
Conversation
This change allows the ncps Helm chart to use a volumeClaimTemplate for the temporary volume when the application is running in StatefulSet mode and config.cache.tempVolume.type is set to pvc. Previously, the temporary volume was always rendered as a regular volume in the Pod spec, which meant all replicas in a StatefulSet would share the same PVC if a name was provided, or each would get a separate emptyDir if that was the type. By using volumeClaimTemplates, Kubernetes automatically creates a unique PVC for each replica, providing better isolation and persistence for temporary data (like chunking/downloads) in HA deployments. The temp-pvc.yaml template was updated to only render in deployment mode, as it's redundant (and potentially conflicting) for StatefulSet mode. Tests were updated to verify the correct rendering in both StatefulSet and Deployment modes.
|
This change is part of the following stack: Change managed by git-spice. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the ncps Helm chart's capability to manage temporary volumes for applications deployed as Kubernetes StatefulSets. By introducing volumeClaimTemplates for temporary PVCs, it ensures proper isolation and persistence of temporary data across individual replicas, addressing previous limitations where temporary volumes were either shared or ephemeral. This change improves the robustness and scalability of StatefulSet deployments requiring dedicated temporary storage. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for using volumeClaimTemplate for the temporary volume in StatefulSet mode, which is a great improvement for HA deployments. The changes are well-structured, with a new helper for the template, updated logic in the StatefulSet manifest, and corresponding adjustments to the standalone PVC and tests. The test suite has been thoroughly updated to cover the new functionality and edge cases.
I've found a couple of issues related to incorrect indentation in the new ncps.tempVolumeClaimTemplate helper, which would cause the Helm chart to render invalid YAML. My review comments provide specific fixes for these. Otherwise, the implementation looks solid.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1077 +/- ##
=====================================
Coverage 5.04% 5.04%
=====================================
Files 6 6
Lines 436 436
=====================================
Hits 22 22
Misses 410 410
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This adds comprehensive unit tests for the recently added volumeClaimTemplates support for temporary volumes in the StatefulSet mode. It validates that annotations and selectors are correctly rendered with the expected indentation in the final manifest. The tests ensure: - Annotations are correctly passed to the volumeClaimTemplate's metadata. - Selectors are correctly passed to the volumeClaimTemplate's spec. - Indentation in the final output matches the surrounding template (10 spaces for content blocks). Also addressed PR feedback regarding indentation logic in the helpers.
This change allows the ncps Helm chart to use a volumeClaimTemplate for the temporary volume when the application is running in StatefulSet mode and config.cache.tempVolume.type is set to pvc. Previously, the temporary volume was always rendered as a regular volume in the Pod spec, which meant all replicas in a StatefulSet would share the same PVC if a name was provided, or each would get a separate emptyDir if that was the type. By using volumeClaimTemplates, Kubernetes automatically creates a unique PVC for each replica, providing better isolation and persistence for temporary data (like chunking/downloads) in HA deployments. The temp-pvc.yaml template was updated to only render in deployment mode, as it's redundant (and potentially conflicting) for StatefulSet mode. Tests were updated to verify the correct rendering in both StatefulSet and Deployment modes. (cherry picked from commit 4d4123e)
|
Successfully created backport PR for |
…port #1077] (#1078) Bot-based backport to `release-0.9`, triggered by a label in #1077. This change allows the ncps Helm chart to use a volumeClaimTemplate for the temporary volume when the application is running in StatefulSet mode and config.cache.tempVolume.type is set to pvc. Previously, the temporary volume was always rendered as a regular volume in the Pod spec, which meant all replicas in a StatefulSet would share the same PVC if a name was provided, or each would get a separate emptyDir if that was the type. By using volumeClaimTemplates, Kubernetes automatically creates a unique PVC for each replica, providing better isolation and persistence for temporary data (like chunking/downloads) in HA deployments. The temp-pvc.yaml template was updated to only render in deployment mode, as it's redundant (and potentially conflicting) for StatefulSet mode. Tests were updated to verify the correct rendering in both StatefulSet and Deployment modes.
## Summary The `[Unreleased]` section was populated in #1309 but skewed toward the recent CDC-drain, in-flight-staging, and Ent-migration work, omitting several user-facing features and fixes that also landed since v0.9.4. This backfills the missing notable changes, each cross-referenced by PR. **Added** - `ncps fsck` command + Helm fsck CronJob (#975, #996, #998, #999, #1000, #1004, #1006, #1176) - Closure pinning HTTP endpoints `POST`/`DELETE /pin/{hash}.narinfo`, `GET /pins` (#1108) - pprof server via `--pprof-addr` (#1063) - CDC lazy chunking as a feature + `--cache-cdc-lazy-cleanup-schedule` + recovery cron (#1082, #1083, #1089, #1096) - Helm: auto `GOMEMLIMIT` (#1061), configurable temp volume / `volumeClaimTemplate` (#1074, #1077), SQLite `Recreate` strategy (#1012) - Startup storage reporting + deprecated-narinfo warning (#959, #961) - `docker-dev` image (#1097) **Fixed** - `store/tmp` no longer wiped on startup (#1313) - `nix-hash` NAR verification (#1101) - Prometheus counters primed at startup (#1337, #1343) - 404 on un-reassemblable chunked NARs (#1319), purged narinfo no longer 500 (#1318), fail-fast tmp validation (#1086) - Further CDC/cache reliability fixes (#1317, #1346, #1341, #1342, #1331, #1347) **Changed** - CDC config now persisted in the DB config table (#971) Dependency bumps, CI/test-only changes, and the internal Ent-conversion PRs are intentionally excluded; the existing Ent-migration entry already covers that work. ## Test plan - [x] `nix fmt` reports no changes (docs-only edit) - [x] CHANGELOG section structure intact (Added/Fixed/Changed/Removed/Migration/CI)
This change allows the ncps Helm chart to use a volumeClaimTemplate for the temporary volume when the application is running in StatefulSet mode and config.cache.tempVolume.type is set to pvc.
Previously, the temporary volume was always rendered as a regular volume in the Pod spec, which meant all replicas in a StatefulSet would share the same PVC if a name was provided, or each would get a separate emptyDir if that was the type.
By using volumeClaimTemplates, Kubernetes automatically creates a unique PVC for each replica, providing better isolation and persistence for temporary data (like chunking/downloads) in HA deployments.
The temp-pvc.yaml template was updated to only render in deployment mode, as it's redundant (and potentially conflicting) for StatefulSet mode.
Tests were updated to verify the correct rendering in both StatefulSet and Deployment modes.