Skip to main content

logo

OCL (OpenShift Login)

PyPI PyPI platforms PyPI - License Release and Package Application

OCL does an automatic login to an OpenShift cluster. It fetches cluster information from app-interface and performs a login via Red Hat SSO.

Installation

You can install this tool from PyPI with pip:

python3 -m pip install openshift-cluster-login

or install it with uv:

uv tool install openshift-cluster-login

You can also use uv to run the tool without installing it:

uvx openshift-cluster-login

Usage

Interactive login

ocl

This spawns a new shell with the following environment variables set:

  • KUBECONFIG - path to kubeconfig file
  • OCL_CLUSTER_NAME - cluster name
  • OCL_CLUSTER_CONSOLE - url to cluster console

kubectl exec credential plugin

OCL can act as a kubectl exec credential plugin, allowing kubectl to transparently fetch and refresh credentials without a separate login step.

One-time setup:

ocl --import-cluster <cluster>

This adds the cluster to ~/.kube/config and creates a shared ocl user entry (if not already present) that all imported contexts reference. After that, any kubectl command against the cluster works directly — OCL handles authentication in the background.

To import all clusters at once:

ocl --import-clusters

Use --overwrite to update existing entries.

How it works:

kubectl calls ocl --get-token whenever it needs credentials. OCL reads the cluster's server URL from the KUBERNETES_EXEC_INFO environment variable that kubectl sets, looks up the matching cluster, checks its token cache, validates via oc whoami if needed, re-authenticates if expired, and returns an ExecCredential JSON. Tokens are cached and revalidated at most once every 5 minutes to avoid per-command overhead.

Because all imported contexts share a single ocl user entry, running ocl --import-clusters is a true one-time setup — no per-cluster credential configuration required.

Features

OCL currently provides the following features (get help with --help):

  • OpenShift console login (oc login) via GitHub or Red Hat authentication
  • kubectl exec credential plugin (--get-token, --import-cluster, --import-clusters)
  • Get cluster and namespace information from app-interface or user-defined (OCL_USER_CLUSTERS)
  • Open the OpenShift console in the browser (--open-in-browser)
  • Star your most often used namespaces Ctrl+S in the UI
  • Shell completion (--install-completion, --show-completion)
  • Credentials via environment variables or shell command (e.g., 1password CLI)
  • Cache App-Interface queries (via GraphQL) for one week

Environment Variables

Variable Name Description Default
OCL_APP_INTERFACE_URL OCL_APP_INTERFACE_URL_COMMAND App-Interface URL
OCL_APP_INT_TOKEN OCL_APP_INT_TOKEN_COMMAND App-Interface authentication token [optional]
OCL_USER_CLUSTERS OCL_USER_CLUSTERS_COMMAND User defined clusters as json format (e.g. [{"name": "local-kind", "serverUrl": "https://localhost:6443", "consoleUrl": "not available}]) "[]"
OCL_CACHE_TIMEOUT_MINUTES GraphQL cache timeout in minutes 1 hour
OCL_HISTORY Enable/Disable the usage of the last selected namespace enabled
OCL_CSS_PATH Path to custom Textual CSS file

You can either set a variable, e.g. export OCL_GITHUB_USERNAME="mail@example.com" or retrieve it via a command, e.g. export OCL_GITHUB_USERNAME_COMMAND="op read op://Private/Github/username". If a variable is not set but needed, OCL will ask for it interactively.

App-Interface

OCL retrieves the cluster information from app-interface via GraphQL (OCL_APP_INTERFACE_URL) and caches them in your user cache directory (on MacOS, e.g., ~/Library/Caches/ocl/gql_cache/). Remove this directory to force a refresh.

Limitations

  • Kerberos authentication only
  • Works only with a Red Hat associate account

Development

Code style: black Checked with mypy

Metadata

Release files for openshift-cluster-login 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openshift-cluster-login 1.5.1
File Size Uploaded Provenance Actions
openshift_cluster_login-1.5.1.tar.gz 15.2 kB Without provenance Details for openshift_cluster_login-1.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openshift-cluster-login 1.5.1
File Interpreter ABI Platform Actions
openshift_cluster_login-1.5.1-py3-none-any.whl Python 3 none any Details for openshift_cluster_login-1.5.1-py3-none-any.whl

Total release size: 33.9 kB

Release files / openshift_cluster_login-1.5.1.tar.gz

Download URL openshift_cluster_login-1.5.1.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7db39481dec358b6bd2b2ced1b0c2ca6e709caea5c8255e3ec4ea05c48228297
BLAKE2b-256 checksum
How to use checksums
61f5a9b3f4bb49172f1892d89afa472d562227e5de0e041d19b7b04bdc2d59eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / openshift_cluster_login-1.5.1-py3-none-any.whl

Download URL openshift_cluster_login-1.5.1-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd8d18de09cb154f21f927f9d93e42d8b3feedf92b8d3b5b610cac62b03494d5
BLAKE2b-256 checksum
How to use checksums
0c908682bf5941d631f53a2994f5347c869f21ee68e6642e04e62cf3741ce4ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for openshift-cluster-login 1.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page