Skip to content

Commit

Permalink
Fix the issue where database-secret and admin-secret overwrite each o…
Browse files Browse the repository at this point in the history
…ther. (#3184)

* Fix the issue where database-secret and admin-secret overwrite each other.

* Improve the test cases.
  • Loading branch information
lintingbin authored Sep 13, 2024
1 parent f541d6f commit 5904554
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 69 deletions.
28 changes: 0 additions & 28 deletions charts/amoro/templates/amoro-admin-secret.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
limitations under the License.
*/}}

{{- if or (eq .Values.amoroConf.database.type "mysql") (eq .Values.amoroConf.database.type "postgres") }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -24,8 +23,12 @@ metadata:
{{- include "amoro.labels" . | nindent 4 }}
type: Opaque
data:
# use helm set username
# use helm set dashboard username and password
AdminUsername: {{ .Values.amoroConf.ams.adminUsername | b64enc | quote }}
AdminPassword: {{ .Values.amoroConf.ams.adminPassword | b64enc | quote }}

{{- if or (eq .Values.amoroConf.database.type "mysql") (eq .Values.amoroConf.database.type "postgres") }}
# use helm set database username and password
DatabaseUsername: {{ .Values.amoroConf.database.username | b64enc | quote }}
# use helm set password
DatabasePassword: {{ .Values.amoroConf.database.password | b64enc | quote }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# limitations under the License.


suite: Test Amoro Database Secret
suite: Test Amoro Secret
templates:
- amoro-database-secret.yaml
- amoro-secret.yaml
chart:
appVersion: 0.1.0
version: 0.6.0
Expand All @@ -28,59 +28,39 @@ tests:
database:
type: derby
asserts:
- hasDocuments:
count: 0
- it: Amoro database secret should exist if database type is set to mysql
- notExists:
path: data.DatabaseUsername
- notExists:
path: data.DatabasePassword
- it: Amoro database secret should reflect username and password if database type is set to mysql
set:
fullnameOverride: test
amoroConf:
database:
type: mysql
username: "abc"
password: "123"
asserts:
- containsDocument:
kind: Secret
apiVersion: v1
name: test
- hasDocuments:
count: 1
- it: Amoro database secret should exist if database type is set to postgres
- equal:
path: data.DatabaseUsername
value: "abc"
decodeBase64: true
- equal:
path: data.DatabasePassword
value: "123"
decodeBase64: true
- it: Amoro database secret should reflect username and password if database type is set to postgres
set:
fullnameOverride: test
amoroConf:
database:
type: postgres
username: "abc"
password: "123"
asserts:
- containsDocument:
kind: Secret
apiVersion: v1
name: test
- hasDocuments:
count: 1
- it: Amoro database secret should reflect username if database type is set to mysql
set:
amoroConf:
database:
type: mysql
username: "abc"
password: "123"
asserts:
- equal:
path: data.DatabaseUsername
value: "abc"
decodeBase64: true
- it: Amoro database secret should reflect password if database type is set to mysql
set:
amoroConf:
database:
type: mysql
username: "abc"
password: "123"
asserts:
- equal:
path: data.DatabasePassword
value: "123"
decodeBase64: true
decodeBase64: true

0 comments on commit 5904554

Please sign in to comment.