Skip to main content

Helmgen

Auto-generate Helm charts from Docker Compose files.

HelmGen is a Python CLI tool that converts your docker-compose.yml into a structured Helm chart — including Deployments, StatefulSets, Services, PVCs, Ingress, and Secrets (native or ExternalSecrets).

Features

  • Convert Docker Compose files directly into Helm charts
  • Auto-detect databases (postgres, mysql, mariadb, mongodb, redis) → StatefulSet + PVC with real volume mount paths
  • Auto-generate Kubernetes Secrets or ExternalSecrets (External Secrets Operator)
  • Generate SecretStore or ClusterSecretStore, or reuse an existing one
  • Auto-detect Ingress from exposed web ports (80/443/8080) and Traefik-style Host(...) labels
  • Replace hardcoded secrets with safe placeholders in values.yaml
  • Sensible storage size defaults per database type
  • Maps compose replicas, command/args, and deploy.resources into the chart
  • Default CPU/memory resources on all containers, overridable per service in values.yaml
  • Optional HTTP liveness/readiness probes via probePath/probePort in values.yaml
  • Standard app.kubernetes.io/* labels on every resource (via _helpers.tpl)

Installation

pip install helmgen

From source (recommended for development):

git clone https://github.com/marcelodevops/helmgen.git
cd helmgen
pip install -e .

Usage

helmgen docker-compose.yml [options]
Option Description Default
--output, -o Directory for generated Helm chart ./generated-chart
--secret-provider, -s internal (Helm Secret) or externalsecret internal
--store-scope namespace or cluster SecretStore namespace
--reuse-store Name of existing SecretStore/ClusterSecretStore None

Example

docker-compose.yml:

version: "3.8"
services:
  web:
    image: nginx:alpine
    ports:
      - "8080:80"
    environment:
      APP_ENV: production
      SECRET_KEY: supersecret

  db:
    image: postgres:14
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass123
    volumes:
      - db-data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

volumes:
  db-data:

Hardcoded secrets in compose files are bad practice — HelmGen detects them and replaces their values in values.yaml with <secret-from-values> placeholders.

Generate a chart using ExternalSecrets backed by a shared ClusterSecretStore:

helmgen docker-compose.yml \
  --output ./charts/myapp \
  --secret-provider externalsecret \
  --store-scope cluster \
  --reuse-store global-vault-store

Output:

charts/myapp/
├── Chart.yaml
├── values.yaml
└── templates/
    ├── _helpers.tpl          # standard label helpers
    ├── deployment.yaml       # non-database services
    ├── statefulset.yaml      # database services (storage: true)
    ├── service.yaml
    ├── pvc.yaml
    ├── ingress.yaml
    ├── secrets.yaml          # rendered only when secretProvider=internal
    ├── externalsecret.yaml   # rendered only when secretProvider=externalsecret
    └── secretstore.yaml      # skipped when --reuse-store is set

A ready-to-try input lives in examples/docker-compose.yml.

Tuning the generated chart

values.yaml is meant to be edited after generation:

services:
  web:
    probePath: /healthz   # adds liveness + readiness httpGet probes
    probePort: 8080
    replicas: 3
    resources:            # overrides the global default per service
      requests: {cpu: 50m, memory: 256Mi}
resources:                # global default for all containers
  requests: {cpu: 10m, memory: 128Mi}
  limits: {cpu: "1", memory: 512Mi}

Deploy:

helm install myapp ./charts/myapp

Development

pip install -e .[dev]
ruff check .
pytest --cov=helmgen

The templates in helmgen/helm_templates/ are plain Helm templates (copied verbatim into the generated chart); all chart logic driven by values.yaml lives in helmgen/generator.py.

Dependencies

Package Purpose
PyYAML Parse docker-compose.yml and emit values.yaml

License

MIT

Metadata

Release files for helmgen 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for helmgen 0.2.0
File Size Uploaded Provenance
helmgen-0.2.0.tar.gz 14.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for helmgen 0.2.0
File Interpreter ABI Platform
helmgen-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.2 kB

Release files / helmgen-0.2.0.tar.gz

Download URL helmgen-0.2.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
40da5f4b649281745881822d4184aa58fb695086ea1654fcd0d7d0cb0fa25d23
BLAKE2b-256 checksum
How to use checksums
bc55f24df2c15579ed6f0ebd45fe53f222782d7465b5c33337cb76ced4db66f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / helmgen-0.2.0-py3-none-any.whl

Download URL helmgen-0.2.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db330072b2b57251f3c779d011fc5120f63b3338f9579f5ff42ed7b8c4cef013
BLAKE2b-256 checksum
How to use checksums
7da4b8a8036caab6827d5f7db83d17f43dbf13d2bd019390f478e0627014c5f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Security for helmgen 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page