From 48c4d8c90037022601579391d13e4b6e1d9959ec Mon Sep 17 00:00:00 2001
From: "Huang, Sophie (sh879n)" <sh879n@att.com>
Date: Tue, 11 Aug 2020 21:26:15 +0000
Subject: [PATCH] Add TLS handling to mariadb backup and restore

Added certification handling to restore_mariadb script.

Change-Id: Iff3a15c0b4e84857cafd5b70c6cbea5363734751
---
 mariadb/templates/bin/_restore_mariadb.sh.tpl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mariadb/templates/bin/_restore_mariadb.sh.tpl b/mariadb/templates/bin/_restore_mariadb.sh.tpl
index 6ee92e406..b8840e7b3 100755
--- a/mariadb/templates/bin/_restore_mariadb.sh.tpl
+++ b/mariadb/templates/bin/_restore_mariadb.sh.tpl
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+{{- $envAll := . }}
+
 # Capture the user's command line arguments
 ARGS=("$@")
 
@@ -44,6 +46,12 @@ RESTORE_CMD="mysql \
              --user=${RESTORE_USER} \
              --password=${RESTORE_PW} \
              --host=$MARIADB_SERVER_SERVICE_HOST \
+{{- if .Values.manifests.certificates }}
+             --ssl-verify-server-cert=false \
+             --ssl-ca=/etc/mysql/certs/ca.crt \
+             --ssl-key=/etc/mysql/certs/tls.key \
+             --ssl-cert=/etc/mysql/certs/tls.crt \
+{{- end }}
              --connect-timeout 10"
 
 # Get a single database data from the SQL file.