From 9570d141dea8cebb0086d7fcf652f06b9aca9c7f Mon Sep 17 00:00:00 2001 From: "Matthew N. Heler" Date: Mon, 17 Nov 2025 06:54:07 -0600 Subject: [PATCH] manifest: merge rook-config-override ConfigMap into ceph.conf The toolbox was not respecting the rook-config-override ConfigMap, resulting in a minimal ceph.conf with only mon_host and keyring settings. This made it difficult to run diagnostic commands that require custom configuration parameters. This change mounts the rook-config-override ConfigMap in all toolbox variants and merges its contents into the generated ceph.conf. The merge happens after writing the base config with mon endpoints, and is re-applied whenever mon endpoints change. The toolbox now has consistent behavior with other Rook-managed Ceph daemons (mon, mgr, osd, mds, rgw) which already respect config overrides. Signed-off-by: Matthew N. Heler --- deploy/examples/toolbox-job.yaml | 7 +++++++ deploy/examples/toolbox-operator-image.yaml | 15 +++++++++++++++ deploy/examples/toolbox.yaml | 15 +++++++++++++++ images/ceph/toolbox.sh | 8 ++++++++ 4 files changed, 45 insertions(+) diff --git a/deploy/examples/toolbox-job.yaml b/deploy/examples/toolbox-job.yaml index a6864f596..66f3e957d 100644 --- a/deploy/examples/toolbox-job.yaml +++ b/deploy/examples/toolbox-job.yaml @@ -27,6 +27,9 @@ spec: mountPath: /etc/rook - name: ceph-admin-secret mountPath: /var/lib/rook-ceph-mon + - name: rook-config-override + mountPath: /etc/rook-config-override + readOnly: true containers: - name: script image: docker.io/rook/ceph:master @@ -57,6 +60,10 @@ spec: items: - key: data path: mon-endpoints + - name: rook-config-override + configMap: + name: rook-config-override + optional: true - name: ceph-config emptyDir: {} restartPolicy: Never diff --git a/deploy/examples/toolbox-operator-image.yaml b/deploy/examples/toolbox-operator-image.yaml index 9b7ddf13f..8d31bd82b 100644 --- a/deploy/examples/toolbox-operator-image.yaml +++ b/deploy/examples/toolbox-operator-image.yaml @@ -35,6 +35,7 @@ spec: CEPH_CONFIG="/etc/ceph/ceph.conf" MON_CONFIG="/etc/rook/mon-endpoints" KEYRING_FILE="/etc/ceph/keyring" + CONFIG_OVERRIDE="/etc/rook-config-override/config" # create a ceph config file in its default location so ceph/rados tools can be used # without specifying any arguments @@ -55,6 +56,13 @@ spec: [client.admin] keyring = ${KEYRING_FILE} EOF + + # Merge the config override if it exists and is not empty + if [ -f "${CONFIG_OVERRIDE}" ] && [ -s "${CONFIG_OVERRIDE}" ]; then + echo "$DATE merging config override from ${CONFIG_OVERRIDE}" + echo "" >> ${CEPH_CONFIG} + cat ${CONFIG_OVERRIDE} >> ${CEPH_CONFIG} + fi } # watch the endpoints config file and update if the mon endpoints ever change @@ -114,6 +122,9 @@ spec: - name: ceph-admin-secret mountPath: /var/lib/rook-ceph-mon readOnly: true + - name: rook-config-override + mountPath: /etc/rook-config-override + readOnly: true volumes: - name: ceph-admin-secret secret: @@ -128,6 +139,10 @@ spec: items: - key: data path: mon-endpoints + - name: rook-config-override + configMap: + name: rook-config-override + optional: true - name: ceph-config emptyDir: {} tolerations: diff --git a/deploy/examples/toolbox.yaml b/deploy/examples/toolbox.yaml index 5559e064a..98d9b734c 100644 --- a/deploy/examples/toolbox.yaml +++ b/deploy/examples/toolbox.yaml @@ -29,6 +29,7 @@ spec: CEPH_CONFIG="/etc/ceph/ceph.conf" MON_CONFIG="/etc/rook/mon-endpoints" KEYRING_FILE="/etc/ceph/keyring" + CONFIG_OVERRIDE="/etc/rook-config-override/config" # create a ceph config file in its default location so ceph/rados tools can be used # without specifying any arguments @@ -49,6 +50,13 @@ spec: [client.admin] keyring = ${KEYRING_FILE} EOF + + # Merge the config override if it exists and is not empty + if [ -f "${CONFIG_OVERRIDE}" ] && [ -s "${CONFIG_OVERRIDE}" ]; then + echo "$DATE merging config override from ${CONFIG_OVERRIDE}" + echo "" >> ${CEPH_CONFIG} + cat ${CONFIG_OVERRIDE} >> ${CEPH_CONFIG} + fi } # watch the endpoints config file and update if the mon endpoints ever change @@ -108,6 +116,9 @@ spec: - name: ceph-admin-secret mountPath: /var/lib/rook-ceph-mon readOnly: true + - name: rook-config-override + mountPath: /etc/rook-config-override + readOnly: true volumes: - name: ceph-admin-secret secret: @@ -122,6 +133,10 @@ spec: items: - key: data path: mon-endpoints + - name: rook-config-override + configMap: + name: rook-config-override + optional: true - name: ceph-config emptyDir: {} tolerations: diff --git a/images/ceph/toolbox.sh b/images/ceph/toolbox.sh index 811c34bde..7e847710f 100755 --- a/images/ceph/toolbox.sh +++ b/images/ceph/toolbox.sh @@ -17,6 +17,7 @@ CEPH_CONFIG="/etc/ceph/ceph.conf" MON_CONFIG="/etc/rook/mon-endpoints" KEYRING_FILE="/etc/ceph/keyring" +CONFIG_OVERRIDE="/etc/rook-config-override/config" # create a ceph config file in its default location so ceph/rados tools can be used # without specifying any arguments @@ -37,6 +38,13 @@ mon_host = ${mon_endpoints} [client.admin] keyring = ${KEYRING_FILE} EOF + + # Merge the config override if it exists and is not empty + if [ -f "${CONFIG_OVERRIDE}" ] && [ -s "${CONFIG_OVERRIDE}" ]; then + echo "$DATE merging config override from ${CONFIG_OVERRIDE}" + echo "" >> ${CEPH_CONFIG} + cat ${CONFIG_OVERRIDE} >> ${CEPH_CONFIG} + fi } # watch the endpoints config file and update if the mon endpoints ever change