Thank you for your interest in contributing! Below are guidelines to help you get started and ensure a smooth review process.
- Getting Started
- Development Workflow
- Coding Guidelines
- Pull Requests
- Testing
- Building
- Docker Images
- Reporting Bugs
- Asking Questions
- Fork the repository on GitHub.
- Clone your fork locally:
git clone https://github.com/<your-username>/kubexit.git cd kubexit
- Add the upstream remote to stay in sync:
git remote add upstream https://github.com/karlkfi/kubexit.git
- Sync the workspace:
This project uses a Go workspace (
go work sync && go mod downloadgo.work) with three modules: root (pkg/),cmd/kubexit, andcmd/test-server. Thego work synccommand keeps replace directives in sync across all modules.
- Create a feature branch from
master:git fetch upstream git checkout -b feature/your-feature-name upstream/master
- Make your changes following the coding guidelines below.
- Run the linters and tests before committing:
Both commands run across all modules in the workspace via
make lint make test./.... - Commit with a clear, descriptive message (see Commit Messages).
- Push and open a pull request against
upstream/master.
- Format all code with
gofmt(runmake fixfor auto-formatting includinggoimports). - Run
go vet ./...to catch common issues. - Write a doc comment on every exported function, type, and package.
- Keep comments on private functions when the intent is non-obvious.
- Add tests for new functionality and updates when behavior changes. See Testing.
- Don't add new dependencies unless necessary. If you must, prefer direct dependencies over transitive ones and note the rationale in the PR description.
- Use the imperative mood: "Add logging" not "Added logging".
- Keep the subject line under 72 characters.
- Include a body paragraph for non-trivial changes that explains the why, not the what.
- Reference related issues using
#<number>when applicable.
- Keep PRs focused — one feature or fix per PR.
- Include a clear description of the problem and the approach.
- Reference any related issues.
- Ensure CI passes (unit tests, linting, and e2e tests) before requesting review.
- Respond to review comments promptly; push follow-up commits instead of amending (preserves review history).
make test-unitUnit tests run via Go's built-in test framework and are executed on every push and pull request through CI.
Integration tests deploy a test-server into a local kind cluster to verify watch behavior against the live Kubernetes API.
make test-integrationIntegration tests verify the interaction with Kubernetes components using a kind cluster and are executed on every push and pull request through CI.
E2E tests deploy kubexit in a real Kubernetes cluster to verify behavior against the live Kubernetes API. They run against a Kind cluster in CI.
To run them locally (requires Docker, kind, and kubectl installed):
# Start a Kind cluster
kind create cluster --name kubexit
# Build the kubexit image and load it into the cluster
docker build -t kubexit:latest .
kind load docker-image kubexit:latest --name kubexit
# Run the tests
bash ci/e2e-test/client-server/apply-job.sh
bash ci/e2e-test/client-server/await-job.sh
bash ci/e2e-test/client-server/delete-job.sh
# Tear down the cluster
kind delete cluster --name kubexitSee ci/e2e-test/README.md for details.
make lintThis runs golangci-lint (requires golangci-lint installed locally; CI handles this automatically).
make binThere are two Docker images in the project:
| Image | Dockerfile | Purpose |
|---|---|---|
kubexit |
Dockerfile |
Main application binary |
kubexit/test-server |
cmd/test-server/Dockerfile |
Test HTTP server for integration tests |
Both use a multi-stage build: a golang:1.26-alpine builder stage compiles the binary, and an alpine:3.23 runtime stage ships the final artifact.
Build locally with:
# Main image
docker build -t kubexit:latest .
# Test server image
docker build -f cmd/test-server/Dockerfile -t kubexit/test-server:latest .To load images into a Kind cluster for local testing:
kind load docker-image kubexit:latest --name kubexit
kind load docker-image kubexit/test-server:latest --name kubexitOpen an issue on GitHub with:
- A clear title and description of the expected vs. actual behavior.
- Steps to reproduce.
- The kubexit version and Kubernetes cluster version.
- Any relevant logs or configuration.
- Open a GitHub Issue for general questions or feature ideas.
- For proposed changes, sketch the approach in an issue before implementing to avoid wasted effort.