# 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
```shell
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.
```yaml
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
```commandline
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,
```commandline
{
"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"
}
```
Raw data
{
"_id": null,
"home_page": "",
"name": "k8s-deployment-status",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "openshift,ecs,kubernetes,deployment,status,devops,k8s,pod,container",
"author": "",
"author_email": "saltgen <sdnirvana94@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ea/cd/5f6b168bf20787b6a22d3e008d56991646dcbc43927b2e71da95be9a13d1/k8s_deployment_status-0.0.6.tar.gz",
"platform": null,
"description": "# Kubernetes Deployment Status\n\nRetrieves commit details from a GitHub API endpoint, deployment timestamp from Kubernetes API.\n\nIt encapsulates methods to interact with the APIs, handle retries, and extract relevant data from the API response.\n\nMost of the data is memoized as well to avoid unnecessary API calls.\n\n## Installation\n\n```shell\npip install k8s-deployment-status\n```\n### Package dependencies(auto-install):\n\n- kubernetes\n- requests\n\n## Usage\n\nTo use the package follow these steps,\n\n### Kubernetes Environment Variables\n\nSet necessary environment variables like so in your Kubernetes yaml file.\n\n```yaml\n env:\n - name: GITHUB_OWNER\n value: \"organisation/owner-name\"\n - name: GITHUB_REPO\n value: \"repo-name\"\n - name: GITHUB_DEPLOYMENT_BRANCH\n value: \"main\"\n - name: GITHUB_API_PAGE_SIZE\n value: \"5\"\n - name: GITHUB_API_MAXIMUM_RETRIES\n value: \"3\"\n```\nAll available options are mentioned above. GITHUB_OWNER, GITHUB_REPO are required.\n\nFeel free to check config.py for default values per variable.\n\n### Import and Actual usage\n\nImport package and respective class in the respective module\n\n```commandline\nfrom k8s_deployment_status import DeploymentStatus\n\n@app.route('/api/ros/v1/deployment_status', methods=['GET'])\n def deployment_status():\n deployment_status_data = DeploymentStatus().get()\n return jsonify(deployment_status_data)\n```\n\n## Response Data\n\nThe output object should look like so,\n\n```commandline\n{\n \"branch\": \"main\",\n \"commit_merged\": \"Thu, 15 Jun 2023 14:38:16 UTC\",\n \"commit_msg\": \"Add redis as required dependency\",\n \"commit_sha\": \"9c2ee47951a8d25c7aa1402998344c5470956eb7\",\n \"deployed_at\": \"Thu, 15 Jun 2023 18:59:25 UTC\"\n}\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Provides deployment status details for any Kubernetes pod",
"version": "0.0.6",
"project_urls": {
"homepage": "https://github.com/saltgen/k8s_deployment_status",
"issues": "https://github.com/saltgen/k8s_deployment_status/issues",
"repository": "https://github.com/saltgen/k8s_deployment_status"
},
"split_keywords": [
"openshift",
"ecs",
"kubernetes",
"deployment",
"status",
"devops",
"k8s",
"pod",
"container"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "57242ee966b8a7c0f46473a718ec62d09d139c20a021c6edd765102d1333dca3",
"md5": "0efdf1501bd33f8377a0eff685a98f80",
"sha256": "57a2747e425a6c46367feb384ad16e4bd7fda7e33da90c73abae2f9364df4ba6"
},
"downloads": -1,
"filename": "k8s_deployment_status-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0efdf1501bd33f8377a0eff685a98f80",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5644,
"upload_time": "2023-06-16T09:29:47",
"upload_time_iso_8601": "2023-06-16T09:29:47.153283Z",
"url": "https://files.pythonhosted.org/packages/57/24/2ee966b8a7c0f46473a718ec62d09d139c20a021c6edd765102d1333dca3/k8s_deployment_status-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eacd5f6b168bf20787b6a22d3e008d56991646dcbc43927b2e71da95be9a13d1",
"md5": "6cc377fccf86e770f9e5b08f1e03f0e0",
"sha256": "ff28479596e2ce066c0f26310388ecbd3a241d1d3365a62ed6b47baa212cd08a"
},
"downloads": -1,
"filename": "k8s_deployment_status-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "6cc377fccf86e770f9e5b08f1e03f0e0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4776,
"upload_time": "2023-06-16T09:29:48",
"upload_time_iso_8601": "2023-06-16T09:29:48.484557Z",
"url": "https://files.pythonhosted.org/packages/ea/cd/5f6b168bf20787b6a22d3e008d56991646dcbc43927b2e71da95be9a13d1/k8s_deployment_status-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-16 09:29:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "saltgen",
"github_project": "k8s_deployment_status",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "k8s-deployment-status"
}