Openshift cluster login on command line
Project description
OCL (OpenShift Login)
OCL does an automatic login to an OpenShift cluster. It fetches cluster information from app-interface and performs a login via Selenium.
Installation
You can install this library from PyPI with pip
:
python3 -m pip install openshift-cluster-login
or install it with pipx
:
pipx install openshift-cluster-login
You can also use pipx
to run the library without installing it:
pipx run openshift-cluster-login
Usage
ocl
This spawns a new shell with the following environment variables are set:
KUBECONFIG
- path to kubeconfig fileOCL_CLUSTER_NAME
- cluster nameOCL_CLUSTER_CONSOLE
- url to cluster console
Features
OCL currently provides the following features (get help with -h
or --help
):
- OpenShift console login (
oc login
) via GitHub or Red Hat authentication - Get cluster and namespace information from app-interface or user-defined (
OCL_USER_CLUSTERS``) _ Open the OpenShift
console inthe
browser`` (--open-in-browser
) - 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_WAIT OCL_WAIT_COMMAND | Selenium webdriver wait timeout | 2 |
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 |
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
Use Conventional Commit messages. The most important prefixes you should have in mind are:
fix:
which represents bug fixes, and correlates to a SemVer patch.feat:
which represents a new feature, and correlates to a SemVer minor.feat!:
, orfix!:
,refactor!:
, etc., which represent a breaking change (indicated by the!
) and will result in a SemVer major.chore: release
to create a new release
Consider using an empty commit:
git commit --allow-empty -m "chore: release"
When a commit to the main branch has Release-As: x.x.x
(case insensitive) in the commit body, Release Please will open a new pull request for the specified version.
git commit --allow-empty -m "chore: release 2.0.0" -m "Release-As: 2.0.0"
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
Built Distribution
Hashes for openshift_cluster_login-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e34dc3822ccadebf08aa6921e761561fc3fae314e9b30c7aeb5de690d66212f2 |
|
MD5 | 248bab5a97929a3c204bcc505ed97fbe |
|
BLAKE2b-256 | 15c588a956041144d0b78f51e40034348074433fb61000c5b9ae4ff139c90762 |
Hashes for openshift_cluster_login-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5476c10007096332b5aa166f71edce37c07f5446420ff2aa8a09895310e8c730 |
|
MD5 | 0c06e5d533efbc48a45b427d0b1654dd |
|
BLAKE2b-256 | ca9211493c1c77bba5811a43cfe81ea5717e381b38662e351c75b0df9a0eea13 |