Skip to main content

Kubernetes Port-Forward Go-Edition For Python

Project description

portforward

https://img.shields.io/pypi/v/portforward.svg https://img.shields.io/pypi/status/portforward.svg Documentation Status

Kubernetes Port-Forward Go-Edition For Python

Quickstart

import requests

import portforward


def main():
    namespace = "test"
    pod_name = "web"
    local_port = 9000  # from port
    pod_port = 80  # to port

    # No path to kube config provided - will use default from $HOME/.kube/config
    with portforward.forward(namespace, pod_name, local_port, pod_port):
        response = requests.get("http://localhost:9000")
        print(f"Done: \n'{response.status_code}'\n'{response.text[:20]}...'")


if __name__ == "__main__":
    main()

Features

  • Go native Kubernetes port-forwarding with the .kube/config from the home dir or any other path to config.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

This project is enabled by setuptools-golang.

History

0.2.4 (2021-08-23)

  • Added adal import for Azure AD

  • Fixed host IPs with paths

  • Made timeout flexible

0.2.3 (2021-08-23)

  • Fixed case when hostIP contains a path

  • Added common and cloud provider auth plugins

0.2.2 (2021-08-23)

  • Fixed missing module portforward

0.2.1 (2021-08-19)

  • Decrease binary size if pre-compile wheels (Improvement of setuptools-golang)

0.2.0 (2021-08-14)

  • First Release on PyPI.

  • Made path to kube config variable.

  • Port-forwarding became non-blocking.

  • Fixed verification bug when port was None.

  • Added throwing own error.

0.1.0 (2021-08-09)

  • First release on Test PyPI.

  • Blocking port-forward with fixed path for kube config.

Project details


Download files

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

Source Distribution

portforward-0.2.4.tar.gz (41.3 kB view hashes)

Uploaded Source

Built Distributions

portforward-0.2.4-cp39-cp39-win_amd64.whl (8.9 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

portforward-0.2.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (10.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

portforward-0.2.4-cp39-cp39-macosx_10_14_x86_64.whl (9.3 MB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

portforward-0.2.4-cp38-cp38-win_amd64.whl (8.9 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

portforward-0.2.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (10.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

portforward-0.2.4-cp38-cp38-macosx_10_14_x86_64.whl (9.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

portforward-0.2.4-cp37-cp37m-win_amd64.whl (8.9 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

portforward-0.2.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (10.0 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

portforward-0.2.4-cp37-cp37m-macosx_10_14_x86_64.whl (9.3 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

portforward-0.2.4-cp36-cp36m-win_amd64.whl (8.9 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

portforward-0.2.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (10.0 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.5+ x86-64

portforward-0.2.4-cp36-cp36m-macosx_10_14_x86_64.whl (9.3 MB view hashes)

Uploaded CPython 3.6m macOS 10.14+ x86-64

Supported by

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