This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Before you can build and test this project, you'll need to have the following installed:
- Go (version 1.23 or higher, as specified in the
Dockerfile) - Docker (for building container images)
- Make
controller-gen,golangci-lint,kustomize,setup-envtest(these can often be installed via the Makefile, e.g.,make controller-gen golangci-lint)
This project uses make to streamline common development tasks.
make allormake build: Builds the manager binary. This also runs code generation, formatting, and vetting.make run: Runs the controller locally on your host.make docker-build: Builds the Docker image for the manager.- You can specify the image name and tag using the
IMGvariable:make docker-build IMG=myregistry/mycontroller:latest
- You can specify the image name and tag using the
make docker-push: Pushes the built Docker image to a container registry.- Ensure
IMGis set to the desired repository.
- Ensure
make manifests: Generates Kubernetes manifest files (CRDs, RBAC, Webhook configurations) usingcontroller-gen.make generate: Generates Go code, such as DeepCopy methods, usingcontroller-gen.
For a complete list of build targets and their descriptions, run make help.
To maintain code quality and consistency, please adhere to the following conventions:
- Go Formatting: Run
make fmtto format your Go code according to standard Go style. - Go Vet: Run
make vetto catch suspicious constructs. - Linting: Run
make lintto check for a wide range of issues usinggolangci-lint. The configuration forgolangci-lintis located in.golangci.yml.- Key linters enabled include
errcheck,gofmt,goimports,govet,staticcheck,unused, and others. Please refer to.golangci.ymlfor the full list. - You can attempt to automatically fix some linting issues with
make lint-fix.
- Key linters enabled include
- Ensure that any changes to API types (
api/**/*.go) are followed by runningmake generateandmake manifeststo update generated code and Kubernetes manifests. Commit these generated files along with your changes.
- All Go source files must include the license header provided in
hack/boilerplate.go.txt. This project uses the Apache License 2.0.
- Unit Tests: Run
make testto execute unit tests. - Integration Tests: Run
make test-integrationfor integration tests. - End-to-End (E2E) Tests: Run
make test-e2efor E2E tests. Ensure your Kind cluster is set up as per the project's requirements.
Write new tests for new features and ensure existing tests pass before submitting a pull request.
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes, adhering to the coding conventions and including tests.
- Ensure all tests pass (
make test test-integration test-e2e). - Ensure the code is formatted and linted (
make fmt lint). - Commit your changes with clear and concise commit messages.
- Push your branch to your fork.
- Open a pull request against the main repository.
- Ensure the CLA bot checks are addressed.