Skip to content

Support subPath on persistence to allow sharing a single PVC across services #933

@markussiebert

Description

@markussiebert

Description

The oCIS Helm chart creates separate Deployments for each service (web, nats, search, storageusers, thumbnails), each with its own persistence configuration. Currently, each service requires its own PVC since there is no subPath option on the persistence config.

In environments with CSI drivers that have limited resources (e.g., Proxmox CSI with SCSI LUN limits), having 5+ PVCs for a single application is wasteful. It would be great if the chart supported a subPath option on each service's persistence so that multiple services can share a single PVC, each writing to its own subdirectory.

Desired behavior

services:
  web:
    persistence:
      enabled: true
      existingClaim: ocis-data
      subPath: web
  nats:
    persistence:
      enabled: true
      existingClaim: ocis-data
      subPath: nats
  search:
    persistence:
      enabled: true
      existingClaim: ocis-data
      subPath: search
  storageusers:
    persistence:
      enabled: true
      existingClaim: ocis-data
      subPath: storageusers
  thumbnails:
    persistence:
      enabled: true
      existingClaim: ocis-data
      subPath: thumbnails

This would produce Deployments where the volumeMount includes subPath, e.g.:

volumeMounts:
  - name: web-data
    mountPath: /var/lib/ocis
    subPath: web

Workaround

Currently we use Flux postRenderers with strategic merge patches to inject subPath into each Deployment's volumeMount:

spec:
  values:
    services:
      web:
        persistence:
          enabled: true
          existingClaim: ocis-data
      nats:
        persistence:
          enabled: true
          existingClaim: ocis-data
      search:
        persistence:
          enabled: true
          existingClaim: ocis-data
      storageusers:
        persistence:
          enabled: true
          existingClaim: ocis-data
      thumbnails:
        persistence:
          enabled: true
          existingClaim: ocis-data
  postRenderers:
    - kustomize:
        patches:
          - target:
              kind: Deployment
              name: web
            patch: |
              apiVersion: apps/v1
              kind: Deployment
              metadata:
                name: web
              spec:
                template:
                  spec:
                    containers:
                      - name: web
                        volumeMounts:
                          - name: web-data
                            mountPath: /var/lib/ocis
                            subPath: web
          - target:
              kind: Deployment
              name: nats
            patch: |
              apiVersion: apps/v1
              kind: Deployment
              metadata:
                name: nats
              spec:
                template:
                  spec:
                    containers:
                      - name: nats
                        volumeMounts:
                          - name: nats-data
                            mountPath: /var/lib/ocis
                            subPath: nats
          # ... same pattern for search, storageusers, thumbnails

This works but is verbose and fragile — it breaks if the chart changes container or volume names.

Motivation

  • Reduces the number of PVCs from 5 to 1
  • Frees SCSI LUNs on storage backends with limited slots (e.g., Proxmox CSI)
  • Simplifies backup (one PVC to snapshot instead of five)
  • Standard Kubernetes pattern (subPath on volumeMount)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions