Thanks for your interest in improving karpenter-provider-hetzner. This document covers how to set up, build, test, and submit changes.
- Go (see the
godirective ingo.mod). make,git,docker(for image builds), andhelm(for chart changes).- A Hetzner Cloud API token is only needed for end-to-end testing, not for unit tests.
make test # run unit + controller tests with the race detector
make lint # run golangci-lint
make generate # regenerate the CRD and deepcopy from the Go types
make build # build the controller binary into ./bin
make docker-build TAG=devCI runs make test, golangci-lint, make generate-verify (fails if generated files are stale), and the controller tests. Run these locally before opening a pull request.
The HCloudNodeClass CRD and zz_generated.deepcopy.go are generated from the API types in pkg/apis/v1 by controller-gen. If you change those types, run make generate and commit the regenerated files. CI will fail if they are out of date.
- Write tests first (TDD) for new behavior.
- Tests must assert real behavior, not mock internals. The provider packages use small in-package fakes that implement the narrow hcloud client interfaces; reuse those patterns.
- Keep
go test -race ./...green.
- Use clear, conventional-ish commit subjects (
feat:,fix:,refactor:,docs:,test:,ci:,chore:). - Keep PRs focused. Separate refactors from behavior changes where practical.
- Fill out the pull request template, including how you verified the change.
- All status checks must pass before merge.
Use the issue templates. For security issues, follow SECURITY.md instead of opening a public issue.
By contributing, you agree that your contributions are licensed under the Apache 2.0 License.