Thank you for contributing to our project!
Project maintainers
To get an overview of the project, read the README.
If you find a problem with the code, search if an issue already exists.
If you open a pull request to fix the problem, an issue will be automatically created.
If a related issue doesn't exist, you can open a new issue using a relevant issue form.
To contribute code to the project:
- Fork the project and work on your forked repository
- Before submitting a new pull request, make sure you have
prekinstalled
prek install- When submitting a pull request, make sure to fill all the required, relevant fields for your PR.
Make sure the title is descriptive and short. - If the fix is needed in a released version, once your pull request is merged, cherry-pick it to the relevant branch(s).
Add/cherry-pick <target branch to cherry-pick to>to the PR comment.
- Add typing to new code; typing is enforced using mypy
New resources MUST be added via the class generator — manual creation is not allowed.
Custom helper methods can be added below the end marker. The generated class structure must follow these rules:
- A new file named as the resource under
ocp_resources; If the resource name is composed of multiple words, separate them with an underscore. - A class named as the resource kind.
- Inherit from the relevant class; If the resource is cluster-scoped, inherit from
Resourceelse fromNamespacedResource. - API group:
- Under
ocp_resources.resource.Resource.ApiGroup - Resource's apiGroup (
apiVersionprefix) asapi_group
- Under
- A link to the resource's API reference.
- Implement
__init__function;
Define all the required arguments that are required to instantiate the new resource. Optional parameters may be added as well. - Implement
to_dictfunction.
Check ConfigMap and Node for reference.
Resource files created by class-generator use markers to separate generated from manual code:
- Start marker (line 1):
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md - End marker (inside class):
# End of generated code
Code between these markers is auto-generated and must NOT be modified manually.
To update generated code, use class-generator --kind <Kind> --overwrite --backup.
Custom code (helper methods, overrides) goes below the # End of generated code marker.
When building resource payloads (to_dict()), do NOT validate or block at code level (e.g., mutual exclusivity of fields).
If a payload can be sent to the API, send it — let the Kubernetes/OpenShift API server return the error.
Helper functions in resource classes (e.g., wait_for_rollout(), restart()) CAN perform validation and guarding as needed.