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.3.0.tar.gz (19.7 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.3.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rdeploy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 72cdecdf8b440fdeea8bd758a3ff497a10aa05ac466fc5eba415901d229f1d4d
MD5 76ba4760ad2bf3f4486113f9b7f6a171
BLAKE2b-256 71ef4cd5a352e266d0c55b651d33f1e51b1d700c87aa3fdb12db19c6129b7b0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rdeploy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2ffae5c376b2ae252894dbf95f7f8f5441d2280495f291bd3fd5b958cbc0489
MD5 c585d66bc6c23c63749bf155dda388e7
BLAKE2b-256 797d85b42f81b304efa864e041391556825a0275cb789fea9ccab8a725cc1ca3

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