update gencerts.sh
Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
parent
f1d292984b
commit
a18f9be500
|
|
@ -17,8 +17,7 @@
|
||||||
# Generates a CA certificate, a server key, and a server certificate signed by the CA.
|
# Generates a CA certificate, a server key, and a server certificate signed by the CA.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
SCRIPT=`basename ${BASH_SOURCE[0]}`
|
SCRIPT=$(basename "${BASH_SOURCE[0]}")
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
cat<< EOF
|
cat<< EOF
|
||||||
Usage: $SCRIPT
|
Usage: $SCRIPT
|
||||||
|
|
@ -117,10 +116,10 @@ if [[ "$IN_POD" == "true" ]]; then
|
||||||
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||||
|
|
||||||
# Base64 encode secrets and then remove the trailing newline to avoid issues in the curl command
|
# Base64 encode secrets and then remove the trailing newline to avoid issues in the curl command
|
||||||
ca_cert=$(cat ${TMP_DIR}/ca-cert.pem | base64 | tr -d '\n')
|
ca_cert=$(cmd file | ${TMP_DIR}/ca-cert.pem | base64 | tr -d '\n')
|
||||||
ca_key=$(cat ${TMP_DIR}/ca-key.pem | base64 | tr -d '\n')
|
ca_key=$(cmd file | ${TMP_DIR}/ca-key.pem | base64 | tr -d '\n')
|
||||||
server_cert=$(cat ${TMP_DIR}/server-cert.pem | base64 | tr -d '\n')
|
server_cert=$(cmd file | ${TMP_DIR}/server-cert.pem | base64 | tr -d '\n')
|
||||||
server_key=$(cat ${TMP_DIR}/server-key.pem | base64 | tr -d '\n')
|
server_key=$(cmd file | ${TMP_DIR}/server-key.pem | base64 | tr -d '\n')
|
||||||
|
|
||||||
# Create the secret resource
|
# Create the secret resource
|
||||||
echo "Creating a secret for the certificate and keys"
|
echo "Creating a secret for the certificate and keys"
|
||||||
|
|
@ -166,5 +165,5 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up after we're done.
|
# Clean up after we're done.
|
||||||
printf "\nDeleting ${TMP_DIR}.\n"
|
printf "\nDeleting %s.\n" "${TMP_DIR}"
|
||||||
rm -rf ${TMP_DIR}
|
rm -rf ${TMP_DIR}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue