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, deploy.resources, and healthcheck (→ liveness/readiness probes) 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
--ingress-class ingressClassName for generated Ingress nginx

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.1

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.1
File Size Uploaded Provenance
helmgen-0.2.1.tar.gz 16.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 30.6 kB

Release files / helmgen-0.2.1.tar.gz

Download URL helmgen-0.2.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e5c74149de016cd486ac9414cfd587279ea1cba0edbab537aded984976d769d2
BLAKE2b-256 checksum
How to use checksums
0aa83e53da883e349b27d5b3d6b3aa9f845cb8d30eed55d8e2799f4ce01e4463
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.1-py3-none-any.whl

Download URL helmgen-0.2.1-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b294a53bb7de2489e23ff26f4866fde36fa96c2d651e0cf3fd7c5229ea0fe25c
BLAKE2b-256 checksum
How to use checksums
b7aa724e5c87970b6f5510a8d2597d985e3523951f7b12291cbfe6f2ca07cca8
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.1

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