Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: add persistence related field in helm (#4658)

h3n4lfa6d1e606937
diff --git a/docs/bytebase-1.0.0.tgz b/docs/bytebase-1.0.0.tgz
index 56ee55c611..56d37d3b87 100644
Binary files a/docs/bytebase-1.0.0.tgz and b/docs/bytebase-1.0.0.tgz differ
diff --git a/docs/index.yaml b/docs/index.yaml
index 85180a0372..08559055db 100644
--- a/docs/index.yaml
+++ b/docs/index.yaml
@@ -2,9 +2,9 @@ apiVersion: v1
entries:
bytebase:
- apiVersion: v2
- created: "2022-11-04T10:24:46.708563+08:00"
+ created: "2023-02-09T14:12:53.500151+08:00"
description: Safe database schema change and version control for DevOps teams.
- digest: 9b514e826fb25120f5d5fe4cb49e54323150f4f1d4ffe55fea34f9e2ed0115dc
+ digest: c273189105a7b2ef1d7f9833b76c9008341d9689ff22622aba9809c5ac59adc2
home: https://bytebase.com/
icon: https://raw.githubusercontent.com/bytebase/bytebase.com/main/assets/logo-full.svg
maintainers:
@@ -17,20 +17,4 @@ entries:
urls:
- bytebase-1.0.0.tgz
version: 1.0.0
- - apiVersion: v2
- created: "2022-11-04T10:24:46.708273+08:00"
- description: Safe database schema change and version control for DevOps teams.
- digest: e625364c490607affda669a8145393429335ce18f0250c4c2fffe22d8997f703
- home: https://bytebase.com/
- icon: https://raw.githubusercontent.com/bytebase/bytebase.com/main/assets/logo-full.svg
- maintainers:
- name: Bytebase
- name: bytebase
- sources:
- - https://github.com/bytebase/bytebase
- type: application
- urls:
- - bytebase-0.0.1.tgz
- version: 0.0.1
-generated: "2022-11-04T10:24:46.70735+08:00"
+generated: "2023-02-09T14:12:53.49943+08:00"
diff --git a/helm-charts/bytebase/README.md b/helm-charts/bytebase/README.md
index 4611b51a13..81b512c8bc 100644
--- a/helm-charts/bytebase/README.md
+++ b/helm-charts/bytebase/README.md
@@ -28,6 +28,9 @@ $ helm -n <YOUR_NAMESPACE> \
--set "bytebase.option.external-url"={EXTERNAL_URL} \
--set "bytebase.option.pg"={PGDSN} \
--set "bytebase.version"={VERSION} \
+--set "bytebase.persistence.enabled"={TRUE/FALSE} \
+--set "bytebase.persistence.storage"={STORAGE_SIZE} \
+--set "bytebase.persistence.storageClass"={STORAGE_CLASS} \
install <RELEASE_NAME> bytebase-repo/bytebase
```
@@ -38,7 +41,10 @@ $ helm -n bytebase \
--set "bytebase.option.port"=443 \
--set "bytebase.option.external-url"="https://bytebase.com" \
--set "bytebase.option.pg"="postgresql://bytebase:[email protected]/bytebase" \
---set "bytebase.version"=1.7.0 \
+--set "bytebase.version"=1.12.0 \
+--set "bytebase.persistence.enabled"="true" \
+--set "bytebase.persistence.storage"="10Gi" \
+--set "bytebase.persistence.storageClass"="csi-disk" \
install bytebase-release bytebase-repo/bytebase
```
@@ -58,9 +64,26 @@ helm -n <YOUR_NAMESPACE> \
--set "bytebase.option.external-url"={NEW_EXTERNAL_URL} \
--set "bytebase.option.pg"={NEW_PGDSN} \
--set "bytebase.version"={NEW_VERSION} \
+--set "bytebase.persistence.enabled"={TRUE/FALSE} \
+--set "bytebase.persistence.storage"={STORAGE_SIZE} \
+--set "bytebase.persistence.storageClass"={STORAGE_CLASS} \
upgrade bytebase-release bytebase-repo/bytebase
```
+## Parameters
+| Parameter | Description | Default Value |
+| :-------: | :---------: | :-----------: |
+| bytebase.option.port | Port where Bytebase server runs. | 8080 |
+| bytebase.option.external-url | The external URL where user visits Bytebase, must start with http:// or https://. | "https://www.bytebase.com/docs/get-started/install/external-url"
+| bytebase.option.pg | External PostgreSQL instance connection url(must provide dbname). | "postgresql://bytebase:[email protected]/bytebase" |
+| bytebase.version | The Bytebase version. | "1.12.0" |
+| bytebase.persistence.enabled | Persist bytebase data switch. | false |
+| bytebase.persistence.storageClass | The storage class used by Bytebase PVC. | "" |
+| bytebase.persistence.storage | The storage size of Bytebase PVC used. | "2Gi" |
+| bytebase.persistence.existingClaim | The existing PVC that bytebase need to use. | "" |
+
+**If you enable bytebase persistence, you should provide storageClass and storage to bytebase to request a PVC, or provide the already existed PVC by existingClaim.**
+
## Need Help?
diff --git a/helm-charts/bytebase/templates/statefulset.yaml b/helm-charts/bytebase/templates/statefulset.yaml
index b5c418e18b..6719f77cc4 100644
--- a/helm-charts/bytebase/templates/statefulset.yaml
+++ b/helm-charts/bytebase/templates/statefulset.yaml
@@ -41,9 +41,6 @@ spec:
ports:
- containerPort: {{ $port }}
name: web
- volumeMounts:
- - mountPath: {{ $data }}
- name: bytebase
readinessProbe:
httpGet:
path: /api/actuator/info
@@ -57,15 +54,53 @@ spec:
initialDelaySeconds: 300
periodSeconds: 300
timeoutSeconds: 60
+ volumeMounts:
+ - mountPath: {{ $data }}
+ {{ if .Values.bytebase.persistence.existingClaim }}
+ # If user specifies an existing PVC, use that instead of "bytebase-volume".
+ name: {{ .Values.bytebase.persistence.existingClaim | quote }}
+ {{ else }}
+ # Either user disable persistence or enable persistence but not specify an existing PVC, use "bytebase-volume" as the volume name. It means
+ # that we will request to create a PVC with the specified storage class with name "bytebase-volume".
+ name: bytebase-volume
+ {{ end }}
volumes:
- - name: data
+ {{ if .Values.bytebase.persistence.enabled }}
+ {{ if .Values.bytebase.persistence.existingClaim }}
+ # If user specifies an existing PVC, use that instead of "bytebase-volume".
+ - name: {{ .Values.bytebase.persistence.existingClaim | quote }}
+ persistentVolumeClaim:
+ claimName: {{ .Values.bytebase.persistence.existingClaim | quote }}
+ {{ else }}
+ # If user enable persistence, but not specify an existing PVC, create a PVC with the specified storage class with name "bytebase-volume".
+ - name: bytebase-volume
+ persistentVolumeClaim:
+ claimName: bytebase-volume
+ {{ end }}
+ {{ else }}
+ # If user disable persistence, use an emptyDir volume.
+ - name: bytebase-volume
emptyDir: {}
- volumeClaimTemplates:
- - metadata:
- name: bytebase
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: "{{ .Values.bytebase.storage }}"
+ {{ end }}
+
+---
+{{ if .Values.bytebase.persistence.enabled }}
+{{ if not .Values.bytebase.persistence.existingClaim }}
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: bytebase-volume
+ namespace: {{ template "bytebase.namespace" . }}
+ labels:
+ app.kubernetes.io/managed-by: helm
+ app: bytebase
+spec:
+ storageClassName: {{ .Values.bytebase.persistence.storageClass | quote }}
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: {{ .Values.bytebase.persistence.storage }}
+{{ end }}
+{{ end }}
+
diff --git a/helm-charts/bytebase/values.yaml b/helm-charts/bytebase/values.yaml
index 89bb2071ab..568a984446 100644
--- a/helm-charts/bytebase/values.yaml
+++ b/helm-charts/bytebase/values.yaml
@@ -10,4 +10,8 @@ bytebase:
pg: postgresql://user:secret@host:port/dbname
data: /var/opt/bytebase
version: 1.7.0
- storage: 2Gi
+ persistence:
+ storage: 2Gi
+ enabled: false
+ storageClass: ""
+ existingClaim: ""