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 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_GITHUB_USERNAME OCL_GITHUB_USERNAME_COMMAND | Your GitHub username | |
OCL_GITHUB_PASSWORD OCL_GITHUB_PASSWORD_COMMAND | Your GitHub password (e.g. command op read op://Private/Github/password ) |
|
OCL_GITHUB_TOTP OCL_GITHUB_TOTP_COMMAND | Your GitHub two factor token (e.g. command op item get Github --otp ) |
|
OCL_RH_USERNAME OCL_RH_USERNAME_COMMAND | Your Red Hat username | |
OCL_RH_PASSWORD OCL_RH_PASSWORD_COMMAND | Your Red Hat password (e.g. command op read op://Private/RH/password ) |
|
OCL_RH_TOTP OCL_RH_TOTP_COMMAND | Your Red Hat two factor token (e.g. command op item get RH --otp ) |
|
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 | |
USER_CLUSTERS USER_CLUSTERS_COMMAND | User defined clusters as json format (e.g. [{"name": "local-kind", "serverUrl": "https://localhost:6443", "consoleUrl": "not available}] ) |
"[]" |
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
- MacOS only
- Only Selenium
webdriver.Chrome
is supported and must be installed manually$ brew install --cask chromedriver
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
File details
Details for the file openshift_cluster_login-0.12.4.tar.gz
.
File metadata
- Download URL: openshift_cluster_login-0.12.4.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.15.0-1031-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c41649bde21b2bfe1831d49896dbf0a6a7c991efc35da589168b10c693ad25b |
|
MD5 | f07593ef5f65bc9425010d2c44261aa8 |
|
BLAKE2b-256 | 0307f1e9110dd685555e9cccf9caf5a83db962609496554050be1700c1738ffd |
File details
Details for the file openshift_cluster_login-0.12.4-py3-none-any.whl
.
File metadata
- Download URL: openshift_cluster_login-0.12.4-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.15.0-1031-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea9d8eba2bce2e53f715442a288cfc83eeddf014f14e3d02822e7032e8bf21ac |
|
MD5 | 4b57edebdb9b71f21678f1e87e9491e6 |
|
BLAKE2b-256 | 60d4215fc47acb8a8925940ff817de09317ccad7cad89988667c67542b140115 |