nextcloud / nextcloud/helm

Unable to mount datadir without `/data` suffix

Open
#531 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go Template
Stars
534
Forks
314
Avg merge
42m
Merged PRs (30d)
1

Description

Describe your Issue

At the moment it is impossible to mount a data directory which is not $somepath/data.

The offending code is in lines 218-226 of deployment.yaml:

            {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
            - name: nextcloud-data
              mountPath: {{ .Values.nextcloud.datadir }}
              subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }}
            {{- else }}
            - name: nextcloud-main
              mountPath: {{ .Values.nextcloud.datadir }}
              subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }}
            {{- end }}

We see that /data is being appended irrespective of the content or existence of subPath.

Another issue is that the data dir is only used if also .Values.persistence.enabled is enabled and it would be convenient to remove this unnecessary and-condition in the same PR, but I am not yet familiar with how atomic we like our PRs here. :-) (context would be #532)

Approaches

I think there are basically two ways to deal with this.

  1. The cleaner version would be to set /data as the subPath-default Value, so it would only break for people who have set a subPath and they would need to update their values accordingly.

  2. The not so nice but non-breaking change would be to add another boolean variable with a glorious name like postFixData which is by default set to true and would then use the old logic, and if it is not set to true it would drop the subPath if empty and not add /data if it is set.

So, which approach do we prefer or did I possibly even miss a trick to make this work without code change?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lines 218-226 of charts/nextcloud/templates/deployment.yaml and inspect the persistence.nextcloudData, persistence, and nextcloud.datadir values involved in the mount. Review the context in issue #532, then confirm the intended compatibility behavior; done means a configured data directory can be mounted without an unintended /data suffix and the related condition is handled consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes
Domain
devops, infrastructure
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.