Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ docs/source/rst

# General
local-cluster/_hco/

# nmp
node_modules/
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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=<your_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 #<PR NUMBER>` in the PR description.

## Logging configuration
To change log level export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL:

```bash
export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL=<LOG_LEVEL> # can be: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
```

## Examples
### Client
Expand Down Expand Up @@ -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
Expand Down