Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Last active June 17, 2019 13:32
Show Gist options
  • Save hexfusion/e5e9d44db9721f0f52d0804b0406f46e to your computer and use it in GitHub Desktop.
Save hexfusion/e5e9d44db9721f0f52d0804b0406f46e to your computer and use it in GitHub Desktop.
#/usr/bin/env bash
set -euo pipefail
export ETCDCTL_API=3
# populate
ENDPOINTS=""
for base in kubernetes openshift; do
readarray RESOURCES <<< \
"$(etcdctl --cacert=/etc/etcd/ca.crt --cert=/etc/etcd/peer.crt --key=/etc/etcd/peer.key \
--endpoints=$ENDPOINTS --command-timeout=30s \
get --prefix / --keys-only 2>/dev/null | grep -oP "(?<=/${base}.io\/).+?(?=\/)" | sort | uniq)"
for res in "${RESOURCES[@]}"; do
BYTES=$(etcdctl --cacert=/etc/etcd/ca.crt --cert=/etc/etcd/peer.crt --key=/etc/etcd/peer.key \
--endpoints=$ENDPOINTS --command-timeout=30s \
get --prefix /${base}.io/$res -w protobuf | wc -c)
echo "/${base}.io/$res - Total Bytes: $BYTES"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment