Skip to content

Instantly share code, notes, and snippets.

@rjhowe
Last active May 6, 2025 19:46
Show Gist options
  • Save rjhowe/ec2dc650730deea7a88ae5b4b7eb8e83 to your computer and use it in GitHub Desktop.
Save rjhowe/ec2dc650730deea7a88ae5b4b7eb8e83 to your computer and use it in GitHub Desktop.
etcd object size count
for base in kubernetes openshift; do
readarray RESOURCES <<< \
"$(etcdctl --command-timeout=30s \
get --prefix / --keys-only 2>/dev/null | grep -oP "(?<=/${base}.io\/).+?(?=\/)" | sort | uniq)"
for res in "${RESOURCES[@]}"; do
BYTES=$(etcdctl --command-timeout=30s \
get --prefix /${base}.io/$res -w protobuf | wc -c)
COUNT==$(etcdctl --command-timeout=30s \
get --prefix /${base}.io/$res --keys-only | sed '/^$/d' | wc -l)
echo "/${base}.io/$res Count=$COUNT Bytes=$BYTES"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment