Fix allignment issue in shellscript

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-01-20 16:58:30 +05:30 committed by Humble Devassy Chirammal
parent 50a84fb930
commit 520ceb6dcb
3 changed files with 40 additions and 39 deletions

View File

@ -61,8 +61,9 @@ build_push_images() {
# build and push per arch images # build and push per arch images
for ARCH in amd64 arm64; do for ARCH in amd64 arm64; do
ifs=$IFS; IFS= ifs=$IFS
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<< "${manifests}") IFS=
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
IFS=$ifs IFS=$ifs
sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}" sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}"
GOARCH=${ARCH} make push-image-cephcsi GOARCH=${ARCH} make push-image-cephcsi

View File

@ -102,12 +102,12 @@ ssh)
;; ;;
deploy-rook) deploy-rook)
echo "deploy rook" echo "deploy rook"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
"$DIR"/rook.sh deploy "$DIR"/rook.sh deploy
;; ;;
teardown-rook) teardown-rook)
echo "teardown rook" echo "teardown rook"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
"$DIR"/rook.sh teardown "$DIR"/rook.sh teardown
# delete rook data for minikube # delete rook data for minikube

View File

@ -13,17 +13,17 @@ function deploy_rook() {
kubectl create -f "${ROOK_URL}/pool-test.yaml" kubectl create -f "${ROOK_URL}/pool-test.yaml"
# Check if CephCluster is empty # Check if CephCluster is empty
if ! kubectl -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &> /dev/null; then if ! kubectl -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &>/dev/null; then
check_ceph_cluster_health check_ceph_cluster_health
fi fi
# Check if CephFileSystem is empty # Check if CephFileSystem is empty
if ! kubectl -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &> /dev/null; then if ! kubectl -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &>/dev/null; then
check_mds_stat check_mds_stat
fi fi
# Check if CephBlockPool is empty # Check if CephBlockPool is empty
if ! kubectl -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &> /dev/null; then if ! kubectl -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &>/dev/null; then
check_rbd_stat check_rbd_stat
fi fi
} }
@ -37,8 +37,8 @@ function teardown_rook() {
kubectl delete -f "${ROOK_URL}/common.yaml" kubectl delete -f "${ROOK_URL}/common.yaml"
} }
function check_ceph_cluster_health(){ function check_ceph_cluster_health() {
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
echo "Wait for rook deploy... ${retry}s" && sleep 5 echo "Wait for rook deploy... ${retry}s" && sleep 5
CEPH_STATE=$(kubectl -n rook-ceph get cephclusters -o jsonpath='{.items[0].status.state}') CEPH_STATE=$(kubectl -n rook-ceph get cephclusters -o jsonpath='{.items[0].status.state}')
@ -47,15 +47,15 @@ function check_ceph_cluster_health(){
if [ "$CEPH_STATE" = "Created" ]; then if [ "$CEPH_STATE" = "Created" ]; then
if [ "$CEPH_HEALTH" = "HEALTH_OK" ]; then if [ "$CEPH_HEALTH" = "HEALTH_OK" ]; then
echo "Creating CEPH cluster is done. [$CEPH_HEALTH]" echo "Creating CEPH cluster is done. [$CEPH_HEALTH]"
break; break
fi fi
fi fi
done done
echo "" echo ""
} }
function check_mds_stat(){ function check_mds_stat() {
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
FS_NAME=$(kubectl -n rook-ceph get cephfilesystems.ceph.rook.io -ojsonpath='{.items[0].metadata.name}') FS_NAME=$(kubectl -n rook-ceph get cephfilesystems.ceph.rook.io -ojsonpath='{.items[0].metadata.name}')
echo "Checking MDS ($FS_NAME) stats... ${retry}s" && sleep 5 echo "Checking MDS ($FS_NAME) stats... ${retry}s" && sleep 5
@ -63,20 +63,20 @@ function check_mds_stat(){
ACTIVE_COUNT_NUM=$((ACTIVE_COUNT + 0)) ACTIVE_COUNT_NUM=$((ACTIVE_COUNT + 0))
echo "MDS ($FS_NAME) active_count: [$ACTIVE_COUNT_NUM]" echo "MDS ($FS_NAME) active_count: [$ACTIVE_COUNT_NUM]"
if (( ACTIVE_COUNT_NUM < 1 )); then if ((ACTIVE_COUNT_NUM < 1)); then
continue; continue
else else
if kubectl -n rook-ceph get pod -l rook_file_system=myfs | grep Running &> /dev/null; then if kubectl -n rook-ceph get pod -l rook_file_system=myfs | grep Running &>/dev/null; then
echo "Filesystem ($FS_NAME) is successfully created..." echo "Filesystem ($FS_NAME) is successfully created..."
break; break
fi fi
fi fi
done done
echo "" echo ""
} }
function check_rbd_stat(){ function check_rbd_stat() {
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
RBD_POOL_NAME=$(kubectl -n rook-ceph get cephblockpools -ojsonpath='{.items[0].metadata.name}') RBD_POOL_NAME=$(kubectl -n rook-ceph get cephblockpools -ojsonpath='{.items[0].metadata.name}')
echo "Checking RBD ($RBD_POOL_NAME) stats... ${retry}s" && sleep 5 echo "Checking RBD ($RBD_POOL_NAME) stats... ${retry}s" && sleep 5
@ -85,7 +85,7 @@ function check_rbd_stat(){
echo "Toolbox POD ($TOOLBOX_POD) status: [$TOOLBOX_POD_STATUS]" echo "Toolbox POD ($TOOLBOX_POD) status: [$TOOLBOX_POD_STATUS]"
[[ "$TOOLBOX_POD_STATUS" != "Running" ]] && continue [[ "$TOOLBOX_POD_STATUS" != "Running" ]] && continue
if kubectl exec -n rook-ceph "$TOOLBOX_POD" -it -- rbd pool stats "$RBD_POOL_NAME" &> /dev/null; then if kubectl exec -n rook-ceph "$TOOLBOX_POD" -it -- rbd pool stats "$RBD_POOL_NAME" &>/dev/null; then
echo "RBD ($RBD_POOL_NAME) is successfully created..." echo "RBD ($RBD_POOL_NAME) is successfully created..."
break break
fi fi