Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(helm): make the data-files claim access modes configurable (#4425)

Jay0130-a0aa1a517c867
diff --git a/helm/templates/pvc.yaml b/helm/templates/pvc.yaml
index 5d04d7350..952666ce2 100644
--- a/helm/templates/pvc.yaml
+++ b/helm/templates/pvc.yaml
@@ -73,7 +73,7 @@ metadata:
{{- include "weknora.componentLabels" (dict "component" "storage" "context" .) | nindent 4 }}
spec:
accessModes:
- - ReadWriteOnce
+ {{- toYaml (.Values.dataFiles.persistence.accessModes | default (list "ReadWriteOnce")) | nindent 4 }}
resources:
requests:
storage: {{ .Values.dataFiles.persistence.size }}
diff --git a/helm/tests/test_app_storage.py b/helm/tests/test_app_storage.py
index 8f177e7eb..3939dfd5c 100644
--- a/helm/tests/test_app_storage.py
+++ b/helm/tests/test_app_storage.py
@@ -101,6 +101,32 @@ class AppStorageTests(unittest.TestCase):
env = app["spec"]["template"]["spec"]["containers"][0]["env"]
self.assertIn({"name": "STORAGE_TYPE", "value": "local"}, env)
+ def data_files_claim(self, documents):
+ return next(doc for doc in documents
+ if doc["kind"] == "PersistentVolumeClaim"
+ and doc["metadata"]["name"] == "audit-weknora-data-files")
+
+ def test_data_files_claim_defaults_to_read_write_once(self):
+ pvc = self.data_files_claim(self.documents())
+ self.assertEqual(pvc["spec"]["accessModes"], ["ReadWriteOnce"])
+
+ def test_data_files_access_modes_are_configurable(self):
+ """A shared filesystem can keep the chart's rolling-update default.
+
+ The claim was hard-coded to ReadWriteOnce, so an RWX storage class
+ could not be used for the chart-created volume at all: the upgrade
+ then failed with Multi-Attach and the only way out was an
+ ``existingClaim``. Setting the access modes lets that deployment keep
+ ``app.strategy.type: RollingUpdate``.
+ """
+ documents = self.documents({"dataFiles": {"persistence": {
+ "accessModes": ["ReadWriteMany"],
+ }}})
+ self.assertEqual(self.data_files_claim(documents)["spec"]["accessModes"],
+ ["ReadWriteMany"])
+ app = self.app(documents)
+ self.assertEqual(app["spec"]["strategy"]["type"], "RollingUpdate")
+
def test_shared_storage_example_references_existing_claim(self):
values = self.readme_values("values-production.yaml")
override = self.readme_values("values-shared-storage.yaml")
diff --git a/helm/values.yaml b/helm/values.yaml
index b1dff14ad..bc44dec4f 100644
--- a/helm/values.yaml
+++ b/helm/values.yaml
@@ -62,7 +62,11 @@ app:
# -- Number of replicas
replicaCount: 1
- # -- App update strategy. Use Recreate for single-replica, single-node-attach storage.
+ # -- App update strategy. `RollingUpdate` needs storage that can be attached
+ # by two Pods at once: with the default `ReadWriteOnce` `data-files` claim an
+ # upgrade fails with `Multi-Attach error` unless this is `Recreate`. Set
+ # `dataFiles.persistence.accessModes` to `ReadWriteMany` to keep rolling
+ # updates with more than one replica.
strategy:
type: RollingUpdate
# -- Only used with RollingUpdate; integers and percentages are supported.
@@ -366,6 +370,12 @@ dataFiles:
enabled: true
# -- Size of the PVC
size: 10Gi
+ # -- Access modes for the created `data-files` claim. The chart's default
+ # single-writer claim requires `app.strategy.type: Recreate` (see
+ # `app.strategy`); set `ReadWriteMany` here when the storage class supports
+ # it (NFS, CephFS, EFS, ...) and the App can keep rolling updates.
+ accessModes:
+ - ReadWriteOnce
# -- Use existing PVC (leave empty to create new)
existingClaim: ""