Thanks for your interest in the TrustyAI operator project! You can contribute to this project in various ways: filing bug reports, proposing features, submitting pull requests (PRs), and improving documentation.
Before you begin, please take a look at our contribution guidelines below to ensure that your contribuutions are aligned with the project's goals.
Issues are tracked using Github. If you encounter a bug or have suggestions for enhancements, please follow the steps below:
- Check for Existing Issues: Before creating a new issue, search the Github project to see if a similar issue already exists.
- Create a Github issue: If the issue doesn’t exist, create a new ticket in Github.
- For Feature Requests: Set the label as
feature - For Bugs: Set the label to
kind/bug - For all other code changes: Use the issue type
kind/enhancement - Add to the "TrustyAI planning" in "Projects"
- And specify "Component" as "Operator"
- For Feature Requests: Set the label as
- Fork the Repository: Create your own fork of the repository to work on your changes.
- Create a Branch: Create your own branch to include changes for the feature or a bug fix off of
mainbranch. - Work on Your Changes: Commit often, and ensure your code passes all the test for the operator.
- Testing: Make sure your code passes all the tests, including any new tests you've added. And that your changes do not decrease the test coverage as shown on report. Every new feature should come with unit tests that cover that new part of the code.
- Link to Github Issue: Include the Github issue link in your PR description.
- Description: Provide a detailed description of the changes and what they fix or implement.
- Add Testing Steps: Provide information on how the PR has been tested, and list out testing steps if any for reviewers.
- Review Request: Tag the relevant maintainers(
@trustyai-explainability/developers) for a review. - Resolve Feedback: Be open to feedback and iterate on your changes.
To ensure the contributed code adheres to the project goals, we have set up some automated quality gates:
- linters: Ensure the check for linters is successful.
- manifest policy check: Ensure rendered manifests pass all OPA policies (see
policy/README.md). - smoke tests: Ensure the operator passes the smoke tests
- unit-tests: Ensure unit tests pass.
- operator-chaos: Ensure no breaking upgrade changes are introduced.
- e2e-tests: Ensure OpenShift CI job for e2e tests pass.
This operator uses operator-chaos for shift-left upgrade validation. A GitHub Actions workflow runs on every PR that touches operator code, CRDs, or the knowledge model to catch breaking changes before merge.
What it checks:
- Knowledge model validity and structural regressions
- CRD schema breaking changes across all 5 CRDs
- Simulated upgrade dry-run
Maintaining the knowledge model:
The knowledge model at chaos/knowledge/trustyai.yaml describes the operator's control plane topology. Update it when:
- Adding or removing RBAC resources
- Renaming the operator deployment or service account
- Changing the leader election lease name
- Adding new operator-level resources (not per-CR workloads)
# Validate locally
go install github.com/opendatahub-io/operator-chaos/cmd/operator-chaos@9e6ac9668b9aaca2f0f2ddf169867862b7925b80
operator-chaos validate --knowledge chaos/knowledge/trustyai.yaml
operator-chaos preflight --knowledge chaos/knowledge/trustyai.yaml --localRendered kustomize manifests are checked against OPA/Rego policies in policy/ using Conftest. The CI workflow tests all kustomize entry points (base + every overlay).
Current policies:
- RBAC allowlist (
policy/rbac.rego): a closed allowlist of expectedClusterRoleBindingresources. Any new or unexpected CRB will fail CI.
If your PR introduces a new ClusterRoleBinding:
- Add the post-kustomize CRB name and its expected
ClusterRoletoexpected_crbsinpolicy/rbac.rego. - Run
make policy-checklocally to verify. - Explain in the PR description why a
ClusterRoleBindingis required rather than a namespace-scopedRoleBinding.
See policy/README.md for full details on running and extending policies.
# Run locally
make policy-test # OPA unit tests
make policy-check # Full check against all overlays- Follow the Go community’s best practices, which can be found in the official Effective Go guide.
- Follow the best practices defined by the Operator SDK.
- Use
go fmtto automatically format your code. - Ensure you write clear and concise comments, especially for exported functions.
- Always check and handle errors appropriately. Avoid ignoring errors by using _.
- Make sure to run
go mod tidybefore submitting a PR to ensure thego.modandgo.sumfiles are up-to-date.
We follow the conventional commits format for writing commit messages. A good commit message should include:
- Type:
fix,feat,docs,chore, etc. Note: Allfixandfeatcommits require an associated issue. Please add link to your Github issue.- Security fixes should be in the format
fix(CVE-xxx):
- Security fixes should be in the format
- Scope: A short description of the area affected.
- Summary: A brief explanation of what the commit does.
For general questions, feel free to open a discussion in our repository or communicate via:
- Comments: Feel free to discuss issues directly on Github issues.
- Discussions: Alternatively, use Github discussions