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, healthcheck (→ liveness/readiness probes), and depends_on/networks into the chart
  • Optional wait-for initContainers (waitOnDependencies: true) to gate startup on dependency Services
  • 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
--values-overlay YAML file deep-merged into generated values 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 generated with a documented header describing every tunable; edit it directly, or pass --values-overlay so customizations survive regeneration:

# my-overrides.yml
waitOnDependencies: true
services:
  web:
    replicas: 3
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.3.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.3.0
File Size Uploaded Provenance
helmgen-0.3.0.tar.gz 18.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 34.6 kB

Release files / helmgen-0.3.0.tar.gz

Download URL helmgen-0.3.0.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a19fe3abeb795dbe771f5617ee737511435eb6b7530667ffd560cc2bc74fdde
BLAKE2b-256 checksum
How to use checksums
c4de52fa32af162a60849d1a622cba7283dd69544d18d8c42d03bcc0fc74e2bf
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.3.0-py3-none-any.whl

Download URL helmgen-0.3.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21e5914a58a972be24b68fb4f118f5333a9175d7be95b79fd95ba69542bbc214
BLAKE2b-256 checksum
How to use checksums
817c9ea6c53cc88c87ce9b3ba0f15aa57430a4aee2dc5bd1da06553b4aa04ab3
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.3.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