Skip to content

Commit

Permalink
Collect more info about Amazon VPC CNI (#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
guessi authored Oct 20, 2023
1 parent bd6844d commit dbf0d15
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions log-collector-script/linux/eks-log-collector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ collect() {
get_sysctls_info
get_networking_info
get_cni_config
get_cni_configuration_variables
get_docker_logs
get_sandboxImage_info
get_cpu_throttled_processes
Expand Down Expand Up @@ -560,6 +561,35 @@ get_cni_config() {
ok
}

get_cni_configuration_variables() {
# To get cni configuration variables, gather from the main container "amazon-k8s-cni"
# - https://github.com/aws/amazon-vpc-cni-k8s#cni-configuration-variables
try "collect CNI Configuration Variables from Docker"

# "docker container list" will only show "RUNNING" containers.
# "docker container inspect" will generate plain text output.
if [[ "$(pgrep -o dockerd)" -ne 0 ]]; then
timeout 75 docker container list | awk '/amazon-k8s-cni/{print$NF}' | xargs -n 1 docker container inspect > "${COLLECT_DIR}"/cni/cni-configuration-variables-dockerd.txt 2>&1 || echo -e "\tTimed out, ignoring \"cni configuration variables output \" "
else
warning "The Docker daemon is not running."
fi

try "collect CNI Configuration Variables from Containerd"

# "ctr container list" will list down all containers, including stopped ones.
# "ctr container info" will generate JSON format output.
if ! command -v ctr > /dev/null 2>&1; then
warning "ctr not installed"
else
# "ctr --namespace k8s.io container list" will return two containers
# - amazon-k8s-cni:v1.xx.yy
# - amazon-k8s-cni-init:v1.xx.yy
timeout 75 ctr --namespace k8s.io container list | awk '/amazon-k8s-cni:v/{print$1}' | xargs -n 1 ctr --namespace k8s.io container info > "${COLLECT_DIR}"/cni/cni-configuration-variables-containerd.json 2>&1 || echo -e "\tTimed out, ignoring \"cni configuration variables output \" "
fi

ok
}

get_pkgtype() {
if [[ "$(command -v rpm)" ]]; then
PACKAGE_TYPE=rpm
Expand Down

0 comments on commit dbf0d15

Please sign in to comment.