Skip to content

Commit 520ceb6

Browse files
Madhu-1humblec
authored andcommitted
Fix allignment issue in shellscript
Signed-off-by: Madhu Rajanna <[email protected]>
1 parent 50a84fb commit 520ceb6

File tree

3 files changed

+40
-39
lines changed

3 files changed

+40
-39
lines changed

deploy.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ build_push_images() {
6161

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

scripts/minikube.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ ssh)
102102
;;
103103
deploy-rook)
104104
echo "deploy rook"
105-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
106-
"$DIR"/rook.sh deploy
105+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
106+
"$DIR"/rook.sh deploy
107107
;;
108108
teardown-rook)
109109
echo "teardown rook"
110-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
111-
"$DIR"/rook.sh teardown
110+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
111+
"$DIR"/rook.sh teardown
112112

113113
# delete rook data for minikube
114114
minikube ssh "sudo rm -rf /mnt/${DISK}/var/lib/rook; sudo rm -rf /var/lib/rook"

scripts/rook.sh

+33-33
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,40 @@ ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300}
55
ROOK_URL="https://raw.githubusercontent.com/rook/rook/${ROOK_VERSION}/cluster/examples/kubernetes/ceph"
66

77
function deploy_rook() {
8-
kubectl create -f "${ROOK_URL}/common.yaml"
9-
kubectl create -f "${ROOK_URL}/operator.yaml"
10-
kubectl create -f "${ROOK_URL}/cluster-test.yaml"
11-
kubectl create -f "${ROOK_URL}/toolbox.yaml"
12-
kubectl create -f "${ROOK_URL}/filesystem-test.yaml"
13-
kubectl create -f "${ROOK_URL}/pool-test.yaml"
8+
kubectl create -f "${ROOK_URL}/common.yaml"
9+
kubectl create -f "${ROOK_URL}/operator.yaml"
10+
kubectl create -f "${ROOK_URL}/cluster-test.yaml"
11+
kubectl create -f "${ROOK_URL}/toolbox.yaml"
12+
kubectl create -f "${ROOK_URL}/filesystem-test.yaml"
13+
kubectl create -f "${ROOK_URL}/pool-test.yaml"
1414

1515
# Check if CephCluster is empty
16-
if ! kubectl -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &> /dev/null; then
16+
if ! kubectl -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &>/dev/null; then
1717
check_ceph_cluster_health
1818
fi
1919

2020
# Check if CephFileSystem is empty
21-
if ! kubectl -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &> /dev/null; then
21+
if ! kubectl -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &>/dev/null; then
2222
check_mds_stat
2323
fi
2424

2525
# Check if CephBlockPool is empty
26-
if ! kubectl -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &> /dev/null; then
26+
if ! kubectl -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &>/dev/null; then
2727
check_rbd_stat
2828
fi
2929
}
3030

3131
function teardown_rook() {
32-
kubectl delete -f "${ROOK_URL}/pool-test.yaml"
33-
kubectl delete -f "${ROOK_URL}/filesystem-test.yaml"
34-
kubectl delete -f "${ROOK_URL}/toolbox.yaml"
35-
kubectl delete -f "${ROOK_URL}/cluster-test.yaml"
36-
kubectl delete -f "${ROOK_URL}/operator.yaml"
37-
kubectl delete -f "${ROOK_URL}/common.yaml"
32+
kubectl delete -f "${ROOK_URL}/pool-test.yaml"
33+
kubectl delete -f "${ROOK_URL}/filesystem-test.yaml"
34+
kubectl delete -f "${ROOK_URL}/toolbox.yaml"
35+
kubectl delete -f "${ROOK_URL}/cluster-test.yaml"
36+
kubectl delete -f "${ROOK_URL}/operator.yaml"
37+
kubectl delete -f "${ROOK_URL}/common.yaml"
3838
}
3939

40-
function check_ceph_cluster_health(){
41-
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
40+
function check_ceph_cluster_health() {
41+
for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
4242
echo "Wait for rook deploy... ${retry}s" && sleep 5
4343

4444
CEPH_STATE=$(kubectl -n rook-ceph get cephclusters -o jsonpath='{.items[0].status.state}')
@@ -47,36 +47,36 @@ function check_ceph_cluster_health(){
4747
if [ "$CEPH_STATE" = "Created" ]; then
4848
if [ "$CEPH_HEALTH" = "HEALTH_OK" ]; then
4949
echo "Creating CEPH cluster is done. [$CEPH_HEALTH]"
50-
break;
50+
break
5151
fi
5252
fi
5353
done
5454
echo ""
5555
}
5656

57-
function check_mds_stat(){
58-
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
57+
function check_mds_stat() {
58+
for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
5959
FS_NAME=$(kubectl -n rook-ceph get cephfilesystems.ceph.rook.io -ojsonpath='{.items[0].metadata.name}')
6060
echo "Checking MDS ($FS_NAME) stats... ${retry}s" && sleep 5
6161

6262
ACTIVE_COUNT=$(kubectl -n rook-ceph get cephfilesystems myfs -ojsonpath='{.spec.metadataServer.activeCount}')
6363

6464
ACTIVE_COUNT_NUM=$((ACTIVE_COUNT + 0))
6565
echo "MDS ($FS_NAME) active_count: [$ACTIVE_COUNT_NUM]"
66-
if (( ACTIVE_COUNT_NUM < 1 )); then
67-
continue;
66+
if ((ACTIVE_COUNT_NUM < 1)); then
67+
continue
6868
else
69-
if kubectl -n rook-ceph get pod -l rook_file_system=myfs | grep Running &> /dev/null; then
69+
if kubectl -n rook-ceph get pod -l rook_file_system=myfs | grep Running &>/dev/null; then
7070
echo "Filesystem ($FS_NAME) is successfully created..."
71-
break;
71+
break
7272
fi
7373
fi
7474
done
7575
echo ""
7676
}
7777

78-
function check_rbd_stat(){
79-
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
78+
function check_rbd_stat() {
79+
for ((retry = 0; retry <= ROOK_DEPLOY_TIMEOUT; retry = retry + 5)); do
8080
RBD_POOL_NAME=$(kubectl -n rook-ceph get cephblockpools -ojsonpath='{.items[0].metadata.name}')
8181
echo "Checking RBD ($RBD_POOL_NAME) stats... ${retry}s" && sleep 5
8282

@@ -85,7 +85,7 @@ function check_rbd_stat(){
8585
echo "Toolbox POD ($TOOLBOX_POD) status: [$TOOLBOX_POD_STATUS]"
8686
[[ "$TOOLBOX_POD_STATUS" != "Running" ]] && continue
8787

88-
if kubectl exec -n rook-ceph "$TOOLBOX_POD" -it -- rbd pool stats "$RBD_POOL_NAME" &> /dev/null; then
88+
if kubectl exec -n rook-ceph "$TOOLBOX_POD" -it -- rbd pool stats "$RBD_POOL_NAME" &>/dev/null; then
8989
echo "RBD ($RBD_POOL_NAME) is successfully created..."
9090
break
9191
fi
@@ -95,16 +95,16 @@ function check_rbd_stat(){
9595

9696
case "${1:-}" in
9797
deploy)
98-
deploy_rook
99-
;;
98+
deploy_rook
99+
;;
100100
teardown)
101-
teardown_rook
102-
;;
101+
teardown_rook
102+
;;
103103
*)
104-
echo " $0 [command]
104+
echo " $0 [command]
105105
Available Commands:
106106
deploy Deploy a rook
107107
teardown Teardown a rook
108108
" >&2
109-
;;
109+
;;
110110
esac

0 commit comments

Comments
 (0)