From 766f14fc58c43bc761ea6391f66dc5904252c086 Mon Sep 17 00:00:00 2001 From: CH3CHO Date: Thu, 21 Dec 2023 19:33:00 +0800 Subject: [PATCH] Revert "fix: Remove the higress console secret initialization and precheck logic (#47)" This reverts commit 88e22103484a9ea7cd2227099c36afc83db56bfd. --- compose/scripts/init.sh | 14 ++++++++++++++ compose/scripts/precheck.sh | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/compose/scripts/init.sh b/compose/scripts/init.sh index adc391f..cee6ff7 100755 --- a/compose/scripts/init.sh +++ b/compose/scripts/init.sh @@ -450,6 +450,20 @@ data: mode: standalone EOF publishConfig "higress-system" "configmaps" "higress-console" "$content" + + read -r -d '' content << EOF +apiVersion: v1 +data: + iv: $(cat /dev/urandom | tr -dc '[:graph:]' | fold -w 16 | head -n 1 | tr -d '\n' | base64 -w 0) + key: $(cat /dev/urandom | tr -dc '[:graph:]' | fold -w 32 | head -n 1 | tr -d '\n' | base64 -w 0) +kind: Secret +metadata: + creationTimestamp: "$(now)" + name: higress-console + namespace: higress-system +type: Opaque +EOF + publishConfig "higress-system" "secrets" "higress-console" "$content" } initializeConfigStorage diff --git a/compose/scripts/precheck.sh b/compose/scripts/precheck.sh index bc645c9..0d80eca 100755 --- a/compose/scripts/precheck.sh +++ b/compose/scripts/precheck.sh @@ -289,6 +289,11 @@ checkConsole() { echo " The ConfigMap resource of Higress Console doesn't exist." exit -1 fi + checkConfigExists "higress-system" "secrets" "higress-console" + if [ $? -ne 0 ]; then + echo " The Secret resource of Higress Console doesn't exist." + exit -1 + fi } checkStorage