diff --git a/ceph-client/templates/bin/_helm-tests.sh.tpl b/ceph-client/templates/bin/_helm-tests.sh.tpl index c5cf47932..3bcf4073b 100755 --- a/ceph-client/templates/bin/_helm-tests.sh.tpl +++ b/ceph-client/templates/bin/_helm-tests.sh.tpl @@ -38,11 +38,16 @@ function check_osd_count() { num_osd=$(echo $osd_stat_output | jq .num_osds) num_in_osds=$(echo $osd_stat_output | jq .num_in_osds) num_up_osds=$(echo $osd_stat_output | jq .num_up_osds) - - if [ "x${EXPECTED_OSDS}" == "x${num_osd}" ] && [ "x${EXPECTED_OSDS}" == "x${num_in_osds}" ] && [ "x${EXPECTED_OSDS}" == "x${num_up_osds}" ]; then - echo "All OSDs (${EXPECTED_OSDS}) are in UP and IN status" + if [ $EXPECTED_OSDS == 1 ]; then + MIN_EXPECTED_OSDS=$EXPECTED_OSDS else - echo "All expected OSDs (${EXPECTED_OSDS}) are NOT in UP and IN status. Cluster shows OSD count=${num_osd}, UP=${num_up_osds}, IN=${num_in_osds}" + MIN_EXPECTED_OSDS=$(($EXPECTED_OSDS*$REQUIRED_PERCENT_OF_OSDS/100)) + fi + + if [ "${num_osd}" -ge "${MIN_EXPECTED_OSDS}" ] && [ "${num_in_osds}" -ge "${MIN_EXPECTED_OSDS}" ] && [ "${num_up_osds}" -ge "${MIN_EXPECTED_OSDS}" ]; then + echo "Required number of OSDs (${MIN_EXPECTED_OSDS}) are UP and IN status" + else + echo "Required number of OSDs (${MIN_EXPECTED_OSDS}) are NOT UP and IN status. Cluster shows OSD count=${num_osd}, UP=${num_up_osds}, IN=${num_in_osds}" exit 1 fi } diff --git a/ceph-client/templates/pod-helm-tests.yaml b/ceph-client/templates/pod-helm-tests.yaml index bded3419b..6a3af7ad9 100644 --- a/ceph-client/templates/pod-helm-tests.yaml +++ b/ceph-client/templates/pod-helm-tests.yaml @@ -45,6 +45,8 @@ spec: value: {{ .Release.Namespace }} - name: EXPECTED_OSDS value: {{ .Values.conf.pool.target.osd | quote }} + - name: REQUIRED_PERCENT_OF_OSDS + value: {{ .Values.conf.pool.target.required_percent_of_osds | ceil | quote }} - name: EXPECTED_CRUSHRULE value: {{ .Values.conf.pool.default.crush_rule | default "replicated_rule" | quote }} - name: MGR_COUNT diff --git a/ceph-client/values.yaml b/ceph-client/values.yaml index 4be8bdd2a..d5be35139 100644 --- a/ceph-client/values.yaml +++ b/ceph-client/values.yaml @@ -218,6 +218,9 @@ conf: #NOTE(portdirect): arbitrarily we set the default number of expected OSD's to 5 # to match the number of nodes in the OSH gate (used only for helm tests). osd: 5 + # This is just for helm tests to proceed the deployment if we have mentioned % of + # osds are up and running. + required_percent_of_osds: 80 pg_per_osd: 100 protected: true #NOTE(st053q): target quota should be set to the overall cluster full percentage