diff --git a/.gitignore b/.gitignore index e9ef8640fb..960e210919 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,6 @@ docs/source/rst # General local-cluster/_hco/ + +# nmp +node_modules/ diff --git a/README.md b/README.md index dc833f89b2..6267922f91 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # openshift-python-wrapper -A python wrapper for https://github.com/openshift/openshift-restclient-python. - -With support for RedHat Container Virtualization. (Openshift Virtualization) https://www.openshift.com/learn/topics/virtualization/ +Pypi: [openshift-python-wrapper](https://pypi.org/project/openshift-python-wrapper) +A python wrapper for [openshift-restclient-python](https://github.com/openshift/openshift-restclient-python) with support for RedHat Container Virtualization. ([Openshift Virtualization](https://www.openshift.com/learn/topics/virtualization)) +Docs: [openshift-python-wrapper docs](https://openshift-python-wrapper.readthedocs.io/en/latest/) ## Installation From source: @@ -10,6 +10,44 @@ git clone https://github.com/RedHatQE/openshift-python-wrapper.git cd openshift-python-wrapper python setup.py install --user ``` +From pypi: +```bash +pip install openshift-python-wrapper --user +``` + +## Release new version +### requirements: +* Export GitHub token +```bash +export GITHUB_TOKEN= +``` +* [release-it](https://github.com/release-it/release-it) +```bash +sudo npm install --global release-it +npm install --save-dev @j-ulrich/release-it-regex-bumper +rm -f package.json package-lock.json +``` +### usage: +* Create a release, run from the relevant branch. +To create a 4.10 release, run: +```bash +git checkout v4.10 +release-it # Follow the instructions +``` + +## docs +Hosted on readthedocs.io [openshift-python-wrapper](https://openshift-python-wrapper.readthedocs.io/en/latest/) + +## PR dependency +For PR dependency we use [dpulls](https://www.dpulls.com/) +To make PR depends on other PR add `depends on #` in the PR description. + +## Logging configuration +To change log level export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL: + +```bash +export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL= # can be: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" +``` ## Examples ### Client @@ -98,6 +136,21 @@ command_output = test_vmi.virt_launcher_pod.execute(command="command-example") ``` If no Pod was found, will raise ``ResourceNotFoundError``. +### NNCP Capture Syntax +Using capture syntax to switch ipv4 config between interfaces +```python +with NodeNetworkConfigurationPolicy( + name="capture_nncp", + capture={'first-nic': 'interfaces.name=="ens8"', + 'second-nic': 'interfaces.name=="ens9"'}, + teardown=False, # Capture doesn't support reverting config on teardown + ... +) as nncp: + nncp.add_interface(name="{{ capture.first-nic.interfaces.0.name }}", set_ipv4="{{ capture.second-nic.interfaces.0.ipv4 }}") + nncp.add_interface(name="{{ capture.second-nic.interfaces.0.name }}", set_ipv4="{{ capture.first-nic.interfaces.0.ipv4 }}") + yield nncp +``` + ## Code check We use pre-commit for code check. ```bash