This guide covers the normal workflow for changing and testing Yardmaster.
- Go 1.24 or newer
- Docker
kubectlkindfor local cluster development- access to a Kubernetes cluster through kubeconfig
kubectl apply -k provides the Kustomize behavior used by this repository.
go mod download
make verifymake build creates:
bin/yardmaster
bin/kubectl-yardmaster
bin/yardmaster-dashboard
The bin/ directory is ignored by Git because these files are build outputs.
api/ Kubernetes API definitions
cmd/ Executable entrypoints
config/ Kubernetes manifests and Kustomize files
docs/ Developer and operator guides
internal/analyzer/ Deterministic analysis logic
internal/controller/ Reconciliation and Kubernetes API behavior
internal/dashboard/ Dashboard server, finding views, page, and assets
internal/presentation/Shared formatting
| Command | Purpose |
|---|---|
make fmt |
Format Go files. |
make fmt-check |
Check Go formatting without changing files. |
make test |
Run all Go tests. |
make vet |
Run Go's static analysis checks. |
make build |
Build all three executables. |
make verify |
Run formatting, generation, vet, tests, builds, and manifest checks. |
make generate |
Regenerate DeepCopy methods. |
make manifests |
Regenerate the CRD manifest. |
make docker-build |
Build the container image. |
make render-deploy IMG=... |
Render the complete deployment with a selected image. |
make run |
Run the operator against the current kubeconfig context. |
make report |
Print findings through the CLI. |
make dashboard |
Run the dashboard locally. |
make demo-kind |
Build and deploy a complete local demo. |
make smoke-kind |
Run a local controller smoke test. |
Create or select the protected Yardmaster development cluster:
make kind-contextInstall the CRD and RBAC:
make installRun the operator locally:
make runIn another terminal, create sample problems and inspect findings:
make sample
make reportRun the dashboard:
make dashboardThen open http://localhost:8088.
The sample, smoke-kind, and demo-kind targets verify that the current
context is kind-yardmaster before creating sample Pods or labeling nodes.
make demo-kindThis target:
- creates or selects the
yardmasterkind cluster - builds the container image
- loads the image into kind
- installs and deploys Yardmaster
- waits for operator and dashboard rollouts
- creates sample workloads
- prints the CLI report
The current test suite covers:
- pending Pod explanations
- request coverage detection
- Track grouping and accounting
- workload owner resolution
- reconciler create, update, resolution, source deletion, and stale cleanup
- Karpenter NodePool and NodeClaim reading
- dashboard sorting, counts, HTTP handlers, and Kubernetes read failures
- presentation formatting
Run one package:
go test ./internal/analyzerRun one test:
go test ./internal/analyzer -run TestAnalyzePodExplainsMissingNodeSelectorRun everything:
go test ./...The reconciler tests use controller-runtime's fake client. envtest integration
tests with a real API server and full end-to-end tests in kind are still future
coverage areas.
When editing api/v1alpha1:
- Change the Go structs and Kubebuilder markers.
- Run
make generate. - Run
make manifests. - Inspect the generated CRD diff.
- Run
go test ./.... - Render the install configuration with
kubectl kustomize config/default.
Generated files should be committed, but not manually edited.
For a rule that can be decided from supplied objects:
- Implement the decision in
internal/analyzer. - Return a draft
DispatchFindingSpec. - Add table-driven unit tests for positive, negative, and edge cases.
- Keep API calls out of the analyzer.
- Let the controller own object retrieval and persistence.
- Create the reconciler in
internal/controller. - Define its primary resource and secondary watches.
- Make finding names deterministic.
- Handle creation, updates, resolution, and source deletion.
- Register it in
cmd/yardmaster/main.go. - Add only the required RBAC permissions.
- Add analyzer, controller, and end-to-end coverage appropriate to the risk.
- Update Controllers.
make fmt
make verifyAlso inspect git diff for accidental generated-file drift, binary files, local
IDE files, credentials, and unrelated changes.