Browse Source

Merge "(debug) debug-report.sh support ns filter"

changes/71/634071/6
Zuul 2 months ago
parent
commit
8e9e7510a6
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      promenade/templates/roles/common/usr/local/bin/debug-report.sh

+ 5
- 2
promenade/templates/roles/common/usr/local/bin/debug-report.sh View File

@@ -3,11 +3,13 @@
3 3
 set -ux
4 4
 
5 5
 SUBDIR_NAME=debug-$(hostname)
6
+BASETEMP=${BASETEMP:-"/var/tmp"}
7
+NAMESPACE_PATTERN=${NAMESPACE_PATTERN:-'.*'}
6 8
 
7 9
 # NOTE(mark-burnett): This should add calicoctl to the path.
8 10
 export PATH=${PATH}:/opt/cni/bin
9 11
 
10
-TEMP_DIR=$(mktemp -d)
12
+TEMP_DIR=$(mktemp -d -p "$BASETEMP")
11 13
 export TEMP_DIR
12 14
 export BASE_DIR="${TEMP_DIR}/${SUBDIR_NAME}"
13 15
 export HELM_DIR="${BASE_DIR}/helm"
@@ -18,7 +20,7 @@ mkdir -p "${BASE_DIR}"
18 20
 PARALLELISM_FACTOR=2
19 21
 
20 22
 function get_namespaces () {
21
-    kubectl get namespaces -o name | awk -F '/' '{ print $NF }'
23
+    kubectl get namespaces -o name | awk -F '/' '{ print $NF }' | grep -E "$NAMESPACE_PATTERN"
22 24
 }
23 25
 
24 26
 function get_pods () {
@@ -125,3 +127,4 @@ fi
125 127
 wait
126 128
 
127 129
 tar zcf "${SUBDIR_NAME}.tgz" -C "${TEMP_DIR}" "${SUBDIR_NAME}"
130
+echo "Report collected in $TEMP_DIR/${SUBDIR_NAME}.tgz"

Loading…
Cancel
Save