From 910ed906d0df247f826ad527211bc86382e16eaa Mon Sep 17 00:00:00 2001 From: bw6938 Date: Fri, 15 Jan 2021 20:32:41 +0000 Subject: [PATCH] [ceph-client] enhance logic to enable the autoscaler for Octopus Change-Id: I90d4d279a96cd298eba03e9c0b05a8f2a752e746 --- ceph-client/Chart.yaml | 2 +- ceph-client/templates/bin/_helm-tests.sh.tpl | 8 +------- ceph-client/templates/bin/pool/_init.sh.tpl | 18 +++++++----------- ceph-client/templates/job-rbd-pool.yaml | 2 -- ceph-client/templates/pod-helm-tests.yaml | 2 -- releasenotes/notes/ceph-client.yaml | 1 + 6 files changed, 10 insertions(+), 23 deletions(-) diff --git a/ceph-client/Chart.yaml b/ceph-client/Chart.yaml index a389f0831..3c52f2eba 100644 --- a/ceph-client/Chart.yaml +++ b/ceph-client/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph Client name: ceph-client -version: 0.1.7 +version: 0.1.8 home: https://github.com/ceph/ceph-client ... diff --git a/ceph-client/templates/bin/_helm-tests.sh.tpl b/ceph-client/templates/bin/_helm-tests.sh.tpl index 0906c8159..96da35b70 100755 --- a/ceph-client/templates/bin/_helm-tests.sh.tpl +++ b/ceph-client/templates/bin/_helm-tests.sh.tpl @@ -181,13 +181,7 @@ function pool_validation() { pg_placement_num=$(echo ${pool_obj} | jq -r .pg_placement_num) crush_rule=$(echo ${pool_obj} | jq -r .crush_rule) name=$(echo ${pool_obj} | jq -r .pool_name) - pg_autoscale_mode=$(echo ${pool_obj} | jq -r .pg_autoscale_mode) - if [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then - if [[ "${pg_autoscale_mode}" != "on" ]]; then - echo "pg autoscaler not enabled on ${name} pool" - exit 1 - fi - fi + if [[ $(ceph mon versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then if [ "x${size}" != "x${RBD}" ] || [ "x${min_size}" != "x${EXPECTED_POOLMINSIZE}" ] \ || [ "x${crush_rule}" != "x${expectedCrushRuleId}" ]; then diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index 0c3c66d6b..1c7090c69 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -146,13 +146,11 @@ function reweight_osds () { done } -function enable_or_disable_autoscaling () { - if [[ "${ENABLE_AUTOSCALER}" == "true" ]]; then - ceph mgr module enable pg_autoscaler - ceph config set global osd_pool_default_pg_autoscale_mode on - else - ceph mgr module disable pg_autoscaler +function enable_autoscaling () { + if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then + ceph mgr module enable pg_autoscaler # only required for nautilus fi + ceph config set global osd_pool_default_pg_autoscale_mode on } function set_cluster_flags () { @@ -184,10 +182,8 @@ function create_pool () { ceph --cluster "${CLUSTER}" osd pool application enable "${POOL_NAME}" "${POOL_APPLICATION}" fi - if [[ $(ceph osd versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] && [[ "${ENABLE_AUTOSCALER}" == "true" ]] ; then + if [[ $(ceph osd versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] ; then ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" pg_autoscale_mode on - else - ceph --cluster "${CLUSTER}" osd pool set "${POOL_NAME}" pg_autoscale_mode off fi # # Make sure pool is not protected after creation AND expansion so we can manipulate its settings. @@ -269,8 +265,8 @@ else cluster_capacity=$(ceph --cluster "${CLUSTER}" df | head -n3 | tail -n1 | awk '{print $1 substr($2, 1, 1)}' | numfmt --from=iec) fi -if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then - enable_or_disable_autoscaling +if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]]; then + enable_autoscaling fi {{- range $pool := .Values.conf.pool.spec -}} diff --git a/ceph-client/templates/job-rbd-pool.yaml b/ceph-client/templates/job-rbd-pool.yaml index 351ef761d..f8fa8e5c3 100644 --- a/ceph-client/templates/job-rbd-pool.yaml +++ b/ceph-client/templates/job-rbd-pool.yaml @@ -50,8 +50,6 @@ spec: env: - name: CLUSTER value: "ceph" - - name: ENABLE_AUTOSCALER - value: {{ .Values.conf.features.pg_autoscaler | quote }} - name: CLUSTER_SET_FLAGS value: {{ .Values.conf.features.cluster_flags.set | quote }} - name: CLUSTER_UNSET_FLAGS diff --git a/ceph-client/templates/pod-helm-tests.yaml b/ceph-client/templates/pod-helm-tests.yaml index f9117d8e9..51fa318b6 100644 --- a/ceph-client/templates/pod-helm-tests.yaml +++ b/ceph-client/templates/pod-helm-tests.yaml @@ -50,8 +50,6 @@ spec: value: {{ .Values.conf.pool.default.crush_rule | default "replicated_rule" | quote }} - name: MGR_COUNT value: {{ .Values.pod.replicas.mgr | default "1" | quote }} - - name: ENABLE_AUTOSCALER - value: {{ .Values.conf.features.pg_autoscaler | quote }} {{- range $pool := .Values.conf.pool.spec -}} {{- with $pool }} - name: {{ .name | upper | replace "." "_" }} diff --git a/releasenotes/notes/ceph-client.yaml b/releasenotes/notes/ceph-client.yaml index 30b522e87..b9a797adb 100644 --- a/releasenotes/notes/ceph-client.yaml +++ b/releasenotes/notes/ceph-client.yaml @@ -8,4 +8,5 @@ ceph-client: - 0.1.5 Fix Helm test check_pgs() check for inactive PGs - 0.1.6 Uplift from Nautilus to Octopus release - 0.1.7 Don't wait for premerge PGs in the rbd pool job + - 0.1.8 Enhance logic to enable the pg autoscaler ...