Last active
April 1, 2025 15:13
-
-
Save liggitt/c85167509c56481c46c7bf602616041f to your computer and use it in GitHub Desktop.
Kubernetes dependency stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Graph at: | |
# https://docs.google.com/spreadsheets/d/1gtfXBuvBbS5OGHDX78Ax7I9ZKwNbn9l895Y6QlhhJGc/edit | |
# | |
# Results at: | |
# https://gist.github.com/liggitt/c85167509c56481c46c7bf602616041f | |
go install github.com/hhatto/gocloc/cmd/gocloc@latest | |
go install github.com/kubernetes-sigs/depstat@latest | |
output=$1 | |
if [[ -z "${output}" ]]; then | |
echo "Usage: k8s-stats.sh <outputfile>" >&2 | |
exit 1 | |
fi | |
echo "Tag,Vendor files,Vendor LOC,Direct Deps,Transitive Deps,Total Deps" > ${output} | |
for i in $( seq 0 32 ); do | |
tag=$(git tag --sort=v:refname | grep -E "v1[.]$i[.][0-9]+$" | tail -n 1) | |
echo | |
echo $tag | |
git clean -dff > /dev/null | |
git reset --hard HEAD > /dev/null | |
git checkout -q $tag | |
git clean -dff > /dev/null | |
git reset --hard HEAD > /dev/null | |
loc_output=$( | |
cd vendor > /dev/null 2>&1 || cd Godeps > /dev/null 2>&1 | |
gocloc --include-lang=Go --output-type=json . | jq -r '"\(.total.files),\(.total.code)"' | |
) | |
dep_output=",," | |
if [ -f go.mod ]; then | |
staging_dirs=$(ls staging/src/k8s.io | awk '{printf ",k8s.io/" $0}') | |
dep_output=$(depstat stats -m "k8s.io/kubernetes${staging_dirs}" --json | jq -r '"\(.directDependencies),\(.transitiveDependencies),\(.totalDependencies)"') | |
fi | |
echo "${tag},${loc_output},${dep_output}" | |
echo "${tag},${loc_output},${dep_output}" >> ${output} | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tag | Vendor files | Vendor LOC | Direct Deps | Transitive Deps | Total Deps | |
---|---|---|---|---|---|---|
v1.0.7 | 2498 | 402980 | ||||
v1.1.8 | 1783 | 334314 | ||||
v1.2.7 | 2347 | 512200 | ||||
v1.3.10 | 2032 | 551289 | ||||
v1.4.12 | 2499 | 683649 | ||||
v1.5.8 | 2737 | 749583 | ||||
v1.6.13 | 2924 | 786911 | ||||
v1.7.16 | 3231 | 876668 | ||||
v1.8.15 | 3675 | 947256 | ||||
v1.9.11 | 3676 | 1000463 | ||||
v1.10.13 | 3941 | 1127780 | ||||
v1.11.10 | 3884 | 1148601 | ||||
v1.12.10 | 4314 | 1381453 | ||||
v1.13.12 | 4498 | 1415528 | ||||
v1.14.10 | 4857 | 1696402 | ||||
v1.15.12 | 4612 | 1541152 | 224 | 65 | 248 | |
v1.16.15 | 5017 | 1640664 | 199 | 237 | 356 | |
v1.17.17 | 5073 | 1645300 | 191 | 274 | 376 | |
v1.18.20 | 5211 | 1612527 | 193 | 282 | 386 | |
v1.19.16 | 5307 | 1630141 | 168 | 265 | 334 | |
v1.20.15 | 5413 | 1673971 | 166 | 297 | 365 | |
v1.21.14 | 5600 | 1698952 | 164 | 312 | 372 | |
v1.22.17 | 5429 | 1698551 | 164 | 307 | 365 | |
v1.23.17 | 5743 | 1820969 | 236 | 307 | 368 | |
v1.24.17 | 5609 | 1835358 | 231 | 265 | 327 | |
v1.25.16 | 5614 | 1871167 | 228 | 265 | 326 | |
v1.26.15 | 5274 | 1888876 | 217 | 354 | 406 | |
v1.27.16 | 5029 | 1727852 | 211 | 347 | 398 | |
v1.28.15 | 5148 | 1749585 | 211 | 346 | 396 | |
v1.29.15 | 5239 | 1775319 | 212 | 341 | 393 | |
v1.30.11 | 4714 | 1479089 | 199 | 332 | 377 | |
v1.31.7 | 4579 | 1155584 | 187 | 327 | 367 | |
v1.32.3 | 4143 | 1084011 | 180 | 329 | 365 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment