Thank you for your interest in contributing to KAI Scheduler! This document provides guidelines and instructions to help you get started with contributing to our project.
Make sure to read our Contributor License Agreement and Code of Conduct.
We're excited to help you make your first contribution! Whether you're looking to file issues, develop features, fix bugs, or improve documentation, we're here to support you through the process.
Browse issues labeled [good first issue] or [help wanted] on GitHub for an easy introduction.
The main building blocks of KAI Scheduler are documented in the docs/developer folder. Here are the key components:
- Action Framework - Core scheduler logic
- Plugin Framework - Extensible plugin system
- Pod Grouper - Group scheduling functionality
- Binder - Binding logic
We recommend reviewing these documents to understand the system architecture before making significant contributions.
Open an issue with a clear description, steps to reproduce, and relevant environment details. See ISSUES.md for what to include in bug reports and feature requests.
Help us keep the docs clear and useful by fixing typos, updating outdated information, or adding examples.
- Open an Issue – For features, behavior or API changes and non-trivial fixes, find or open an issue first so maintainers can confirm the direction. Trivial fixes and documentation changes do not need one.
- Fork and Clone – Begin by forking the repository and cloning it to your local machine.
- Create a Branch – Use a descriptive branch name, such as feature/add-cool-feature or bugfix/fix-issue123.
- Make Changes – Keep your commits small, focused, and well-documented. For detailed build and test instructions, refer to Building from Source.
- Log Changes – For behavior-affecting changes (features, fixes, API changes), add a changelog entry by running
make changelog(powered by changie). This creates a small fragment file under.changes/unreleased/instead of editingCHANGELOG.mddirectly, so entries never conflict between PRs or backports.CHANGELOG.mdis the source of truth for released versions (following keepachangelog.com); your fragment stays in.changes/unreleased/until a maintainer cuts the next release, which folds the pending fragments intoCHANGELOG.mdand clears them. Skip logging internal changes like refactoring or tests. CI checks for a fragment; add theskip-changeloglabel to your PR to skip if your change doesn't require a changelog entry. - Submit a PR – Open a pull request and link the issue (
Fixes #N) under "Related Issues" in the PR description. - Approval Policy – PRs from external contributors require approval from 2 trusted reviewers (organization members or collaborators) before merging.
- Coverage - Please look at the coverage change details and create unit tests, integration tests or end-to-end tests to cover new functionality or changes.
API types, generated clients, and the constants, utilities/resources and utilities/podgroup packages live in the github.com/kai-scheduler/api module. Change them there first:
- Make the change in
kai-scheduler/api. - Test it here with a local
replace github.com/kai-scheduler/api => ../apiingo.mod. Do not commit thereplace. - Release a new api version, then bump it here with
go get github.com/kai-scheduler/api@vX.Y.Z.
The in-tree copies under pkg/apis and pkg/common/{constants,podgroup} have been removed. See the api repo's Contributing section.
make test and make build run in Docker and are slow; prefer targeted commands while iterating. See Building from Source for the full flow.
make validate # regenerates everything and checks git diff; run before finishing any non-trivial change
go test ./pkg/scheduler/actions/allocate # most packages use plain go test
go test -run TestHandleAllocation ./pkg/scheduler/actions/allocate
go tool ginkgo -v --focus "pattern" ./pkg/binder/controllers/integration_tests # Ginkgo suites
make envtest # then run go test with KUBEBUILDER_ASSETS (see build/makefile/testenv.mk)
./hack/run-e2e-kind.sh # e2e on kind; add --preserve-cluster to keep it
go tool ginkgo -r --randomize-all --label-filter '!autoscale && !scale && !upgrade && !gitops' ./test/e2e/suites # CI e2e filter- Test files live next to the code and end in
_test.go. - Not every package is Ginkgo. Check for a
suite_test.gobefore usingginkgo.
Only what linters and gofmt do not enforce:
- Imports in three groups: stdlib, external, internal.
ctx context.Contextis the first parameter.- Comments explain why, not what. Keep them short, with no pronouns (
I,we). Do not add obvious comments. - New files need the Apache-2.0 + NVIDIA header (
make gen-license). - Add RBAC through kubebuilder markers, e.g.
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get, then runmake manifests. - Never hand-edit generated files (
zz_generated*, CRDs, RBAC templates,*_mock.go); change the source and runmake manifests generate-mocks. New mocks go in thegenerate-mockslist in theMakefile. - Logging follows the practices below. V(5+) scheduler logs must be guarded with
.Do(...).
Use log.InfraLogger for scheduler actions and phases. V(2-3) logs are operational; V(5+) logs are diagnostic and may run in scheduler hot paths.
Guard V(5+) scheduler logs with VerboseLogger.Do so disabled verbosity does not construct arguments or perform formatting:
log.InfraLogger.V(6).Do(func() {
log.InfraLogger.Infof("Task <%s/%s> allocatable on node <%s>",
task.Namespace, task.Name, node.Name)
})Create values used only by a V(5+) message inside the callback, including fmt.Sprintf, joins, detailed-error rendering, and stringification. Leave operational V(1-4) logs and controller-runtime contextual logs unchanged.
PR titles must follow the Conventional Commits title specification. The format is:
<type>[optional scope]: <description>
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that don't affect code meaning (formatting, whitespace)
- refactor: Code changes that neither fix a bug nor add a feature
- perf: Performance improvements
- test: Adding or updating tests
- build: Changes to build system or dependencies
- ci: Changes to CI/CD configuration
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit
The allowed scopes are listed in .github/workflows/validate-pr-title.yaml.
Breaking changes MUST be indicated by adding ! after the type/scope: feat(api)!: remove deprecated field
feat(scheduler): add GPU topology-aware scheduling
fix(binder): resolve race condition in pod binding
docs: update installation guide
refactor(api): simplify PodGroup status structure
feat(api)!: remove deprecated field from CRD
- Use the imperative mood: "add feature" not "added feature"
- Don't end with a period
Before introducing major changes, we strongly recommend opening a PR that outlines your proposed design. Each pull request should meet the following requirements:
- All tests pass – Run the full test suite locally with:
make build validate test - Test coverage – Add or update tests for any affected code.
- Documentation – Update relevant documentation to reflect your changes.
- Changes logged - If your changes warrant logging - like behavior changes (including bugfixes) or new features - run
make changelogto add a changelog fragment (do not editCHANGELOG.mddirectly). Use theskip-changeloglabel to opt out if not needed. - PR description – Fill out the pull request template completely
Need support or have a question? We're here to help:
- Report issues or ask questions by opening an issue on GitHub.
- Join the conversation in the #batch-wg Slack channel to connect with the community and contributors.
All commits must be signed off to certify you authored the change and agree to the DCO. Add -s to your commit command:
git commit -s -m "feat: my change"This appends a Signed-off-by: Your Name <your@email.com> line to the commit message.
Fixing unsigned commits:
# Amend the last commit
git commit --amend -s
# Sign all commits on your branch at once
git rebase --signoff origin/mainBy contributing, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for your interest and happy coding!