@@ -21,9 +21,9 @@ set -o pipefail
2121REPO_ROOT=$( dirname " ${BASH_SOURCE[0]} " ) /../..
2222cd " ${REPO_ROOT} " || exit 1
2323
24- # shellcheck source=../ hack/ensure-kind.sh
24+ # shellcheck source=hack/ensure-kind.sh
2525source " ${REPO_ROOT} /hack/ensure-kind.sh"
26- # shellcheck source=../ hack/ensure-kubectl.sh
26+ # shellcheck source=hack/ensure-kubectl.sh
2727source " ${REPO_ROOT} /hack/ensure-kubectl.sh"
2828
2929export ARTIFACTS=" ${ARTIFACTS:- ${PWD} / _artifacts} "
@@ -33,7 +33,8 @@ export KUBECONFIG="${KUBECONFIG:-${PWD}/kubeconfig}"
3333
3434get_node_name () {
3535 local -r pod_name=" ${1} "
36- echo " $( kubectl get pod " ${pod_name} " -ojsonpath={.spec.nodeName}) "
36+ # shellcheck disable=SC1083
37+ kubectl get pod " ${pod_name} " -ojsonpath={.spec.nodeName}
3738}
3839
3940dump_mgmt_cluster_logs () {
@@ -90,7 +91,8 @@ dump_workload_cluster_logs() {
9091 kubectl apply -f " ${REPO_ROOT} /hack/log/log-dump-daemonset.yaml"
9192 kubectl wait pod -l app=log-dump-node --for=condition=Ready --timeout=5m
9293
93- local -r log_dump_pods=( $( kubectl get pod -l app=log-dump-node -ojsonpath={.items[* ].metadata.name}) )
94+ local -r log_dump_pods=()
95+ IFS=" " read -r -a log_dump_pods <<< " $(kubectl get pod -l app=log-dump-node -ojsonpath='{.items[*].metadata.name}')"
9496 local log_dump_commands=(
9597 " journalctl --output=short-precise -u kubelet > kubelet.log"
9698 " journalctl --output=short-precise -u containerd > containerd.log"
@@ -108,7 +110,8 @@ dump_workload_cluster_logs() {
108110 fi
109111
110112 for log_dump_pod in " ${log_dump_pods[@]} " ; do
111- local node_name=" $( get_node_name " ${log_dump_pod} " ) "
113+ local node_name
114+ node_name=" $( get_node_name " ${log_dump_pod} " ) "
112115
113116 local log_dump_dir=" ${ARTIFACTS} /workload-cluster/${node_name} "
114117 mkdir -p " ${log_dump_dir} "
@@ -127,6 +130,7 @@ dump_workload_cluster_logs() {
127130
128131cleanup () {
129132 kubectl delete -f " ${REPO_ROOT} /hack/log/log-dump-daemonset.yaml" || true
133+ # shellcheck source=hack/log/redact.sh
130134 source " ${REPO_ROOT} /hack/log/redact.sh"
131135}
132136
0 commit comments