Skip to main content

Wrapper around https://github.com/kubernetes-client/python

Project description

openshift-python-wrapper (wrapper)

Pypi: openshift-python-wrapper
A python wrapper for kubernetes-python-client with support for RedHat Container Virtualization
Docs: openshift-python-wrapper docs

The wrapper offers a simple and intuitive interface for interacting with the API.
It standardizes how to work with cluster resources and offers unified resource CRUD (Create, Read, Update, and Delete) flows.
The wrapper also provides additional capabilities, such as resource-specific functionality that otherwise needs to be implemented by users.
The wrapper makes code easier to read and maintain over time.

One example of simplified usage is interacting with a container.
Running a command inside a container requires using Kubernetes stream, handling errors, and more.
The wrapper handles it all and provides simple and intuitive functionality.

Alt Text

Both developers or testers can use the wrapper. The code is modular and easy to maintain.
Instead of writing custom code for every API, you can use the wrapper that provides a consistent interface for interacting with APIs.
It saves time, avoids code duplications, and reduces the chance of errors.

Using Python capabilities, context managers can provide out-of-the-box resource creation and deletion,
and inheritance can be used to extend functionality for specific use cases.
Pytest fixtures can utilize the code for setup and teardown, leaving no leftovers.
Resources can even be saved for debugging.
Resource manifests and logs can be easily collected.

Installation

From source:

git clone https://github.com/RedHatQE/openshift-python-wrapper.git
cd openshift-python-wrapper
python setup.py install --user

From pypi:

pip install openshift-python-wrapper --user

Release new version

requirements

  • Export GitHub token
export GITHUB_TOKEN=<your_github_token>
sudo npm install --global release-it
npm install --save-dev @release-it/bumper

usage

  • Create a release, run from the relevant branch.
    To create a 4.11 release, run:
git checkout v4.11
git pull
release-it # Follow the instructions

docs

Hosted on readthedocs.io openshift-python-wrapper

PR dependency

For PR dependency we use dpulls
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:

export OPENSHIFT_PYTHON_WRAPPER_LOG_LEVEL=<LOG_LEVEL> # can be: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
  • By default some sensitive information is hashed in the logs, and if running with DEBUG the log output can be corrupted.
    In secure environments user can set OPENSHIFT_PYTHON_WRAPPER_HASH_LOG_DATA="false" environment variable to disable the log hashing.

    export OPENSHIFT_PYTHON_WRAPPER_HASH_LOG_DATA="false"
    

Proxy Enablement

This configuration allows the client to route traffic through a specified proxy server.

To enable proxy configuration for the client:

  1. Define either HTTPS_PROXY or HTTP_PROXY environment variable with your proxy URL:
export HTTPS_PROXY="http://proxy.example.com:8080"
# or
export HTTP_PROXY="http://proxy.example.com:8080"

Code check

We use pre-commit for code check.

pre-commit install

Some code examples locate at examples directory

Contribute to the project

To contribute new additions or changes to the project, please refer to the contribution guide first.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openshift_python_wrapper-11.0.58.tar.gz (8.7 MB view details)

Uploaded Source

File details

Details for the file openshift_python_wrapper-11.0.58.tar.gz.

File metadata

File hashes

Hashes for openshift_python_wrapper-11.0.58.tar.gz
Algorithm Hash digest
SHA256 f9d36392f12b06e44bfbcf39632eb0dc203980367ea70b91369d1d2fc1fc38fd
MD5 f3aab40f19904eede035d1d61d373b2e
BLAKE2b-256 d8b38667bfbadd6fb98bd39a9d81325aa9732809eff1896e95fd0898e2378e5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page