-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add Contribution 101 #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Contribution 101 #1031
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,62 @@ Please fill out either the individual or corporate Contributor License Agreement | |
|
||
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests. | ||
|
||
## Composition of This Repository and Where/How to Contribute | ||
|
||
The repository of the Kubernetes Python client consists of this main repository and a submodule, the [python-base](https://github.com/kubernetes-client/python-base) repository. The main repository contains mostly files that are generated by the OpenAPI generator from [this OpenAPI spec](scripts/swagger.json). The base repo is the utility part of the python client and allows developers to create their own kubernetes clients. | ||
|
||
### Where to Submit Your Patch | ||
|
||
These folders are automatically generated. You will need to submit a patch to the upstream kubernetes repo [kubernetes](https://github.com/kubernetes/kubernetes) or the OpenAPI generator repo [openapi-generator](https://github.com/OpenAPITools/openapi-generator). This contains: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you clarify "These folders" -- I think "The following folders are automatically generated" would work, and then you can remove the "This contains:" part. Minor nitpick, but "kubernetes repo" should be uppercased. |
||
[kubernetes/client](kubernetes/client), [kubernetes/test](kubernetes/test), [kubernetes/docs](kubernetes/docs). | ||
roycaihw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
These folders contain developer written codes in the main repo and the patches should be submitted here: | ||
[kubernetes/e2e_test](kubernetes/e2e_test), [kubernetes/utils](kubernetes/utils), [examples](examples), [scripts](scripts). | ||
|
||
The base repo contains developer written codes only. The patches should be sent to the base repo instead. The scope covers these repos and symbolic links in the main repo: | ||
kubernetes/base, kubernetes/config, kubernetes/stream, kubernetes/watch. | ||
roycaihw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Contributing A Patch | ||
|
||
1. Submit an issue describing your proposed change to the repo in question. | ||
1. The [repo owners](OWNERS) will respond to your issue promptly. | ||
1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above). | ||
1. Fork the desired repo, develop and test your code changes. | ||
1. Submit a pull request. | ||
2. The [repo owners](OWNERS) will respond to your issue promptly. | ||
3. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above). | ||
4. Fork the desired repo, develop and test your code changes. Add a test if possible. | ||
5. Submit a pull request. | ||
|
||
### Adding Dependencies | ||
|
||
If your patch depends on new packages, add those packages to [requirements.txt](requirements.txt) and [setup.py](setup.py). | ||
If your patch depends on new packages, add those packages to [requirements.txt](requirements.txt) and/or [setup.py](setup.py). If these package are for testing only, add those to [test-requirements.txt](test-requirements.txt). | ||
|
||
### Commits | ||
|
||
Generally we would like to see one commit per pull request. However, if the pull request is reasonably large, the PR can be divided into several commits that make logical sense. The commit message should be clear and indicative of the aim of the fix. | ||
|
||
If you have several commits in a pull request and have been asked to squash your commits, please use ```git reset --soft HEAD~N_COMMITS``` and commit again to make your PR a single commit. | ||
|
||
### Windows Developers | ||
|
||
The symbolic links contained in this repo does not work for Windows operating systems. If you are a Windows developer, please run the [fix](scripts/windows-setup-fix.bat) inside the scripts folder or manually copy the content of the [kubernetes/base](https://github.com/kubernetes-client/python-base) folder into the [kubernetes](kubernetes) folder. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor nitpick: "does not work" should be "do not work". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! All other comments look good to me, but the kubernetes/base folder is what the Windows development sees after they clone the repo. This part is unchanged. |
||
|
||
### Writing Tests | ||
|
||
In addition to running the your fix yourself and tell us that your fix works, you can demonstrate that your fix really works by using unit tests. These unit tests are mainly located in three places. You should put your tests into the places that they fit in. | ||
roycaihw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. [Generated tests](kubernetes/test) by OpenAPI generator: these tests should pass and do not require modification. | ||
2. [End to end tests](kubernetes/e2e_test): these are tests that can only be verified with a live kubernetes server. | ||
3. Base repo tests in the [base](https://github.com/kubernetes-client/python-base) repo, in which the test files are named ```test_*.py```: These tests use the package ```Mock``` and confirms the functionality of the base repo files. | ||
|
||
### Coding Style | ||
|
||
We use an automatic coding style checker by using the ```diff``` of the autopep8 output and your code file. To make sure that your code passes the coding style checker, run ```autopep8 --in-place --aggressive --aggressive your_code.py``` before committing and submission. | ||
|
||
## Running Tests Locally | ||
|
||
If you write a new end to end (e2e) test, or change behaviors that affect e2e tests, you should set up a local cluster and test them on your machine. The following steps will help you run the unit tests. | ||
|
||
1. Acquire a local cluster. [Minikube](https://github.com/kubernetes/minikube) is a good choice for Windows and Linux developers. Alternatively if you are on Linux, you can clone the [kubernetes](https://github.com/kubernetes/kubernetes) and run [install-etcd.sh](https://github.com/kubernetes/kubernetes/blob/master/hack/install-etcd.sh) and then [local-up-cluster.sh](https://github.com/kubernetes/kubernetes/blob/master/hack/local-up-cluster.sh) to get a local cluster up and running. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where it says, "you can clone the kubernetes and..." I think you forgot to add "repo" at the end. |
||
|
||
2. Run the unit tests. In the root directory of the main repo, run ```python -m unittest discover```. | ||
|
||
3. Check the test results and make corresponding fixes. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The repository of the Kubernetes Python client consists of this main repository" might be better as "The Kubernetes Python client consists of this main repository, the python"
Also in the last sentence, by "base repo" I think you mean python-base which you refer to above as "submodule". It might be clearer to someone new if you keep the terms consistent.