Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from koor-tech/wip-update-script
Browse files Browse the repository at this point in the history
chore: use bash instead of shell
  • Loading branch information
ideepika authored Jun 28, 2023
2 parents b180248 + 4862e2c commit adfde2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ It collects the following information:

## Prerequisites

* Requires Bash
* Currently only works with Rook Ceph clusters
* [Toolbox pod](https://rook.io/docs/rook/latest-release/Troubleshooting/ceph-toolbox/) must be running to collect some of the information needed by the debug script
* `kubectl` configured with access to the Kubernetes clusters running the Rook Ceph clusters
Expand Down
10 changes: 6 additions & 4 deletions gather-info.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

CLUSTER_NAMESPACE="${CLUSTER_NAMESPACE:-rook-ceph}"
OPERATOR_NAMESPACE="${OPERATOR_NAMESPACE:-}"
Expand Down Expand Up @@ -42,12 +42,14 @@ gatherKubernetesObjects() {
# Get Rook Ceph CRs as YAML
for crd in $(kubectl get crd --no-headers -o custom-columns=":metadata.name" | grep ".ceph.rook.io"); do
kubectl get -A "${crd}" --output yaml > "rook_ceph-get-cr-${crd}"
echo "Collected yaml Rook CRD ${crd}"
done
}

runCommandInToolsPod() {
command=$(echo "$*" | sed 's/ /_/g')
command=$(echo "$command" | sed 's/-/_/g')
command="$*"
command="${command// /_}"
command="${command//-/_}"
kubectl -n "${CLUSTER_NAMESPACE}" exec -it deploy/rook-ceph-tools -- "${@}" > ceph-commands/"${command}"
}

Expand Down Expand Up @@ -81,7 +83,7 @@ gatherCephCommands() {

gatherCrashInfo() {
for crash in $(kubectl -n "${CLUSTER_NAMESPACE}" exec -it deploy/rook-ceph-tools -- ceph crash ls-new); do
echo "crash info for $crash "
echo "Collected crash info for $crash"
runCommandInToolsPod ceph crash info "$crash"
done
}
Expand Down

0 comments on commit adfde2f

Please sign in to comment.