How yonahd/kor works
Kor is a CLI and Prometheus exporter for finding unused Kubernetes resources. A user runs a resource subcommand or requests a combined scan; the CLI initializes Kubernetes clients and options, resource analyzers identify candidates, and results are formatted for output or optionally deleted. The README also documents Slack notifications and broad resource coverage. Several resource implementations and the exporter internals were not sampled, so their links are documented or shown as unverified rather than inferred from naming alone.
Main entry points: root.go Command setup · kor Resource commands · all.go All-resource scan · multi.go Multi-resource scan
Components 20
CLI entrypoints
- Program entry
main.go - Command setup
cmd/kor/root.go - Resource commands
cmd/kor - Combined scan
cmd/kor/all.go - Exporter command
cmd/kor/exporter.go
Resource analysis
- Multi-resource scan
pkg/kor/multi.go - All-resource scan
pkg/kor/all.go - Resource analyzers
pkg/kor - Service analysis
pkg/kor/services.go - Account analysis
pkg/kor/serviceaccounts.go - Storage analysis
pkg/kor/storageclasses.go - Scan filters
pkg/filters/filters.go
Results and actions
- Output formatting
pkg/kor/formatter.go - Resource deletion
pkg/kor/delete.go - Slack delivery
pkg/utils/slack.go
Cluster operations
- Metrics exporter
pkg/kor/exporter.go
Other components
- CLI user
- Kubernetes API
- Prometheus
- Slack
Connections 22
- CLI user → Program entry: runs
- Program entry → Command setup: executes
main.go - Command setup → Multi-resource scan: invokes scan
cmd/kor/root.go - Command setup → Resource commands: registers commands
cmd/kor/root.go - Combined scan → All-resource scan: runs combined scan
- Exporter command → Metrics exporter: starts exporter
cmd/kor/exporter.go - Multi-resource scan → All-resource scan: dispatches resources
- All-resource scan → Resource analyzers: calls analyzers
pkg/kor/all.go - Resource commands → Service analysis: runs service scan
cmd/kor/services.go - Resource commands → Account analysis: runs account scan
cmd/kor/serviceaccounts.go - Resource commands → Storage analysis: runs storage scan
cmd/kor/storageclasses.go - Service analysis → Kubernetes API: reads endpoints
pkg/kor/services.go - Account analysis → Kubernetes API: reads account usage
pkg/kor/serviceaccounts.go - Storage analysis → Kubernetes API: reads storage usage
pkg/kor/storageclasses.go - Resource analyzers → Scan filters: applies filters
- Resource analyzers → Resource deletion: may delete
- Multi-resource scan → Output formatting: formats results
- All-resource scan → Output formatting: formats results
pkg/kor/all.go - Command setup → Slack delivery: may notify
- Metrics exporter → Kubernetes API: collects cluster data
- Metrics exporter → Prometheus: exposes metrics
- Slack delivery → Slack: sends messages
pkg/utils/slack.go