Skip to content

Commit f8374f1

Browse files
alicefrHarshwardhanPatil07
authored andcommitted
hack: make gather-logs.sh provider-agnostic
Previously, gather-logs was using bink ssh, in order to make it compatible with EKS, let's use a more generic way and use the bootc-operator daemons to fetch the logs. This will work with each cluster provider. Assisted-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 0023325 commit f8374f1

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ deploy-bink: start-bink build-update-image kustomize ## Deploy to a bink cluster
233233

234234
.PHONY: gather-bink
235235
gather-bink: ## Gather diagnostic logs from the bink cluster.
236-
KUBECONFIG=$(abspath $(KUBECONFIG_BINK)) BINK_CLUSTER_NAME=$(BINK_CLUSTER_NAME) \
236+
KUBECONFIG=$(abspath $(KUBECONFIG_BINK)) \
237237
hack/gather-logs.sh $(ARTIFACTS)/gather-bink controller
238238

239239
.PHONY: teardown-bink

‎hack/gather-logs.sh‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
2-
# Gather diagnostic logs from a bink cluster.
2+
# Gather diagnostic logs from a cluster.
33
#
44
# Usage: hack/gather-logs.sh <output-dir> [node-names...]
55
#
6-
# Expects KUBECONFIG and BINK_CLUSTER_NAME from environment.
6+
# Expects KUBECONFIG from environment.
77
# Each command's output is written to a separate file in <output-dir>.
88
# Individual command failures are non-fatal.
99

@@ -15,7 +15,6 @@ if [[ $# -lt 1 ]]; then
1515
fi
1616

1717
: "${KUBECONFIG:?must be set}"
18-
: "${BINK_CLUSTER_NAME:?must be set}"
1918

2019
output_dir="$1"
2120
shift
@@ -32,10 +31,6 @@ run() {
3231
"$@" > "${output_dir}/${filename}" 2>&1 || true
3332
}
3433

35-
# Host diagnostics
36-
run "host-journal.txt" journalctl --no-pager
37-
run "host-dmesg.txt" dmesg
38-
3934
# Cluster-wide commands
4035
run "k-get-pods.txt" kubectl get pods -n bootc-operator -o wide
4136
run "k-describe-pods.txt" kubectl describe pods -n bootc-operator
@@ -50,10 +45,19 @@ for pod in $(kubectl get pods -n bootc-operator -o jsonpath='{.items[*].metadata
5045
run "k-logs-${pod}-previous.log" kubectl logs -n bootc-operator "${pod}" --all-containers --previous
5146
done
5247

53-
# Per-node commands
48+
# Per-node commands via daemon pod exec
5449
for node in "${nodes[@]}"; do
5550
run "k-describe-node-${node}.txt" kubectl describe node "${node}"
56-
run "journal-${node}.txt" bink node ssh "${node}" --cluster-name "${BINK_CLUSTER_NAME}" -- journalctl --no-pager
51+
52+
daemon_pod=$(kubectl get pods -n bootc-operator \
53+
-l app.kubernetes.io/name=bootc-operator,app.kubernetes.io/component=daemon \
54+
--field-selector "spec.nodeName=${node}" \
55+
-o jsonpath='{.items[0].metadata.name}' 2>/dev/null || true)
56+
57+
if [[ -n "${daemon_pod}" ]]; then
58+
run "journal-${node}.txt" kubectl exec -n bootc-operator "${daemon_pod}" -- \
59+
journalctl --no-pager
60+
fi
5761
done
5862

5963
echo "Done."

0 commit comments

Comments
 (0)