- Go 1.22+
golangci-lint(optional, for lint step)
git clone https://github.com/topcug/kubectl-triage.git
cd kubectl-triage
make build
make testmake fmt # format code
make lint # run linter
make test # run tests with race detector
make build # build binary to ./bin/kubectl-triage
make install # install to $(go env GOPATH)/bincmd/ cobra commands (pod, deployment, job, root)
internal/
kube/ Kubernetes API fetchers (read-only)
render/ output renderers: table, json, markdown
triage/ report assembly and recommendation logic
config/ .kubectl-triage.yaml config loader
pkg/types/ shared TriageReport struct
test/fixtures/ fake Kubernetes objects for unit tests
docs/ extended documentation
- Add the relevant field(s) to
pkg/types/report.go. - Fetch data in the appropriate
internal/kube/fetch_*.gofile. - Populate the field in
internal/triage/assemble.go. - Add a bullet rule in
internal/triage/score.go(BuildSummaryBulletsand/orRecommend). - Render it in
internal/render/table.go(andmarkdown.goif applicable). - Add a unit test in
internal/triage/score_test.go.
- Add
AssembleXxxininternal/triage/assemble.go. - Add
cmd/xxx.gofollowing the pattern ofcmd/pod.go. - Register the command in
cmd/root.go.
<type>: <short description>
types: feat, fix, docs, test, refactor, chore, ci
Releases are handled by GoReleaser via the CI pipeline. To test locally:
make release-snapshotTag a release:
git tag v0.x.0
git push origin v0.x.0The CI pipeline runs GoReleaser automatically on version tags.
- Keep PRs focused — one concern per PR.
- All tests must pass (
make test). - Update
CHANGELOG.mdwith a summary of your change under[Unreleased].