Skip to content

Commit

Permalink
Add events gathering in readable format
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
  • Loading branch information
mmorhun committed Nov 16, 2021
1 parent dc2a942 commit e6e2fe1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions .github/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ installYq() {
echo "[INFO] $(jq --version)"
}

# Graps Eclipse Che logs
collectLogs() {
mkdir -p ${ARTIFACTS_DIR}

Expand All @@ -178,6 +177,7 @@ collectClusterData() {
for namespace in $allNamespaces ; do
collectK8sResourcesForNamespace $namespace
collectPodsLogsForNamespace $namespace
collectEventsForNamespace $namespace
done
collectClusterScopeK8sResources
}
Expand All @@ -190,14 +190,13 @@ collectK8sResourcesForNamespace() {
"services" "ingresses"
"configmaps" "secrets"
"serviceaccounts" "roles" "rolebindings"
"events"
"pv" "pvc"
)
CRDS_KINDS=($(kubectl get crds -o jsonpath="{.items[*].spec.names.plural}"))
KINDS=("${STANDARD_KINDS[@]}" "${CRDS_KINDS[@]}")

for kind in "${KINDS[@]}" ; do
dir="${ARTIFACTS_DIR}/cluster/namespaces/${namespace}/${kind}"
dir="${ARTIFACTS_DIR}/resources/namespaced/${namespace}/${kind}"
mkdir -p $dir

names=$(kubectl get -n $namespace $kind --no-headers=true -o custom-columns=":metadata.name")
Expand All @@ -213,7 +212,7 @@ collectClusterScopeK8sResources() {
"clusterroles" "clusterrolebindings"
)
for kind in "${KINDS[@]}" ; do
dir="${ARTIFACTS_DIR}/cluster/global/${kind}"
dir="${ARTIFACTS_DIR}/resources/cluster/${kind}"
mkdir -p $dir

names=$(kubectl get -n $namespace $kind --no-headers=true -o custom-columns=":metadata.name")
Expand All @@ -240,6 +239,16 @@ collectPodsLogsForNamespace() {
done
}

collectEventsForNamespace() {
namespace="$1"
if [[ -z $namespace ]]; then return; fi

dir="${ARTIFACTS_DIR}/cluster/namespaces/${namespace}"
mkdir -p $dir

kubectl get -n $namespace events > "${dir}/events.yaml"
}

# Build latest operator image
buildCheOperatorImage() {
#docker build -t "${OPERATOR_IMAGE}" -f Dockerfile .
Expand Down

0 comments on commit e6e2fe1

Please sign in to comment.