[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
This commit is contained in:
Stephen Taylor 2022-07-14 07:55:47 -06:00
parent 772198f15d
commit de2227f6e7
4 changed files with 15 additions and 3 deletions

View File

@ -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
...

View File

@ -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 }}

View File

@ -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

View File

@ -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
...