-
Notifications
You must be signed in to change notification settings - Fork 186
/
must_gather.sh
executable file
·31 lines (24 loc) · 1.13 KB
/
must_gather.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
set -xeu
source logging.sh
source common.sh
source utils.sh
source network.sh
MUST_GATHER_PATH=${MUST_GATHER_PATH:-$LOGDIR/$CLUSTER_NAME/must-gather-$(date +%F-%H%M%S)}
if [ ! -d "$MUST_GATHER_PATH" ]; then
mkdir -p "$MUST_GATHER_PATH"
fi
# must-gather doesn't correctly work in disconnected environment, so we
# have to calculcate the pullspec for the image and pass it to oc
if [[ -n "${MIRROR_IMAGES}" && "${MIRROR_IMAGES,,}" != "false" ]]; then
write_pull_secret
MUST_GATHER_RELEASE_IMAGE=$(image_for must-gather | cut -d '@' -f2)
LOCAL_REGISTRY_PREFIX="${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT}/${LOCAL_IMAGE_URL_SUFFIX}"
MUST_GATHER_IMAGE="--image=${LOCAL_REGISTRY_PREFIX}@${MUST_GATHER_RELEASE_IMAGE}"
else
MUST_GATHER_IMAGE=""
fi
oc --insecure-skip-tls-verify adm must-gather $MUST_GATHER_IMAGE --dest-dir "$MUST_GATHER_PATH" > "$MUST_GATHER_PATH/must-gather.log"
# Gather audit logs
mkdir -p $MUST_GATHER_PATH/audit-logs
oc --insecure-skip-tls-verify adm must-gather $MUST_GATHER_IMAGE --dest-dir "$MUST_GATHER_PATH/audit-logs" -- /usr/bin/gather_audit_logs > "$MUST_GATHER_PATH/audit-logs.log"