Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ while [ -n "$1" ]; do
ENABLE="true"
shift 1
;;
-d | --enable)
-d | --disable)
ENABLE="false"
shift 1
;;
Expand All @@ -69,7 +69,11 @@ while [ -n "$1" ]; do
;;
esac
done
if [ $ENABLE == "true" ] ; then
if [ -z "$ENABLE" ]; then
echo "ERROR: one of -e/--enable or -d/--disable is required. -h or --help for help"
exit 1
fi
if [ "$ENABLE" == "true" ] ; then
if [ -e /opt/autoscaler/autoscaler_tmpl.yaml ]; then
sed -e "s/<cluster-id>/$ID/g" -e "s/<min>/$MINSIZE/g" -e "s/<max>/$MAXSIZE/g" /opt/autoscaler/autoscaler_tmpl.yaml > /opt/autoscaler/autoscaler_now.yaml
/opt/bin/kubectl apply -f /opt/autoscaler/autoscaler_now.yaml
Expand All @@ -78,16 +82,16 @@ if [ $ENABLE == "true" ] ; then
mkdir -p /opt/autoscaler
AUTOSCALER_URL="https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/cloudstack/examples/cluster-autoscaler-standard.yaml"
autoscaler_conf_file="/opt/autoscaler/autoscaler_tmpl.yaml"
curl -sSL ${AUTOSCALER_URL} -o ${autoscaler_conf_file}
if [ $? -ne 0 ]; then
trap 'rm -f "$autoscaler_conf_file.tmp.$$"' EXIT
if ! curl -fsSL "$AUTOSCALER_URL" -o "$autoscaler_conf_file.tmp.$$"; then
echo "Unable to connect to the internet to download the autoscaler deployment and image"
exit 1
else
sed -e "s/<cluster-id>/$ID/g" -e "s/<min>/$MINSIZE/g" -e "s/<max>/$MAXSIZE/g" /opt/autoscaler/autoscaler_tmpl.yaml > /opt/autoscaler/autoscaler_now.yaml
/opt/bin/kubectl apply -f /opt/autoscaler/autoscaler_now.yaml
exit 0
fi
mv -f "$autoscaler_conf_file.tmp.$$" "$autoscaler_conf_file"
sed -e "s/<cluster-id>/$ID/g" -e "s/<min>/$MINSIZE/g" -e "s/<max>/$MAXSIZE/g" /opt/autoscaler/autoscaler_tmpl.yaml > /opt/autoscaler/autoscaler_now.yaml
/opt/bin/kubectl apply -f /opt/autoscaler/autoscaler_now.yaml
exit 0
fi
else
/opt/bin/kubectl delete deployment -n kube-system cluster-autoscaler
/opt/bin/kubectl delete deployment -n kube-system cluster-autoscaler --ignore-not-found
fi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

(/opt/bin/kubectl get pods -A | grep cloudstack-csi-controller) && exit 0

if [ -e /opt/csi/snapshot-crds.yaml ]; then
if [ -e /opt/csi/snapshot-crds.yaml ] && [ -e /opt/csi/manifest.yaml ]; then
/opt/bin/kubectl apply -f /opt/csi/snapshot-crds.yaml
sleep 5
/opt/bin/kubectl apply -f /opt/csi/manifest.yaml
Expand All @@ -30,17 +30,18 @@ else
"https://github.com/cloudstack/cloudstack-csi-driver/releases/download/v3.0.0/snapshot-crds.yaml"
"https://github.com/cloudstack/cloudstack-csi-driver/releases/download/v3.0.0/manifest.yaml"
)
trap 'rm -f "$TARGET_DIR"/*.tmp.$$' EXIT
for url in "${CSI_URLS[@]}"; do
filename=$(basename "$url")

curl -sSL ${url} -o ${TARGET_DIR}/${filename}
if [ $? -ne 0 ]; then
if ! curl -fsSL "$url" -o "$TARGET_DIR/$filename.tmp.$$"; then
echo "Unable to connect to the internet to download the relevant files to install and setup CloudStack CSI driver"
exit 1
else
/opt/bin/kubectl apply -f /opt/csi/snapshot-crds.yaml
/opt/bin/kubectl apply -f /opt/csi/manifest.yaml
exit 0
fi
mv -f "$TARGET_DIR/$filename.tmp.$$" "$TARGET_DIR/$filename"
done
/opt/bin/kubectl apply -f /opt/csi/snapshot-crds.yaml
sleep 5
/opt/bin/kubectl apply -f /opt/csi/manifest.yaml
exit 0
fi
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ else
mkdir -p /opt/provider
PROVIDER_URL="https://raw.githubusercontent.com/apache/cloudstack-kubernetes-provider/main/deployment.yaml"
provider_conf_file="/opt/provider/provider.yaml"
curl -sSL ${PROVIDER_URL} -o ${provider_conf_file}
if [ $? -ne 0 ]; then
trap 'rm -f "$provider_conf_file.tmp.$$"' EXIT
if ! curl -fsSL "$PROVIDER_URL" -o "$provider_conf_file.tmp.$$"; then
echo "Unable to connect to the internet to download the provider deployment and image"
exit 1
else
/opt/bin/kubectl apply -f /opt/provider/provider.yaml
exit 0
fi
mv -f "$provider_conf_file.tmp.$$" "$provider_conf_file"
/opt/bin/kubectl apply -f /opt/provider/provider.yaml
exit 0
fi
Loading