summaryrefslogtreecommitdiff
path: root/build/tools
diff options
context:
space:
mode:
authorlwabish <wubw@pku.edu.cn>2022-04-21 11:21:05 +0800
committerlwabish <wubw@pku.edu.cn>2022-04-26 11:15:50 +0800
commite31b352f913825330a59e72b69db89541fbfa92b (patch)
tree0b6da1c07bacfc9d7be899ebcc2f798db6acc84e /build/tools
parentMerge pull request #3780 from fisherxu/remove-gopath (diff)
downloadkubeedge-e31b352f913825330a59e72b69db89541fbfa92b.tar.gz
script: add an env CLOUDCORE_DOMAINS in certgen.sh and fix a bug
1. when CLOUDCOREIPS env contains spaces, `-z ${CLOUDCOREIPS}` could lead to error, double quote is indispensable. 2. in some cases domain names are provided when running `./certgen.sh stream` Signed-off-by: lwabish <wubw@pku.edu.cn>
Diffstat (limited to 'build/tools')
-rwxr-xr-xbuild/tools/certgen.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/build/tools/certgen.sh b/build/tools/certgen.sh
index 53962a8b5..dfc538d12 100755
--- a/build/tools/certgen.sh
+++ b/build/tools/certgen.sh
@@ -71,9 +71,10 @@ stream() {
readonly K8SCA_FILE=${K8SCA_FILE:-/etc/kubernetes/pki/ca.crt}
readonly K8SCA_KEY_FILE=${K8SCA_KEY_FILE:-/etc/kubernetes/pki/ca.key}
- if [ -z ${CLOUDCOREIPS} ]; then
- echo "You must set CLOUDCOREIPS Env,The environment variable is set to specify the IP addresses of all cloudcore"
- echo "If there are more than one IP need to be separated with space."
+ if [ -z "${CLOUDCOREIPS}" ] && [ -z "${CLOUDCORE_DOMAINS}" ]; then
+ echo "You must set at least one of CLOUDCOREIPS or CLOUDCORE_DOMAINS Env.These environment
+variables are set to specify the IP addresses or domains of all cloudcore, respectively."
+ echo "If there are more than one IP or domain, you need to separate them with a space within a single env."
exit 1
fi
@@ -85,6 +86,11 @@ stream() {
SUBJECTALTNAME="${SUBJECTALTNAME}IP.${index}:${ip}"
done
+ for domain in ${CLOUDCORE_DOMAINS};do
+ SUBJECTALTNAME="${SUBJECTALTNAME},"
+ SUBJECTALTNAME="${SUBJECTALTNAME}DNS:${domain}"
+ done
+
cp ${K8SCA_FILE} ${caPath}/streamCA.crt
echo $SUBJECTALTNAME > /tmp/server-extfile.cnf