Skip to content

SupportTools/rancher-upgrade-tool

Repository files navigation

Rancher Upgrade Tool

CI/CD Go Report Card Codecov GoDoc GitHub stars GitHub forks License Docker Pulls Docker Image Size

The Rancher Upgrade Tool simplifies generating an upgrade plan for Rancher and Kubernetes versions. It uses compatibility rules stored in a JSON file to ensure smooth and efficient upgrades. Visit Rancher Tips for more insights.

Dependencies

File Structure

  • main.go: Contains the main logic for the upgrade planner
  • data/upgrade-paths.json: JSON file containing the upgrade paths and compatibility rules

API Endpoints

  • /api/plan-upgrade/:platform/:rancher/:k8s: Generates the upgrade plan for the provided Rancher and Kubernetes versions on a specific platform
  • /healthz: Health check endpoint
  • /metrics: Prometheus metrics endpoint

Setup

  1. Clone the repository:
    git clone https://github.com/SupportTools/rancher-upgrade-tool.git
    cd rancher-upgrade-tool
  2. Add the upgrade-paths.json file in the data/ directory with the upgrade paths and rules.
  3. Install dependencies using Go modules:
    go mod tidy
  4. Run the application:
    go run main.go

Usage

  • Make a GET request to /api/plan-upgrade/:platform/:rancher/:k8s to get the upgrade plan for the specified platform, Rancher version, and Kubernetes version.
  • Access Prometheus metrics data at /metrics.

Metrics

The application exposes custom metrics for monitoring and analysis:

  • requests_in_last_60_seconds: Counts incoming requests in the last 60 seconds
  • versions_submitted_total: Tracks the total number of Rancher and Kubernetes versions submitted
  • request_duration_seconds: Measures the duration of each request
  • active_requests: Tracks the number of active requests being processed

License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.