Giter VIP home page Giter VIP logo

k8s_deployment_status's Introduction

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"
}

k8s_deployment_status's People

Contributors

saltgen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.