diff --git a/ceph-client/Chart.yaml b/ceph-client/Chart.yaml index 3c52f2eba..63ba09339 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.8 +version: 0.1.9 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 96da35b70..0906c8159 100755 --- a/ceph-client/templates/bin/_helm-tests.sh.tpl +++ b/ceph-client/templates/bin/_helm-tests.sh.tpl @@ -181,7 +181,13 @@ 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 1c7090c69..0c3c66d6b 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -146,11 +146,13 @@ function reweight_osds () { done } -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 +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 fi - ceph config set global osd_pool_default_pg_autoscale_mode on } function set_cluster_flags () { @@ -182,8 +184,10 @@ 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 ]] ; then + if [[ $(ceph osd versions | awk '/version/{print $3}' | cut -d. -f1) -ge 14 ]] && [[ "${ENABLE_AUTOSCALER}" == "true" ]] ; 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. @@ -265,8 +269,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) -ge 14 ]]; then - enable_autoscaling +if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -eq 14 ]]; then + enable_or_disable_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 f8fa8e5c3..351ef761d 100644 --- a/ceph-client/templates/job-rbd-pool.yaml +++ b/ceph-client/templates/job-rbd-pool.yaml @@ -50,6 +50,8 @@ 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 51fa318b6..f9117d8e9 100644 --- a/ceph-client/templates/pod-helm-tests.yaml +++ b/ceph-client/templates/pod-helm-tests.yaml @@ -50,6 +50,8 @@ 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 b9a797adb..30b522e87 100644 --- a/releasenotes/notes/ceph-client.yaml +++ b/releasenotes/notes/ceph-client.yaml @@ -8,5 +8,4 @@ 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 ...