Skip to content

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

chore: add secret option in helm (#4841)

h3n4lfc4fbdba8335
diff --git a/docs/bytebase-1.0.1.tgz b/docs/bytebase-1.0.1.tgz
new file mode 100644
index 0000000000..a14a44d914
Binary files /dev/null and b/docs/bytebase-1.0.1.tgz differ
diff --git a/helm-charts/bytebase/Chart.yaml b/helm-charts/bytebase/Chart.yaml
index a50f40b179..4e94eff166 100644
--- a/helm-charts/bytebase/Chart.yaml
+++ b/helm-charts/bytebase/Chart.yaml
@@ -1,6 +1,6 @@
apiVersion: v2
name: bytebase
-version: 1.0.0
+version: 1.0.1
description: Safe database schema change and version control for DevOps teams.
type: application
home: https://bytebase.com/
diff --git a/helm-charts/bytebase/README.md b/helm-charts/bytebase/README.md
index 81b512c8bc..597f61f4bc 100644
--- a/helm-charts/bytebase/README.md
+++ b/helm-charts/bytebase/README.md
@@ -71,16 +71,19 @@ 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. | "" |
+
+| 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).It will be ignored if you specify `bytebase.option.existingPgURLSecret`. | "postgresql://bytebase:[email protected]/bytebase" |
+| bytebase.option.existingPgURLSecret | Existing secret with external PostgreSQL connection string. | "" |
+| bytebase.option.existingPgURLSecretKey | Existing secret key with external PostgreSQL connection(must specfied if you specify `bytebase.option.existingPgURLSecret`) string. | "" |
+| 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.**
diff --git a/helm-charts/bytebase/templates/statefulset.yaml b/helm-charts/bytebase/templates/statefulset.yaml
index 6719f77cc4..7fc237515f 100644
--- a/helm-charts/bytebase/templates/statefulset.yaml
+++ b/helm-charts/bytebase/templates/statefulset.yaml
@@ -1,4 +1,6 @@
{{- $external_url := index .Values.bytebase.option "external-url" -}}
+{{- $existingPgURLSecret := .Values.bytebase.option.existingPgURLSecret -}}
+{{- $existingPgURLSecretKey := .Values.bytebase.option.existingPgURLSecretKey -}}
{{- $port := .Values.bytebase.option.port -}}
{{- $pg := .Values.bytebase.option.pg -}}
{{- $data := .Values.bytebase.option.data -}}
@@ -25,6 +27,17 @@ spec:
containers:
- name: bytebase
image: "bytebase/bytebase:{{ $version }}"
+ env:
+ - name: PG_URL
+ {{ if $existingPgURLSecret }}
+ # If user specifies an existing secret, we should read the external pg connection string in that secret.
+ valueFrom:
+ secretKeyRef:
+ name: {{ $existingPgURLSecret }}
+ key: {{ $existingPgURLSecretKey }}
+ {{ else }}
+ value: {{ $pg }}
+ {{ end }}
imagePullPolicy: Always
args:
[
@@ -35,8 +48,6 @@ spec:
"--external-url",
# helm parser cannot handle the dash in the value, so we need to quote it, so we use $external_url instead of $external-url.
{{ $external_url | quote }},
- "--pg",
- {{ $pg | quote}},
]
ports:
- containerPort: {{ $port }}
diff --git a/helm-charts/bytebase/values.yaml b/helm-charts/bytebase/values.yaml
index 568a984446..eb988f6fc1 100644
--- a/helm-charts/bytebase/values.yaml
+++ b/helm-charts/bytebase/values.yaml
@@ -7,6 +7,8 @@ bytebase:
port: 8080
# You should set this to the URL where users visits Bytebase.
external-url: https://www.bytebase.com/docs/get-started/install/external-url
+ existingPgURLSecret: ""
+ existingPgURLSecretKey: ""
pg: postgresql://user:secret@host:port/dbname
data: /var/opt/bytebase
version: 1.7.0