From de2227f6e79fc968c8d4bf258e3165ff0a805b84 Mon Sep 17 00:00:00 2001 From: Stephen Taylor Date: Thu, 14 Jul 2022 07:55:47 -0600 Subject: [PATCH] [ceph-client] Add the ability to run Ceph commands from values The major reason for the addition of this feature is to facilitate an upgrade to the Pacific Ceph release, which now requires the require-osd-release flag to be set to the proper release in order to avoid a cluster warning scenario. Any Ceph command can be run against the cluster using this feature, however. Change-Id: I194264c420cfda8453c139ca2b737e56c63ef269 --- ceph-client/Chart.yaml | 2 +- ceph-client/templates/bin/pool/_init.sh.tpl | 11 +++++++++-- ceph-client/values.yaml | 4 ++++ releasenotes/notes/ceph-client.yaml | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ceph-client/Chart.yaml b/ceph-client/Chart.yaml index da94f94904..a26082f35b 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.35 +version: 0.1.36 home: https://github.com/ceph/ceph-client ... diff --git a/ceph-client/templates/bin/pool/_init.sh.tpl b/ceph-client/templates/bin/pool/_init.sh.tpl index 0d86251a85..c224cd649d 100644 --- a/ceph-client/templates/bin/pool/_init.sh.tpl +++ b/ceph-client/templates/bin/pool/_init.sh.tpl @@ -175,7 +175,7 @@ function disable_autoscaling () { } function set_cluster_flags () { - if [[ ! -z "${CLUSTER_SET_FLAGS}" ]]; then + if [[ -n "${CLUSTER_SET_FLAGS}" ]]; then for flag in ${CLUSTER_SET_FLAGS}; do ceph osd set ${flag} done @@ -183,13 +183,19 @@ function set_cluster_flags () { } function unset_cluster_flags () { - if [[ ! -z "${CLUSTER_UNSET_FLAGS}" ]]; then + if [[ -n "${CLUSTER_UNSET_FLAGS}" ]]; then for flag in ${CLUSTER_UNSET_FLAGS}; do ceph osd unset ${flag} done fi } +function run_cluster_commands () { + {{- range .Values.conf.features.cluster_commands }} + ceph --cluster "${CLUSTER}" {{ . }} + {{- end }} +} + # Helper function to set pool properties only if the target value differs from # the current value to optimize performance function set_pool_property() { @@ -328,6 +334,7 @@ function convert_to_bytes() { set_cluster_flags unset_cluster_flags +run_cluster_commands reweight_osds {{ $targetOSDCount := .Values.conf.pool.target.osd }} diff --git a/ceph-client/values.yaml b/ceph-client/values.yaml index 4ef64a5f37..4ad5cf71a0 100644 --- a/ceph-client/values.yaml +++ b/ceph-client/values.yaml @@ -229,6 +229,10 @@ conf: # List of flags to set or unset separated by spaces set: "" unset: "" + cluster_commands: + # Add additional commands to run against the Ceph cluster here + - osd require-osd-release octopus + - status pool: # NOTE(portdirect): this drives a simple approximation of # https://ceph.com/pgcalc/, the `target.osd` key should be set to match the diff --git a/releasenotes/notes/ceph-client.yaml b/releasenotes/notes/ceph-client.yaml index ad2e7c617f..14cea71440 100644 --- a/releasenotes/notes/ceph-client.yaml +++ b/releasenotes/notes/ceph-client.yaml @@ -36,4 +36,5 @@ ceph-client: - 0.1.33 More robust naming of clusterrole-checkdns - 0.1.34 Migrated CronJob resource to batch/v1 API version - 0.1.35 Handle multiple mon versions in the pool job + - 0.1.36 Add the ability to run Ceph commands from values ...