Repository navigation
Feat/persistence logs subpath - #297
CaioMartins968 wants to merge 10 commits into
Conversation
Lets logs share a PVC (e.g. the worker's, via existingClaim) without the two volumes' contents landing in the same root directory. Mirrors the subPath support the valkey subchart's dataStorage already has. Fully backward compatible: subPath is only added to the volumeMount when set, so existing deployments render identically.
Mirrors the subPath support just added to persistence.logs, for symmetry: lets the worker's sites-dir share a PVC with another volume via existingClaim without the two volumes' contents mixing at the mount root. Backward compatible: subPath is only added to the volumeMount when set, so existing deployments render identically.
|
@revant hey! Opened this small PR adding subPath support to persistence.worker and persistence.logs — would appreciate a look whenever you have a moment. Context: on storage backends that provision per-PVC with a large minimum size (e.g. Azure Files Provisioned v2, which has a 32Gi floor regardless of the requested size), pointing persistence.logs.existingClaim at the same PVC already used by the worker is the only way to avoid paying for a second share just for logs. The problem is neither volume's mount supports subPath, so both end up writing to the same PVC root and mixing content. This PR just exposes subPath on both, mirroring the pattern the valkey subchart already uses for dataStorage.subPath. It's small and fully backward compatible — subPath is optional and only added to the mount when set, so existing values files render identically. Tested with helm template/helm lint, and also verified live on a cluster that two volumes sharing one PVC via different subPath values stay isolated and persist correctly across pod restarts. Happy to adjust anything if you'd rather see it done differently. |
Resolves the version conflict by taking upstream's version/appVersion (8.0.72/v16.32.0) as the base and bumping one more patch (8.0.73) for this branch's own change.
|
can you fix the conflicts and CI |
README.md is generated by helm-docs from the root README.md.gotmpl template; I had hand-edited the generated README.md directly in an earlier commit, which the helm-docs-built pre-commit hook (correctly) flagged as drift since regenerating from the template wiped that edit and also caught a stale version/appVersion badge. Moved the persistence.logs.subPath documentation into the actual template source and regenerated README.md for real.
@revant fixed both — rebased on latest main (conflict was just the Chart.yaml version bump) and the CI failure was helm-docs-built flagging drift because I'd hand-edited the generated README.md instead of README.md.gotmpl; moved the doc into the template and regenerated it for real, verified locally with pre-commit run --all-files (all green now). Looks like the new run is sitting on action_required though — could you approve it from the Actions tab when you get a chance? |
…-subpath # Conflicts: # erpnext/Chart.yaml
|
Regenerate README.md with helm-docs (also picks up the chart version bump from main). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Hi @revant, @disha-itpl! 👋 This PR is ready for another look whenever you have a moment. Since the last
Everything is still fully backward compatible: with no subPath set, the rendered Could one of you approve the workflow run (it's waiting on action_required) and |
Problem
persistence.workerandpersistence.logsboth supportexistingClaim, which lets you point either volume at a PVC that already exists instead of having the chart provision a new one. This is useful whenever you want two of the chart's volumes to live on the same underlying PVC instead of two separate ones — for example, on storage backends that bill or provision per-PVC with a large minimum size (e.g. Azure Files "Provisioned v2" shares have a 32Gi minimum regardless of the requestedsize), where provisioning a second PVC just forlogs(which typically holds a few MB of data) doubles the storage cost for no real benefit.The problem is that neither volume's mount supports
subPath. Bothsites-dir(worker) andlogsare mounted at the root of whatever PVC they're bound to. So if you setpersistence.logs.existingClaimto the same PVC already used bypersistence.worker, both volumes end up writing into the exact same root directory —logs's content lands mixed in with the worker'ssites-dirtree (common_site_config.json,apps.txt, per-site folders, etc.) instead of living in its own subdirectory. There's no way to point two volumes at one PVC without their contents colliding.Change
Adds an optional
subPathfield to bothpersistence.workerandpersistence.logs, wired into the correspondingvolumeMountsentry wherever each volume is mounted (alldeployment-*.yamlandjob-*.yamltemplates that referencesites-dirand/orlogs— 18 files in total, one repeated one-line pattern per volume type). When set, it's passed straight through assubPathon the mount; when unset (the default), the field is omitted entirely and rendering is byte-for-byte identical to today.This mirrors the pattern the
valkeysubchart (dataStorage.persistentVolumeClaimName+dataStorage.subPath) already uses for exactly this purpose, so it's consistent with prior art already vendored in this chart.Example usage — worker and logs sharing one PVC, isolated by subpath:
```yaml
persistence:
worker:
existingClaim: my-app-erpnext
logs:
enabled: true
existingClaim: my-app-erpnext
subPath: logs-data
```
Backward compatibility
Fully additive and opt-in.
subPathdefaults to unset, and the template guards it with{{- if .Values.persistence.worker.subPath }}/{{- if .Values.persistence.logs.subPath }}, so existing values files render identically to before this change — confirmed withhelm templatediffs against the default values.Testing
helm templatewith and withoutsubPathset, for bothpersistence.workerandpersistence.logs— confirmed the mount only gains asubPathline when the value is set, otherwise output is unchanged.helm lintpasses.subPathvalues only ever see their own file, never each other's — and a third pod mounting the PVC withoutsubPathsees both subdirectories cleanly separated at the root, confirming no content mixing. Also verified that data written under asubPathsurvives deleting and recreating the pod, i.e. it's genuinely persisted on the PVC rather than behaving likeemptyDir.