You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support_bundle/get_support_bundle.sh
+92-11Lines changed: 92 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ catch() {
8
8
9
9
#generate sysdigcloud support bundle on kubernetes
10
10
11
+
API_LOCAL=""
11
12
LABELS=""
12
13
CONTEXT=""
13
14
CONTEXT_OPTS=""
@@ -26,6 +27,7 @@ print_help() {
26
27
printf"\t%s\n""-c,--context: Specify the kubectl context. If not set, the current context will be used."
27
28
printf"\t%s\n""-d,--debug: Enables Debug"
28
29
printf"\t%s\n""-l,--labels: Specify Sysdig pod role label to collect (e.g. api,collector,worker)"
30
+
printf"\t%s\n""-la,--local-api: Uses kubectl port-forward feature for being able to access APIs for advanced data collection (for env that cannot reach APIs via domain/FQDN)"
29
31
printf"\t%s\n""-n,--namespace: Specify the Sysdig namespace. (default: ${NAMESPACE})"
30
32
printf"\t%s\n""-s,--since: Specify the timeframe of logs to collect (e.g. -s 1h)"
31
33
printf"\t%s\n""-sa,--secure-api-key: Provide the Secure Superuser API key for advanced data collection"
@@ -59,6 +61,9 @@ parse_commandline() {
59
61
LABELS="$2"
60
62
shift
61
63
;;
64
+
-la|--local-api)
65
+
API_LOCAL="true"
66
+
;;
62
67
-n|--namespace)
63
68
test$# -lt 2 && die "Missing value for the optional argument '$_key'." 1
# Store the port-forward pid in order to kill the process once we finish
164
+
pid=$!
165
+
166
+
# kill the port-forward regardless of how this script exits
167
+
trap'{
168
+
# echo killing $pid
169
+
kill $pid
170
+
}' EXIT
171
+
172
+
# wait for port-forward to become available
173
+
while! curl -s localhost:8080 > /dev/null 2>&1;do
174
+
sleep 0.2
175
+
done
176
+
API_URL="http://127.0.0.1:8080"
177
+
else
178
+
API_URL=$(kubectl ${CONTEXT_OPTS}${KUBE_OPTS} get cm sysdigcloud-collector-config -ojsonpath='{.data.collector-config\.conf}'| grep serverName | head -1 | awk '{print $3}'| sed 's/"//g')
179
+
fi
155
180
# Check that the API_KEY for the Super User is valid and exit
# Store the port-forward pid in order to kill the process once we finish
241
+
pid=$!
242
+
243
+
# kill the port-forward regardless of how this script exits
244
+
trap'{
245
+
# echo killing $pid
246
+
kill $pid
247
+
}' EXIT
248
+
249
+
# wait for port-forward to become available
250
+
while! curl -s localhost:8080 > /dev/null 2>&1;do
251
+
sleep 0.2
252
+
done
253
+
API_URL="http://127.0.0.1:8080"
254
+
else
255
+
API_URL=$(kubectl ${CONTEXT_OPTS}${KUBE_OPTS} get cm sysdigcloud-collector-config -ojsonpath='{.data.collector-config\.conf}'| grep serverName | head -1 | awk '{print $3}'| sed 's/"//g')
256
+
fi
195
257
# Check that the SECURE_API_KEY for the Super User is valid and exit
0 commit comments