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
for ARCH in amd64 arm64; do
ifs=$IFS; IFS=
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<< "${manifests}")
ifs=$IFS
IFS=
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
IFS=$ifs
sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}"
GOARCH=${ARCH} make push-image-cephcsi

View File

@ -102,12 +102,12 @@ ssh)
;;
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
;;
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
# delete rook data for minikube

View File

@ -13,17 +13,17 @@ function deploy_rook() {
kubectl create -f "${ROOK_URL}/pool-test.yaml"
# 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
fi
# 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
fi
# 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
fi
}
@ -37,8 +37,8 @@ function teardown_rook() {
kubectl delete -f "${ROOK_URL}/common.yaml"
}
function check_ceph_cluster_health(){
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
function check_ceph_cluster_health() {
for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
echo "Wait for rook deploy... ${retry}s" && sleep 5
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_HEALTH" = "HEALTH_OK" ]; then
echo "Creating CEPH cluster is done. [$CEPH_HEALTH]"
break;
break
fi
fi
done
echo ""
}
function check_mds_stat(){
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
function check_mds_stat() {
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}')
echo "Checking MDS ($FS_NAME) stats... ${retry}s" && sleep 5
@ -63,20 +63,20 @@ function check_mds_stat(){
ACTIVE_COUNT_NUM=$((ACTIVE_COUNT + 0))
echo "MDS ($FS_NAME) active_count: [$ACTIVE_COUNT_NUM]"
if (( ACTIVE_COUNT_NUM < 1 )); then
continue;
if ((ACTIVE_COUNT_NUM < 1)); then
continue
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..."
break;
break
fi
fi
done
echo ""
}
function check_rbd_stat(){
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
function check_rbd_stat() {
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}')
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]"
[[ "$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..."
break
fi