Kubernetes Deployment Status
Retrieves commit details from a GitHub API endpoint, deployment timestamp from Kubernetes API.
It encapsulates methods to interact with the APIs, handle retries, and extract relevant data from the API response.
Most of the data is memoized as well to avoid unnecessary API calls.
Installation
pip install k8s-deployment-status
Package dependencies(auto-install):
- kubernetes
- requests
Usage
To use the package follow these steps,
Kubernetes Environment Variables
Set necessary environment variables like so in your Kubernetes yaml file.
env:
- name: GITHUB_OWNER
value: "organisation/owner-name"
- name: GITHUB_REPO
value: "repo-name"
- name: GITHUB_DEPLOYMENT_BRANCH
value: "main"
- name: GITHUB_API_PAGE_SIZE
value: "5"
- name: GITHUB_API_MAXIMUM_RETRIES
value: "3"
All available options are mentioned above. GITHUB_OWNER, GITHUB_REPO are required.
Feel free to check config.py for default values per variable.
Import and Actual usage
Import package and respective class in the respective module
from k8s_deployment_status import DeploymentStatus
@app.route('/api/ros/v1/deployment_status', methods=['GET'])
def deployment_status():
deployment_status_data = DeploymentStatus().get()
return jsonify(deployment_status_data)
Response Data
The output object should look like so,
{
"branch": "main",
"commit_merged": "Thu, 15 Jun 2023 14:38:16 UTC",
"commit_msg": "Add redis as required dependency",
"commit_sha": "9c2ee47951a8d25c7aa1402998344c5470956eb7",
"deployed_at": "Thu, 15 Jun 2023 18:59:25 UTC"
}
Metadata
Release files for k8s-deployment-status 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| k8s_deployment_status-0.0.6.tar.gz | 4.8 kB | Without provenance | Details for k8s_deployment_status-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| k8s_deployment_status-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for k8s_deployment_status-0.0.6-py3-none-any.whl |
Total release size: 10.4 kB
Release files / k8s_deployment_status-0.0.6.tar.gz
| Download URL | k8s_deployment_status-0.0.6.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff28479596e2ce066c0f26310388ecbd3a241d1d3365a62ed6b47baa212cd08a
|
|
BLAKE2b-256 checksum How to use checksums |
eacd5f6b168bf20787b6a22d3e008d56991646dcbc43927b2e71da95be9a13d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / k8s_deployment_status-0.0.6-py3-none-any.whl
| Download URL | k8s_deployment_status-0.0.6-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57a2747e425a6c46367feb384ad16e4bd7fda7e33da90c73abae2f9364df4ba6
|
|
BLAKE2b-256 checksum How to use checksums |
57242ee966b8a7c0f46473a718ec62d09d139c20a021c6edd765102d1333dca3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for k8s-deployment-status 0.0.6
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.