Skip to main content

Kubernetes Resource Restarter

Project description

Kubernetes-Restarter

Kubernetes-Restarter (kres) is a CLI tool for safely restarting Kubernetes resources (pods, deployments, statefulsets) based on secret or configmap changes.

Features

  • Restart pods, deployments, or statefulsets referencing specific secrets/configmaps
  • Check access permissions for Kubernetes resources
  • Modular, extensible CLI structure
  • Colorful logging with multiple log levels

Installation

  1. Clone the repository:

    git clone https://github.com/ShashankPalla2002/Kubernetes-Restarter.git
    cd Kubernetes-Restarter
    
  2. Install dependencies:

    pip install -r requirements.txt
    

Usage

Run the CLI tool:

python -m kres.main <command> [options]

Commands

  • init
    Initialize with a kubeconfig and start the Kres API.

    python -m kres.main init --kubeconfig ~/.kube/config --port 5454 --log INFO
    
  • logout
    Logout and clear session data.

    python -m kres.main logout --log INFO
    
  • api
    Check status of Kres API or Kubernetes API.

    python -m kres.main api --type kres --log INFO
    python -m kres.main api --type kubernetes --log INFO
    
  • access
    Check if kres can access a resource in a namespace.

    python -m kres.main access --namespace default --resource pods --verb get --log INFO
    
  • restart
    Restart resources referencing a secret/configmap.

    python -m kres.main restart --namespace default --resource deployments --all --secret mysecret --reason "Secret updated" --log INFO
    python -m kres.main restart --namespace default --resource pods --name mypod --log INFO
    

Configuration

  • Kubeconfig:
    By default, kres uses ~/.kube/config. You can specify a different path with --kubeconfig.
  • Port:
    Kres API runs on port 5454 by default. Use --port to change.

Logging

  • Log levels: DEBUG, INFO, WARNING, ERROR
  • Color-coded output for better readability

Project Structure

kres/
  api/
    apiHandler.py
    kresApi.py
    kresApiLauncher.py
  config/
    extractConfig.py
    loadConfig.py
  encryption/
    tokenEncryption.py
  subparsers/
    accessParser.py
    apiParser.py
    logoutParser.py
    restartParser.py
  utils/
    extractResourceNames.py
    logger.py
    parser.py
  main.py
README.md
requirements.txt

Contributing

Pull requests and issues are welcome! Please open an issue to discuss major changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kres-1.0.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kres-1.0.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file kres-1.0.1.tar.gz.

File metadata

  • Download URL: kres-1.0.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for kres-1.0.1.tar.gz
Algorithm Hash digest
SHA256 044c41755e4e5a2c8f61cb697f77c30928bf4dce39503dfc1fd7ae2c35d3d994
MD5 5bf511d80e4e634d30fe070772e9aad1
BLAKE2b-256 2e79f711cc3fc7d97dd1a5b181d01e5e26f1a9fe110058aefd55b6ea726c4845

See more details on using hashes here.

File details

Details for the file kres-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: kres-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for kres-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cc89b662b260b3000ac8725e2ec3481dd83fb14200a08803fe055e285ce8e97
MD5 950ecf9aa6f5397b68093547cd6b940f
BLAKE2b-256 72bcb9fa6bfc85b68ee623dfc9de24e0a6685986a90ac2457e9e594ea3be339c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page