Skip to content

Commit

Permalink
feat: add kubernetes events to logs:IN-1271 (#264)
Browse files Browse the repository at this point in the history
feat: add kubernetes events to logs:IN-1271
  • Loading branch information
edison-vflow authored Jul 5, 2024
1 parent 73e12dd commit a0355c7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/executors/node/node-executor-node-20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ parameters:
type: string
default: medium+
default_node_memory:
description: Default node memory
description: Default node memory.
type: string
default: '4096'
tag:
type: string
default: v3
default: 20.11.1-vf-4
working_directory: ~/voiceflow
docker:
- image: 168387678261.dkr.ecr.us-east-1.amazonaws.com/ci-node-image:<< parameters.tag >>
Expand Down
34 changes: 34 additions & 0 deletions src/jobs/e2e/collect-e2e-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,40 @@ steps:
kubectl describe pod $component -n $DEV_ENV_NAME >> "${LOG_DIR:?}/${KUBE_STATE_DIR:?}/${component}-k8-state.log" &
done
wait
- run:
name: Gather Kubernetes events
environment:
LOG_DIR: *log_dir
KUBE_STATE_DIR: *kube_state_dir
command: |
if [ -f << parameters.env-name-path >> ] && [ "$(cat << parameters.env-name-path >> )" != "null" ]; then
DEV_ENV_NAME=$(cat << parameters.env-name-path >> )
else
DEV_ENV_NAME=<< parameters.e2e-env-name >>
fi
# Gather all events in the namespace except those from external-secrets and secret-store
# These doppler sync events are very verbose and are not relevant to the e2e tests
# Kubernetes events have a ttl of 1 hr, return all relevant namespace events.Use jq to return actual timestamp of event so it can be corelated to service logs.
# The entries are then manipulated to return only the required fields in readable format
kubectl get events -n "${DEV_ENV_NAME:?}" -o json | jq -r '
["LAST-SEEN", "NAME", "REASON", "SOURCE_COMPONENT", "TYPE", "MESSAGE"],
(.items[]
| select(.source.component != "external-secrets")
| select(.source.component != "secret-store")
| [
.lastTimestamp,
.metadata.name,
(.reason // "-"),
(.source.component // "-"),
(.type // "-"),
(.message // "-")
]
)
| map(. | tostring | gsub("\n"; " "))
| @tsv
' | column -t -s $'\t' >> "${LOG_DIR:?}/${KUBE_STATE_DIR:?}/k8-events.log"
- store_artifacts:
name: Store uncompressed logs
path: *log_dir
Expand Down

0 comments on commit a0355c7

Please sign in to comment.