From a8b66cbb545aea3537ba186c08b3497eca322f27 Mon Sep 17 00:00:00 2001 From: "Guillaume B.B. Van Hemmen" Date: Sat, 28 Dec 2024 13:53:55 +0100 Subject: [PATCH] #0000 - Add support for custom S3 endpoint in Longhorn installer This update modifies the installation script to require a custom S3-compatible endpoint as a parameter. It ensures the endpoint is passed to both the script's environment and the Kubernetes secret used by Longhorn. This improves flexibility for setups using non-standard S3-compatible storage. --- scripts/05_install_longhorn.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/05_install_longhorn.sh b/scripts/05_install_longhorn.sh index 4265d8b..878e4ff 100755 --- a/scripts/05_install_longhorn.sh +++ b/scripts/05_install_longhorn.sh @@ -2,7 +2,6 @@ set -e -# Check if the Cloudflare API token is provided as an argument if [ -z "$1" ]; then echo "Error: Missing S3 access key ID." echo "Usage: $0 " @@ -10,7 +9,6 @@ if [ -z "$1" ]; then exit 1 fi -# Check if the Cloudflare API token is provided as an argument if [ -z "$2" ]; then echo "Error: Missing S3 secret access key ID." echo "Usage: $0 " @@ -18,8 +16,16 @@ if [ -z "$2" ]; then exit 1 fi +if [ -z "$3" ]; then + echo "Error: Missing S3 endpoint." + echo "Usage: $0 " + echo "You must provide your s3 compatible endpoint as a parameter to run this script." + exit 1 +fi + AWS_ACCESS_KEY_ID=$1 AWS_SECRET_ACCESS_KEY=$2 +AWS_ENDPOINTS=$3 # Add the longhorn Helm repository helm repo add longhorn https://charts.longhorn.io @@ -36,6 +42,7 @@ kubectl create secret generic longhorn-s3-secret \ --namespace longhorn-system \ --from-literal=AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ --from-literal=AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ + --from-literal=AWS_ENDPOINTS=$AWS_ENDPOINTS \ --from-literal=AWS_REGION=eu-west-1 # Install the longhorn chart