Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions scripts/collect-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Check if kubectl exists, if not, switch to oc
if ! command_exists $KUBECTL; then
echo "No kubectl command found, exiting..."
exit 1
echo "No kubectl command found, switching to oc..."
KUBECTL=oc #For Openshift environments
if ! command_exists $KUBECTL; then
echo "Neither kubectl nor oc command found, exiting..."
exit 1
fi
fi

if ! command_exists $HELM; then
echo "No helm command found, exiting..."
exit 1
fi

CURRENT_NS=$(kubectl config view --minify --output 'jsonpath={..namespace}')
CURRENT_NS=$($KUBECTL config view --minify --output 'jsonpath={..namespace}')
CURRENT_NS=${CURRENT_NS:-trendmicro-system}
NAMESPACE=${NAMESPACE:-$CURRENT_NS}
NAMESPACE_PARAM="--namespace=$NAMESPACE"
Expand Down