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
- Create an
rdeploy.yamlin your project root (see Configuration) - 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 |
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rdeploy-0.2.0.tar.gz.
File metadata
- Download URL: rdeploy-0.2.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac6758002e3e45f8577db80f45cf4e4035cd30f2d080656906ab5c32e2f0398b
|
|
| MD5 |
9000bb64742f582783394b7df7e11e2a
|
|
| BLAKE2b-256 |
c90cacec35b2a7a77766dcb99bf7a41bce77e797e3038f88f0a233b7f80f3b7e
|
File details
Details for the file rdeploy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rdeploy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc02fe05ac52e12c397a65f6587506375711c1e536d212faf9b5725bfe8229a7
|
|
| MD5 |
61b8577a21ac619634870f3de457d875
|
|
| BLAKE2b-256 |
673e429fb1884c81ebf082caad20913e9f539b18197c23b7f1a136795f5e49b6
|