ci: update rook.sh and ceph cluster version

Changes:
1. Add a variable in build.env for rook ceph cluster version.
2. Modify rook.sh so that it can deploy ceph cluster with
   desirable version also rather than the one which rook installs
   by default.
3. Remove the code which is no longer required:
   a. Code which was added to test snapshot feature.
   b. Code which was required because
      https://github.com/rook/rook/pull/5925 was not fixed.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
Mudit Agarwal 2021-02-08 19:21:25 +05:30 committed by mergify[bot]
parent d534ee9ce8
commit 0b29d3b247
2 changed files with 32 additions and 41 deletions

View File

@ -42,6 +42,8 @@ CHANGE_MINIKUBE_NONE_USER=true
# Rook options # Rook options
ROOK_VERSION=v1.3.9 ROOK_VERSION=v1.3.9
# Provide ceph image path
#ROOK_CEPH_CLUSTER_IMAGE=docker.io/ceph/ceph:v14.2.12
# e2e settings # e2e settings
# - enable CEPH_CSI_RUN_ALL_TESTS when running tests with if it has root # - enable CEPH_CSI_RUN_ALL_TESTS when running tests with if it has root

View File

@ -4,7 +4,6 @@ ROOK_VERSION=${ROOK_VERSION:-"v1.2.7"}
ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300} ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300}
ROOK_URL="https://raw.githubusercontent.com/rook/rook/${ROOK_VERSION}/cluster/examples/kubernetes/ceph" ROOK_URL="https://raw.githubusercontent.com/rook/rook/${ROOK_VERSION}/cluster/examples/kubernetes/ceph"
ROOK_BLOCK_POOL_NAME=${ROOK_BLOCK_POOL_NAME:-"newrbdpool"} ROOK_BLOCK_POOL_NAME=${ROOK_BLOCK_POOL_NAME:-"newrbdpool"}
ROOK_CEPH_CLUSTER_VERSION="v14.2.10"
KUBECTL_RETRY=5 KUBECTL_RETRY=5
KUBECTL_RETRY_DELAY=10 KUBECTL_RETRY_DELAY=10
@ -82,50 +81,40 @@ kubectl_retry() {
} }
function deploy_rook() { function deploy_rook() {
kubectl_retry create -f "${ROOK_URL}/common.yaml" kubectl_retry create -f "${ROOK_URL}/common.yaml"
kubectl_retry create -f "${ROOK_URL}/operator.yaml" kubectl_retry create -f "${ROOK_URL}/operator.yaml"
# find out the rook version to decide on the ceph cluster image to be used # Override the ceph version which rook installs by default.
ROOK_MAJOR=$(rook_version 1) if [ -z "${ROOK_CEPH_CLUSTER_IMAGE}" ]
ROOK_MINOR=$(rook_version 2) then
if { [ "${ROOK_MAJOR}" -eq 1 ] && [ "${ROOK_MINOR}" -le 2 ]; }; then kubectl_retry create -f "${ROOK_URL}/cluster-test.yaml"
ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH="image: ceph/ceph:${ROOK_CEPH_CLUSTER_VERSION}" else
# upgrade ceph cluster version to 14.2.10 to support CephFS snapshot functionalities. ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH="image: ${ROOK_CEPH_CLUSTER_IMAGE}"
TEMP_DIR="$(mktemp -d)" TEMP_DIR="$(mktemp -d)"
curl -o "${TEMP_DIR}"/cluster-test.yaml "${ROOK_URL}/cluster-test.yaml" curl -o "${TEMP_DIR}"/cluster-test.yaml "${ROOK_URL}/cluster-test.yaml"
sed -i "s|image.*|${ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH}|g" "${TEMP_DIR}"/cluster-test.yaml sed -i "s|image.*|${ROOK_CEPH_CLUSTER_VERSION_IMAGE_PATH}|g" "${TEMP_DIR}"/cluster-test.yaml
cat "${TEMP_DIR}"/cluster-test.yaml cat "${TEMP_DIR}"/cluster-test.yaml
kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml" kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml"
rm -rf "${TEMP_DIR}" rm -rf "${TEMP_DIR}"
else fi
# add "mon_warn_on_pool_no_redundancy = false" to ceph.conf if missing
# see https://github.com/rook/rook/pull/5925 for upstream status
TEMP_DIR="$(mktemp -d)"
curl -o "${TEMP_DIR}"/cluster-test.yaml "${ROOK_URL}/cluster-test.yaml"
if ! grep -q mon_warn_on_pool_no_redundancy "${TEMP_DIR}"/cluster-test.yaml; then
sed -i '/osd_pool_default_size =/a \ mon_warn_on_pool_no_redundancy = false' "${TEMP_DIR}"/cluster-test.yaml
fi
kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml"
rm -rf "${TEMP_DIR}"
fi
kubectl_retry create -f "${ROOK_URL}/toolbox.yaml" kubectl_retry create -f "${ROOK_URL}/toolbox.yaml"
kubectl_retry create -f "${ROOK_URL}/filesystem-test.yaml" kubectl_retry create -f "${ROOK_URL}/filesystem-test.yaml"
kubectl_retry create -f "${ROOK_URL}/pool-test.yaml" kubectl_retry create -f "${ROOK_URL}/pool-test.yaml"
# Check if CephCluster is empty # Check if CephCluster is empty
if ! kubectl_retry -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &>/dev/null; then if ! kubectl_retry -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_retry -n rook-ceph get cephfilesystems -oyaml | grep 'items: \[\]' &>/dev/null; then if ! kubectl_retry -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_retry -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &>/dev/null; then if ! kubectl_retry -n rook-ceph get cephblockpools -oyaml | grep 'items: \[\]' &>/dev/null; then
check_rbd_stat "" check_rbd_stat ""
fi fi
} }
function teardown_rook() { function teardown_rook() {