diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f70182..6a50088 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Changed the default `sourcebot.image.repository` to `ghcr.io/sourcebot-dev/sourcebot`, fixing `unauthorized` pull errors with CRI-O (OpenShift) and Podman. [#153](https://github.com/sourcebot-dev/sourcebot-helm-chart/pull/153) +- Raised the default Sourcebot data volume size (`sourcebot.persistence.size`) from 10Gi to 100Gi for new installs. Existing volumes keep their current size on upgrade unless `size` is set explicitly, so the upgrade does not fail on storage classes that can't resize volumes. Argo CD renders the chart without cluster access, so it can't see an existing volume. Argo CD users relying on the old default should set `sourcebot.persistence.size: 10Gi` to keep their current volume, or set a larger size if their storage class can resize volumes. [#154](https://github.com/sourcebot-dev/sourcebot-helm-chart/pull/154) ## [0.1.118] - 2026-10-31 diff --git a/README.md b/README.md index bf9102a..edabf88 100644 --- a/README.md +++ b/README.md @@ -258,13 +258,13 @@ Each component has its own persistent volume for storing data across pod restart ### Sourcebot -Stores cloned repositories and search indexes. Enabled by default with a 10Gi volume. +Stores cloned repositories and search indexes. Enabled by default. New installs get a 100Gi volume. On upgrade, an existing volume keeps its current size unless you set `size` explicitly. See the [sizing guide](https://docs.sourcebot.dev/docs/deployment/sizing-guide) to choose a size for your repo count. ```yaml sourcebot: persistence: enabled: true # Default - size: 10Gi # Increase for large or many repositories + size: "" # Default. New installs get 100Gi, existing volumes keep their size. Set e.g. 250Gi to resize. storageClass: "" # Uses cluster default accessModes: - ReadWriteOnce diff --git a/charts/sourcebot/README.md b/charts/sourcebot/README.md index 02e25d4..0c02c4b 100644 --- a/charts/sourcebot/README.md +++ b/charts/sourcebot/README.md @@ -104,7 +104,7 @@ Sourcebot is a self-hosted tool that helps you understand your codebase. | sourcebot.persistence.annotations | object | `{}` | Annotations for the PersistentVolumeClaim | | sourcebot.persistence.enabled | bool | `true` | Enable persistent storage for repository data and search indexes | | sourcebot.persistence.existingClaim | string | `""` | Use an existing PersistentVolumeClaim (if set, other persistence settings are ignored) | -| sourcebot.persistence.size | string | `"10Gi"` | Size of the persistent volume | +| sourcebot.persistence.size | string | `""` (100Gi for new installs) | Size of the persistent volume. When unset, new installs get 100Gi and existing volumes keep their current size on upgrade. See the sizing guide: https://docs.sourcebot.dev/docs/deployment/sizing-guide | | sourcebot.persistence.storageClass | string | `""` | Storage class name. If not set, uses the cluster default storage class | | sourcebot.podAnnotations | object | `{}` | Add annotations to the pod metadata | | sourcebot.podDisruptionBudget.enabled | bool | `true` | Enable Pod Disruption Budget | diff --git a/charts/sourcebot/templates/pvc.yaml b/charts/sourcebot/templates/pvc.yaml index 504e0cc..dbd75ac 100644 --- a/charts/sourcebot/templates/pvc.yaml +++ b/charts/sourcebot/templates/pvc.yaml @@ -1,6 +1,16 @@ {{- if and .Values.sourcebot.persistence.enabled (not .Values.sourcebot.persistence.existingClaim) }} {{- $pvcName := printf "%s-%s" (include "sourcebot.fullname" .) "data" -}} {{- $existingPvc := (lookup "v1" "PersistentVolumeClaim" $.Release.Namespace $pvcName) -}} +{{- /* +An explicit `sourcebot.persistence.size` always wins. When it is unset, an +existing PVC keeps its current size, so changing the chart default never +resizes a live volume on upgrade (which fails on storage classes without +`allowVolumeExpansion`). New installs get the chart default. +*/ -}} +{{- $size := .Values.sourcebot.persistence.size -}} +{{- if not $size -}} +{{- $size = dig "spec" "resources" "requests" "storage" "100Gi" $existingPvc -}} +{{- end }} --- apiVersion: v1 kind: PersistentVolumeClaim @@ -21,7 +31,7 @@ spec: {{- end }} resources: requests: - storage: {{ .Values.sourcebot.persistence.size }} + storage: {{ $size }} {{- if .Values.sourcebot.persistence.storageClass }} {{- if (eq "-" .Values.sourcebot.persistence.storageClass) }} storageClassName: "" diff --git a/charts/sourcebot/tests/pvc_test.yaml b/charts/sourcebot/tests/pvc_test.yaml new file mode 100644 index 0000000..a6d1d4e --- /dev/null +++ b/charts/sourcebot/tests/pvc_test.yaml @@ -0,0 +1,107 @@ +suite: test sourcebot data PVC sizing +templates: + - pvc.yaml +release: + name: sourcebot + namespace: sourcebot +values: + - ../values.lint.yaml +tests: + - it: should default new installs to 100Gi + asserts: + - equal: + path: spec.resources.requests.storage + value: 100Gi + - notExists: + path: spec.volumeName + + - it: should use an explicitly set size on a new install + set: + sourcebot.persistence.size: 25Gi + asserts: + - equal: + path: spec.resources.requests.storage + value: 25Gi + + - it: should keep an existing PVC's size when size is unset + kubernetesProvider: + scheme: + "v1/PersistentVolumeClaim": + gvr: + version: "v1" + resource: "persistentvolumeclaims" + namespaced: true + objects: + - kind: PersistentVolumeClaim + apiVersion: v1 + metadata: + name: sourcebot-data + namespace: sourcebot + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + volumeName: pvc-1234 + asserts: + - equal: + path: spec.resources.requests.storage + value: 10Gi + - equal: + path: spec.volumeName + value: pvc-1234 + + - it: should apply an explicitly set size to an existing PVC + set: + sourcebot.persistence.size: 50Gi + kubernetesProvider: + scheme: + "v1/PersistentVolumeClaim": + gvr: + version: "v1" + resource: "persistentvolumeclaims" + namespaced: true + objects: + - kind: PersistentVolumeClaim + apiVersion: v1 + metadata: + name: sourcebot-data + namespace: sourcebot + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + volumeName: pvc-1234 + asserts: + - equal: + path: spec.resources.requests.storage + value: 50Gi + - equal: + path: spec.volumeName + value: pvc-1234 + + - it: should ignore a PVC with the same name in another namespace + kubernetesProvider: + scheme: + "v1/PersistentVolumeClaim": + gvr: + version: "v1" + resource: "persistentvolumeclaims" + namespaced: true + objects: + - kind: PersistentVolumeClaim + apiVersion: v1 + metadata: + name: sourcebot-data + namespace: other + spec: + resources: + requests: + storage: 10Gi + asserts: + - equal: + path: spec.resources.requests.storage + value: 100Gi diff --git a/charts/sourcebot/values.yaml b/charts/sourcebot/values.yaml index 45076c3..ae0a5d7 100644 --- a/charts/sourcebot/values.yaml +++ b/charts/sourcebot/values.yaml @@ -319,8 +319,10 @@ sourcebot: enabled: true # -- Use an existing PersistentVolumeClaim (if set, other persistence settings are ignored) existingClaim: "" - # -- Size of the persistent volume - size: 10Gi + # -- Size of the persistent volume. When unset, new installs get 100Gi and existing volumes keep their current size on upgrade. + # See the sizing guide: https://docs.sourcebot.dev/docs/deployment/sizing-guide + # @default -- `""` (100Gi for new installs) + size: "" # -- Storage class name. If not set, uses the cluster default storage class storageClass: "" # -- Access modes for the persistent volume