mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
deploy: re-alignment of code in rook.sh
currently, rook.sh code is not aligned properly unside the functions, this commit does the code alignment. PS: this is done by vscode for me :) Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
901a1368ab
commit
c32bf71846
@ -34,56 +34,55 @@ rook_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deploy_rook() {
|
function deploy_rook() {
|
||||||
kubectl_retry create -f "${ROOK_URL}/common.yaml"
|
kubectl_retry create -f "${ROOK_URL}/common.yaml"
|
||||||
|
|
||||||
# If rook version is > 1.5 , we will apply CRDs.
|
ROOK_MAJOR=$(rook_version 1)
|
||||||
ROOK_MAJOR=$(rook_version 1)
|
ROOK_MINOR=$(rook_version 2)
|
||||||
ROOK_MINOR=$(rook_version 2)
|
|
||||||
if [ "${ROOK_MAJOR}" -eq 1 ] && [ "${ROOK_MINOR}" -ge 5 ];
|
|
||||||
then
|
|
||||||
kubectl_retry create -f "${ROOK_URL}/crds.yaml"
|
|
||||||
fi
|
|
||||||
TEMP_DIR="$(mktemp -d)"
|
|
||||||
curl -o "${TEMP_DIR}/operator.yaml" "${ROOK_URL}/operator.yaml"
|
|
||||||
# disable rook deployed csi drivers
|
|
||||||
sed -i 's|ROOK_CSI_ENABLE_CEPHFS: "true"|ROOK_CSI_ENABLE_CEPHFS: "false"|g' "${TEMP_DIR}/operator.yaml"
|
|
||||||
sed -i 's|ROOK_CSI_ENABLE_RBD: "true"|ROOK_CSI_ENABLE_RBD: "false"|g' "${TEMP_DIR}/operator.yaml"
|
|
||||||
|
|
||||||
kubectl_retry create -f "${TEMP_DIR}/operator.yaml"
|
# If rook version is > 1.5 , we will apply CRDs.
|
||||||
# Override the ceph version which rook installs by default.
|
if [ "${ROOK_MAJOR}" -eq 1 ] && [ "${ROOK_MINOR}" -ge 5 ]; then
|
||||||
if [ -z "${ROOK_CEPH_CLUSTER_IMAGE}" ]
|
kubectl_retry create -f "${ROOK_URL}/crds.yaml"
|
||||||
then
|
fi
|
||||||
kubectl_retry create -f "${ROOK_URL}/cluster-test.yaml"
|
TEMP_DIR="$(mktemp -d)"
|
||||||
else
|
curl -o "${TEMP_DIR}/operator.yaml" "${ROOK_URL}/operator.yaml"
|
||||||
ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH="image: ${ROOK_CEPH_CLUSTER_IMAGE}"
|
# disable rook deployed csi drivers
|
||||||
|
sed -i 's|ROOK_CSI_ENABLE_CEPHFS: "true"|ROOK_CSI_ENABLE_CEPHFS: "false"|g' "${TEMP_DIR}/operator.yaml"
|
||||||
|
sed -i 's|ROOK_CSI_ENABLE_RBD: "true"|ROOK_CSI_ENABLE_RBD: "false"|g' "${TEMP_DIR}/operator.yaml"
|
||||||
|
|
||||||
curl -o "${TEMP_DIR}"/cluster-test.yaml "${ROOK_URL}/cluster-test.yaml"
|
kubectl_retry create -f "${TEMP_DIR}/operator.yaml"
|
||||||
sed -i "s|image.*|${ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH}|g" "${TEMP_DIR}"/cluster-test.yaml
|
# Override the ceph version which rook installs by default.
|
||||||
sed -i "s/config: |/config: |\n \[mon\]\n mon_warn_on_insecure_global_id_reclaim_allowed = false/g" "${TEMP_DIR}"/cluster-test.yaml
|
if [ -z "${ROOK_CEPH_CLUSTER_IMAGE}" ]; then
|
||||||
sed -i "s/healthCheck:/healthCheck:\n livenessProbe:\n mon:\n disabled: true\n mgr:\n disabled: true\n mds:\n disabled: true/g" "${TEMP_DIR}"/cluster-test.yaml
|
kubectl_retry create -f "${ROOK_URL}/cluster-test.yaml"
|
||||||
cat "${TEMP_DIR}"/cluster-test.yaml
|
else
|
||||||
kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml"
|
ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH="image: ${ROOK_CEPH_CLUSTER_IMAGE}"
|
||||||
fi
|
|
||||||
rm -rf "${TEMP_DIR}"
|
|
||||||
|
|
||||||
kubectl_retry create -f "${ROOK_URL}/toolbox.yaml"
|
curl -o "${TEMP_DIR}"/cluster-test.yaml "${ROOK_URL}/cluster-test.yaml"
|
||||||
kubectl_retry create -f "${ROOK_URL}/filesystem-test.yaml"
|
sed -i "s|image.*|${ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH}|g" "${TEMP_DIR}"/cluster-test.yaml
|
||||||
kubectl_retry create -f "${ROOK_URL}/pool-test.yaml"
|
sed -i "s/config: |/config: |\n \[mon\]\n mon_warn_on_insecure_global_id_reclaim_allowed = false/g" "${TEMP_DIR}"/cluster-test.yaml
|
||||||
|
sed -i "s/healthCheck:/healthCheck:\n livenessProbe:\n mon:\n disabled: true\n mgr:\n disabled: true\n mds:\n disabled: true/g" "${TEMP_DIR}"/cluster-test.yaml
|
||||||
|
cat "${TEMP_DIR}"/cluster-test.yaml
|
||||||
|
kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml"
|
||||||
|
fi
|
||||||
|
rm -rf "${TEMP_DIR}"
|
||||||
|
|
||||||
# Check if CephCluster is empty
|
kubectl_retry create -f "${ROOK_URL}/toolbox.yaml"
|
||||||
if ! kubectl_retry -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &>/dev/null; then
|
kubectl_retry create -f "${ROOK_URL}/filesystem-test.yaml"
|
||||||
check_ceph_cluster_health
|
kubectl_retry create -f "${ROOK_URL}/pool-test.yaml"
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if CephFileSystem is empty
|
# Check if CephCluster is empty
|
||||||
if ! kubectl_retry -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &>/dev/null; then
|
if ! kubectl_retry -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &>/dev/null; then
|
||||||
check_mds_stat
|
check_ceph_cluster_health
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if CephBlockPool is empty
|
# Check if CephFileSystem is empty
|
||||||
if ! kubectl_retry -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &>/dev/null; then
|
if ! kubectl_retry -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &>/dev/null; then
|
||||||
check_rbd_stat ""
|
check_mds_stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if CephBlockPool is empty
|
||||||
|
if ! kubectl_retry -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &>/dev/null; then
|
||||||
|
check_rbd_stat ""
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function teardown_rook() {
|
function teardown_rook() {
|
||||||
@ -93,10 +92,9 @@ function teardown_rook() {
|
|||||||
kubectl delete -f "${ROOK_URL}/cluster-test.yaml"
|
kubectl delete -f "${ROOK_URL}/cluster-test.yaml"
|
||||||
kubectl delete -f "${ROOK_URL}/operator.yaml"
|
kubectl delete -f "${ROOK_URL}/operator.yaml"
|
||||||
ROOK_MAJOR=$(rook_version 1)
|
ROOK_MAJOR=$(rook_version 1)
|
||||||
ROOK_MINOR=$(rook_version 2)
|
ROOK_MINOR=$(rook_version 2)
|
||||||
if [ "${ROOK_MAJOR}" -eq 1 ] && [ "${ROOK_MINOR}" -ge 5 ];
|
if [ "${ROOK_MAJOR}" -eq 1 ] && [ "${ROOK_MINOR}" -ge 5 ]; then
|
||||||
then
|
kubectl delete -f "${ROOK_URL}/crds.yaml"
|
||||||
kubectl delete -f "${ROOK_URL}/crds.yaml"
|
|
||||||
fi
|
fi
|
||||||
kubectl delete -f "${ROOK_URL}/common.yaml"
|
kubectl delete -f "${ROOK_URL}/common.yaml"
|
||||||
}
|
}
|
||||||
@ -192,8 +190,11 @@ function check_rbd_stat() {
|
|||||||
|
|
||||||
TOOLBOX_POD=$(kubectl_retry -n rook-ceph get pods -l app=rook-ceph-tools -o jsonpath='{.items[0].metadata.name}')
|
TOOLBOX_POD=$(kubectl_retry -n rook-ceph get pods -l app=rook-ceph-tools -o jsonpath='{.items[0].metadata.name}')
|
||||||
TOOLBOX_POD_STATUS=$(kubectl_retry -n rook-ceph get pod "$TOOLBOX_POD" -ojsonpath='{.status.phase}')
|
TOOLBOX_POD_STATUS=$(kubectl_retry -n rook-ceph get pod "$TOOLBOX_POD" -ojsonpath='{.status.phase}')
|
||||||
[[ "$TOOLBOX_POD_STATUS" != "Running" ]] && \
|
[[ "$TOOLBOX_POD_STATUS" != "Running" ]] &&
|
||||||
{ echo "Toolbox POD ($TOOLBOX_POD) status: [$TOOLBOX_POD_STATUS]"; continue; }
|
{
|
||||||
|
echo "Toolbox POD ($TOOLBOX_POD) status: [$TOOLBOX_POD_STATUS]"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if kubectl_retry exec -n rook-ceph "$TOOLBOX_POD" -it -- rbd pool stats "$RBD_POOL_NAME" &>/dev/null; then
|
if kubectl_retry 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..."
|
||||||
|
Loading…
Reference in New Issue
Block a user