From 815b38f4704011fe8501c2f8298e322206a2008e Mon Sep 17 00:00:00 2001 From: Vibhu Prashar Date: Thu, 11 Jan 2024 16:57:59 +0530 Subject: [PATCH] fix: update must-gather script Signed-off-by: Vibhu Prashar --- must-gather/common | 6 +++--- must-gather/gather | 12 ++++-------- must-gather/gather-kepler-exporter-info | 12 ++++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/must-gather/common b/must-gather/common index 26a1026e..535afb13 100755 --- a/must-gather/common +++ b/must-gather/common @@ -17,7 +17,7 @@ set -eu -o pipefail -export KEPLER_NS="openshift-kepler-operator" +export KEPLER_NS="kepler-operator" export LOGFILE_NAME="gather-debug.log" get_timestamp() { @@ -42,8 +42,8 @@ log() { run() { length=$(($# - 1)) - cmd=${@:1:$length} - gather_file="${@: -1}" + cmd=${*:1:$length} + gather_file="${*: -1}" log_file "$cmd" $cmd >>"$gather_file" 2>>"$LOGFILE_PATH" || true diff --git a/must-gather/gather b/must-gather/gather index e9e935e7..54fcaaa3 100755 --- a/must-gather/gather +++ b/must-gather/gather @@ -41,27 +41,23 @@ get_kepler_events() { } get_kepler_daemon_set() { - KEPLER_EXPORTER_DS="kepler-exporter-ds" log "getting kepler exporter daemonset" - run oc -n "$KEPLER_NS" get ds $KEPLER_EXPORTER_DS -oyaml "$BASE_COLLECTION_PATH/$KEPLER_EXPORTER_DS"".yaml" + run oc -n "$KEPLER_NS" get ds kepler -oyaml "$BASE_COLLECTION_PATH/kepler-ds.yaml" } get_kepler_config_map() { - KEPLER_EXPORTER_CM="kepler-exporter-cm" log "getting kepler exporter config map" - run oc -n "$KEPLER_NS" get cm $KEPLER_EXPORTER_CM -oyaml "$BASE_COLLECTION_PATH/$KEPLER_EXPORTER_CM"".yaml" + run oc -n "$KEPLER_NS" get cm kepler -oyaml "$BASE_COLLECTION_PATH/kepler-cm.yaml" } get_kepler_sa() { - KEPLER_EXPORTER_SA="kepler-exporter-sa" log "getting kepler exporter service account" - run oc -n "$KEPLER_NS" get serviceaccount $KEPLER_EXPORTER_SA -oyaml "$BASE_COLLECTION_PATH/$KEPLER_EXPORTER_SA"".yaml" + run oc -n "$KEPLER_NS" get serviceaccount kepler -oyaml "$BASE_COLLECTION_PATH/kepler-sa.yaml" } get_kepler_scc() { - KEPLER_EXPORTER_SCC="kepler-exporter-scc" log "getting kepler exporter scc" - run oc get scc "$KEPLER_EXPORTER_SCC" -oyaml "$BASE_COLLECTION_PATH/$KEPLER_EXPORTER_SCC"".yaml" + run oc get scc kepler -oyaml "$BASE_COLLECTION_PATH/kepler-scc.yaml" } gather_kepler_exporter_info() { diff --git a/must-gather/gather-kepler-exporter-info b/must-gather/gather-kepler-exporter-info index 5229b163..7e6f2829 100755 --- a/must-gather/gather-kepler-exporter-info +++ b/must-gather/gather-kepler-exporter-info @@ -30,35 +30,35 @@ get_kepler_pod() { get_kepler_cpuid() { log "getting information from \"cpuid\" from kepler pod: $KEPLER_POD" - run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler-exporter -- cpuid -1 "$KEPLER_POD_INFO_DIR/node-cpuid-info" + run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler -- cpuid -1 "$KEPLER_POD_INFO_DIR/node-cpuid-info" } get_kepler_env_var() { log "getting environment variables from kepler pod: $KEPLER_POD" - run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler-exporter -- env "$KEPLER_POD_INFO_DIR/env-variables" + run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler -- env "$KEPLER_POD_INFO_DIR/env-variables" } get_kepler_kernel_info() { log "getting kernel version from kepler pod: $KEPLER_POD" echo "kernel version:" >>"$KEPLER_POD_INFO_DIR/kernel-info" - run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler-exporter -- uname -a "$KEPLER_POD_INFO_DIR/kernel-info" + run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler -- uname -a "$KEPLER_POD_INFO_DIR/kernel-info" } get_kepler_ebpf_info() { log "getting ebpf information from kepler pod: $KEPLER_POD" echo "## kprobes list only applicable for bcc" >>"$KEPLER_POD_INFO_DIR/ebpf-info" echo "kprobes list:" >>"$KEPLER_POD_INFO_DIR/ebpf-info" - run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler-exporter -- cat /sys/kernel/debug/kprobes/list "$KEPLER_POD_INFO_DIR/ebpf-info" + run oc -n "$KEPLER_NS" exec "$KEPLER_POD" -c kepler -- cat /sys/kernel/debug/kprobes/list "$KEPLER_POD_INFO_DIR/ebpf-info" } get_kepler_logs() { log "getting logs from kepler pod: $KEPLER_POD" - run oc -n "$KEPLER_NS" logs "$KEPLER_POD" -c kepler-exporter "$KEPLER_POD_INFO_DIR/kepler.log" + run oc -n "$KEPLER_NS" logs "$KEPLER_POD" -c kepler "$KEPLER_POD_INFO_DIR/kepler.log" } main() { - KEPLER_POD_INFO_DIR="$BASE_COLLECTION_PATH/kepler-exporter-info/$KEPLER_POD" + KEPLER_POD_INFO_DIR="$BASE_COLLECTION_PATH/kepler-info/$KEPLER_POD" mkdir -p "$KEPLER_POD_INFO_DIR" get_kepler_pod