Skip to main content

CLI that makes it easy to build and deploy an application to k8s.

Project description

rdeploy

A CLI tool that makes it easy to build and deploy applications to Kubernetes on GCP. It wraps common tools (helm, kubectl, gcloud) into simple commands configured via a project-level YAML file.

Installation

pip install rdeploy

Quick Start

  1. Create an rdeploy.yaml in your project root (see Configuration)
  2. Run commands:
# Set cluster context
rdeploy set-context staging

# Build and push docker image
rdeploy cloudbuild staging v1.2.3

# Deploy to kubernetes
rdeploy upgrade staging v1.2.3

# Create a new release tag
rdeploy git-release patch

Commands

Command Description
set-project Set the active GCP project
set-cluster Set the active Kubernetes cluster
set-context Switch cluster and namespace context
activate Fetch and set project, cluster, and namespace
install Install a Helm chart deployment
upgrade Upgrade a Helm deployment to a new image tag (atomic by default: waits for the rollout and rolls back on failure; use --no-atomic to skip, --timeout to adjust the wait, default 15m)
helm Run arbitrary Helm commands
helm-setup Download and configure a local Helm binary
git-release Bump version and push a git tag
next-version Show what the next version number would be
latest-version Show the current latest version from git tags
build Build and push a Docker image
cloudbuild Build a Docker image via Google Cloud Build
live-image Display the currently deployed image and tag
shell Exec into a management container
manage Run a Django management command in-cluster
create-namespace Create a Kubernetes namespace
upload-secrets Upload secrets from an env file to Kubernetes
decode-secret Print decoded values of a Kubernetes secret
upload-static Upload static files to a GCS bucket
create-bucket Create a private GCS bucket
create-public-bucket Create a public GCS bucket
create-volume Create a GCE persistent disk
compose Wrapper for docker-compose

Configuration

rdeploy is configured via an rdeploy.yaml file in your project root. The file supports versioned schemas (v1, v2, v3).

Version 3 (recommended)

version: '3'
configs:
  staging:
    project_name: my-service
    namespace: staging
    kube_context: gke_my-project_us-central1_cluster-1
    docker_image: gcr.io/my-project/my-service:latest
    cloud_provider:
      name: gcp
      project: my-project
      kube_cluster: cluster-1
      region: us-central1
      helm_registry: us-central1-docker.pkg.dev
    helm_values_path: ./etc/helm/staging/values.yaml
    helm_chart: rehive-service
    helm_chart_version: 0.2.0
    helm_version: 3.14.0
    use_system_helm: true

  production:
    project_name: my-service
    namespace: production
    kube_context: gke_my-project_us-central1_cluster-1
    docker_image: gcr.io/my-project/my-service:latest
    cloud_provider:
      name: gcp
      project: my-project
      kube_cluster: cluster-1
      region: us-central1
      helm_registry: us-central1-docker.pkg.dev
    helm_values_path: ./etc/helm/production/values.yaml
    helm_chart: rehive-service
    helm_chart_version: 0.2.0
    helm_version: 3.14.0
    use_system_helm: true

Version 2

version: '2'
configs:
  staging:
    project_name: my-service
    namespace: staging
    docker_image: gcr.io/my-project/my-service:latest
    cloud_provider:
      name: gcp
      project: my-project
      kube_cluster: cluster-1
      region: us-central1
      helm_registry: us-central1-docker.pkg.dev
    helm_values_path: ./etc/helm/staging/values.yaml
    helm_chart: rehive/rehive-service
    helm_chart_version: 0.1.38
    helm_version: 3.14.0
    use_system_helm: true

Configuration Reference

Field Description
version Config schema version (1, 2, or 3)
project_name Name of the Helm release and Kubernetes deployment
namespace Kubernetes namespace
kube_context (v3) Direct kubectl context name
docker_image Docker image path
cloud_provider.name Cloud provider (currently gcp)
cloud_provider.project GCP project ID
cloud_provider.kube_cluster Kubernetes cluster name
cloud_provider.region GCP region
cloud_provider.zone GCP zone (alternative to region)
cloud_provider.helm_registry OCI Helm registry (GCP Artifact Registry)
helm_values_path Path to Helm values file
helm_chart Helm chart name or OCI reference
helm_chart_version Helm chart version
helm_version Helm binary version (for local installs)
use_system_helm Use system Helm binary (default: true)

Versioning

rdeploy uses semantic versioning for releases. The git-release command automates tagging:

# Patch release: 1.2.3 → 1.2.4
rdeploy git-release patch

# Minor release: 1.2.3 → 1.3.0
rdeploy git-release minor

# Major release: 1.2.3 → 2.0.0
rdeploy git-release major

# Pre-release: 1.2.3 → 1.2.4-rc.1
rdeploy git-release pre-patch

# Skip confirmation prompt
rdeploy git-release patch --force

Development

# Clone and install in development mode
git clone https://github.com/rehive/rdeploy.git
cd rdeploy
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
coverage run -m pytest
coverage report

Requirements

  • Python 3.9+
  • kubectl configured with cluster access
  • gcloud CLI configured and authenticated
  • Helm 3.x

Publishing to PyPI

rm -rf dist
python -m build
twine upload dist/*

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

rdeploy-0.4.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

rdeploy-0.4.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file rdeploy-0.4.0.tar.gz.

File metadata

  • Download URL: rdeploy-0.4.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for rdeploy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1cde285976fb1205735f4b418cde622f62c4ad4aaa728b30076f996d09e9a3d4
MD5 1db006ced6ac9d1add93ed2ede1c7767
BLAKE2b-256 871c82b7c5ab8e9987a3a4590eea9a44d58578646029a1949ca4f90661c4108b

See more details on using hashes here.

File details

Details for the file rdeploy-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: rdeploy-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for rdeploy-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2506e85889b3231093e038c87ed53eb2d16851e16e18a2252f14bc3f007965bc
MD5 cc67fc87f6212f05b5dfaef1a789b6ad
BLAKE2b-256 544f3d39deb11b9c2745b3288c81de2dec92680ebe178d99277522bdd123a16c

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