Skip to main content

Kubectl wrapper in Python with OAuth token auth

Project description

Zalando Kubectl

Description

PyPI Downloads

Latest PyPI version License

Kubernetes CLI (kubectl) wrapper in Python with OAuth token authentication.

This wrapper script zkubectl serves as a drop-in replacement for the kubectl binary:

  • it downloads the current kubectl binary from Google
  • it generates a new ~/.kube/config with an OAuth Bearer token acquired via zign.
  • it passes through commands to the kubectl binary

User Facing documentation

Contribute

Setup project

  • It's recommended to use uv for the project.

Go to the project dir and install dependencies with uv

$ cd <project-path>
$ uv sync
  • [Optional] install pre-commit hooks
$ pre-commit install
  • [Optional] The project uses ruff for code formatting, configure your editor to use it.

Unit Tests

Run unit tests with Docker:

docker build --build-arg PYTHON_VERSION=3.10 --build-arg PACKAGE_NAME=zalando_kubectl -f Dockerfile.test .
docker build --build-arg PYTHON_VERSION=3.11 --build-arg PACKAGE_NAME=zalando_kubectl -f Dockerfile.test .
docker build --build-arg PYTHON_VERSION=3.12 --build-arg PACKAGE_NAME=zalando_kubectl --build-arg DEBIAN_DISTRO=bullseye -f Dockerfile.test .
docker build --build-arg PYTHON_VERSION=3.13 --build-arg PACKAGE_NAME=zalando_kubectl --build-arg DEBIAN_DISTRO=bullseye -f Dockerfile.test .

Run Locally

via uv

$ uv run zkubectl

Or first activate the virtualenv

$ source .venv/bin/activate
$ zkubectl login playground

Use as kubectl plugin

The project exposes scripts that use the kubectl plugin format

You can see which ones are available in the scripts section of pyproject.toml

In order for kubectl to detect the subcommands provided by the script, they must be in the PATH, so you need first to activate the virtualenv

$ source .venv/bin/activate
$ kubectl login playground

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

zalando_kubectl-1.35.3.373.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zalando_kubectl-1.35.3.373-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file zalando_kubectl-1.35.3.373.tar.gz.

File metadata

  • Download URL: zalando_kubectl-1.35.3.373.tar.gz
  • Upload date:
  • Size: 50.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for zalando_kubectl-1.35.3.373.tar.gz
Algorithm Hash digest
SHA256 36cfe932f3e2937b70f9292d0f9d7d3e0250f31a3b39dbe8da9e43ff2ccd99b3
MD5 eaad8bd7bbcd5737a957e2c0c38d570c
BLAKE2b-256 d8ab0fce59f7c67f68cbd55e97b7ec7601a677ff1144f4f7fa3a0e7b3d47a69b

See more details on using hashes here.

File details

Details for the file zalando_kubectl-1.35.3.373-py3-none-any.whl.

File metadata

  • Download URL: zalando_kubectl-1.35.3.373-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for zalando_kubectl-1.35.3.373-py3-none-any.whl
Algorithm Hash digest
SHA256 29f0c6db3aef0461e5155f2e6cc90efa3e8db7a3d70204c53d1fcdd36001446a
MD5 1c9ccad99c54cd4bf3346ca63de9fb35
BLAKE2b-256 21004f98988f1ed9560a16531707b4aeb32092e0c6c5248fee3933d43baec30d

See more details on using hashes here.

Supported by

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