You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by ji...@apache.org on 2024/09/13 03:35:10 UTC
(amoro) branch master updated: Fix the issue where database-secret and admin-secret overwrite each other. (#3184)
This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 590455487 Fix the issue where database-secret and admin-secret overwrite each other. (#3184)
590455487 is described below
commit 590455487297012b67144d330771ecdc2bc9cea0
Author: Darcy <li...@lilith.com>
AuthorDate: Fri Sep 13 11:35:07 2024 +0800
Fix the issue where database-secret and admin-secret overwrite each other. (#3184)
* Fix the issue where database-secret and admin-secret overwrite each other.
* Improve the test cases.
---
charts/amoro/templates/amoro-admin-secret.yaml | 28 -----------
...moro-database-secret.yaml => amoro-secret.yaml} | 11 +++--
...ase-secret_test.yaml => amoro-secret_test.yaml} | 54 +++++++---------------
3 files changed, 24 insertions(+), 69 deletions(-)
diff --git a/charts/amoro/templates/amoro-admin-secret.yaml b/charts/amoro/templates/amoro-admin-secret.yaml
deleted file mode 100644
index 5e83e005c..000000000
--- a/charts/amoro/templates/amoro-admin-secret.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-{{/*
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/}}
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: {{ include "common.names.fullname" . }}
- labels:
- {{- include "amoro.labels" . | nindent 4 }}
-type: Opaque
-data:
- # use helm set dashboard username and password
- AdminUsername: {{ .Values.amoroConf.ams.adminUsername | b64enc | quote }}
- AdminPassword: {{ .Values.amoroConf.ams.adminPassword | b64enc | quote }}
\ No newline at end of file
diff --git a/charts/amoro/templates/amoro-database-secret.yaml b/charts/amoro/templates/amoro-secret.yaml
similarity index 82%
rename from charts/amoro/templates/amoro-database-secret.yaml
rename to charts/amoro/templates/amoro-secret.yaml
index 9d1065b4e..3beff332b 100644
--- a/charts/amoro/templates/amoro-database-secret.yaml
+++ b/charts/amoro/templates/amoro-secret.yaml
@@ -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:
@@ -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 }}
\ No newline at end of file
+ {{- end }}
diff --git a/charts/amoro/tests/amoro-database-secret_test.yaml b/charts/amoro/tests/amoro-secret_test.yaml
similarity index 58%
rename from charts/amoro/tests/amoro-database-secret_test.yaml
rename to charts/amoro/tests/amoro-secret_test.yaml
index 186e30c1f..844162660 100644
--- a/charts/amoro/tests/amoro-database-secret_test.yaml
+++ b/charts/amoro/tests/amoro-secret_test.yaml
@@ -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
@@ -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
\ No newline at end of file
+ decodeBase64: true