openstack-helm-infra/ceph-client/templates/bin/utils/_defragOSDs.sh.tpl
Vladimir Kozhukalov 75fdad3ff9 Run utils-defragOSDs.sh in ceph-osd-default container
The Ceph defragosds cronjob script used to
connect to OSD pods not explicitly specifying
the ceph-osd-default container and eventually
tried to run the defrag script in the log-runner
container where the defrag script is mounted with
0644 permissions and shell fails to run it.

Change-Id: I4ffc6653070dbbc6f0766b278acf0ebe2b4ae1e1
2024-09-12 13:52:15 -05:00

30 lines
910 B
Smarty

#!/bin/bash
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -ex
PODS=$(kubectl get pods --namespace=${NAMESPACE} \
--selector=application=ceph,component=osd --field-selector=status.phase=Running \
'--output=jsonpath={range .items[*]}{.metadata.name}{"\n"}{end}')
for POD in ${PODS}; do
kubectl exec -t ${POD} -c ceph-osd-default --namespace=${NAMESPACE} -- \
sh -c -e "/tmp/utils-defragOSDs.sh"
done
exit 0