Helm - Parser Full Documentation
The parser for Helm translates Docker configurations into Kubernetes Helm Charts. The parser logic can be found in GitHub inside the docker-to-iac repo.
Parser language abbreviation for API
languageAbbreviation
:HELM
.
Prerequisite to deploy Helm Charts
To deploy the generated Helm Charts, you need:
- A Kubernetes cluster (local or cloud-based)
- Helm CLI installed (version 3.x recommended)
- Appropriate RBAC permissions to deploy resources in your target namespace
Kubernetes Resources
The generated Helm Chart creates the following Kubernetes resources for each service in your Docker configuration:
- Deployments: Container specifications, replica count, resource limits
- Services: Network access to your pods with appropriate ports
- ConfigMaps: Non-sensitive environment variables
- Secrets: Sensitive environment variables (passwords, tokens, etc.)
Database Support
For database services, the parser leverages Helm's dependency management to incorporate official Bitnami charts:
- MySQL/MariaDB: Uses Bitnami's MySQL/MariaDB chart
- PostgreSQL: Uses Bitnami's PostgreSQL chart
- Redis: Uses Bitnami's Redis chart
- MongoDB: Uses Bitnami's MongoDB chart
Each database dependency is configured with appropriate defaults and includes persistent storage for data.
Default output format
- The default output format for this parser:
YAML
.
File Configuration
The Helm parser generates a complete Helm Chart directory structure:
Chart.yaml
- The main chart definition with metadata and dependenciesvalues.yaml
- Configuration values that can be customized at deployment timetemplates/
- Directory containing Kubernetes YAML templates:deployment.yaml
- Deployment specifications for each serviceservice.yaml
- Service definitions for network accessconfigmap.yaml
- ConfigMap for non-sensitive environment variablessecret.yaml
- Secret for sensitive environment variables_helpers.tpl
- Helper functions for template generationNOTES.txt
- Usage instructions displayed after installation
This multi-file approach follows the standard Helm Chart structure and allows for maximum flexibility when deploying to Kubernetes.
Supported Docker Compose Variables
This parser supports the following Docker Compose variables:
image
environment
ports
command
volumes
The parser automatically detects sensitive environment variables (containing keywords like "password", "secret", "key", "token", or "auth") and places them in Kubernetes Secrets instead of ConfigMaps.
Volume Support
The parser supports Docker volume mappings by converting them to Kubernetes volume mounts:
- Each volume is converted to a hostPath volume by default
- Volume names are sanitized to conform to Kubernetes naming conventions
- For production use, you should modify the generated templates to use more appropriate volume types (PersistentVolumeClaims, etc.)
Database Integration
When a database service is detected (MySQL, PostgreSQL, Redis, MongoDB), the parser:
- Adds the corresponding Bitnami Helm chart as a dependency in
Chart.yaml
- Configures database settings in
values.yaml
- Maps environment variables to the expected format for the database chart
- Sets up appropriate persistence configurations
Example Database Configuration
For a PostgreSQL database in your Docker Compose file:
services:
db:
image: postgres:13
environment:
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: myapp
The parser will create:
# In Chart.yaml
dependencies:
- name: db
repository: https://charts.bitnami.com/bitnami
version: ^12.0.0
condition: dependencies.db.enabled
# In values.yaml
dependencies:
db:
enabled: true
auth:
postgres:
password: mypassword
database: myapp
username: myuser
password: mypassword
primary:
service:
ports:
postgresql: 5432
persistence:
enabled: true
size: 8Gi
Service Connections
The parser supports service-to-service connections by leveraging Kubernetes DNS for service discovery. When a service refers to another service in an environment variable, the parser automatically configures the appropriate DNS references.
For example, if your app
service connects to a db
service:
# Docker Compose
services:
app:
image: myapp
environment:
DATABASE_URL: postgresql://postgres:password@db:5432/mydb
db:
image: postgres
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: mydb
The parser will create:
# In ConfigMap template
data:
DATABASE_URL: {{ include "deploystack.serviceReference" (dict "service" (index $.Values.services "db") "serviceKey" "db") }}
Which resolves to the Kubernetes DNS name: db.{{ .Release.Namespace }}.svc.cluster.local:5432
Multi Services Support
Multi services
support for Helm: yes
Helm Charts are designed to handle multiple services and dependencies in a single deployment, making them ideal for complex applications. The parser transforms all services from your Docker Compose file into corresponding Kubernetes resources.
Please read more about multi service support here.
Deployment Instructions
To deploy the generated Helm Chart:
-
Navigate to the directory containing the generated chart
-
Install dependencies:
helm dependency update
-
Install the chart:
helm install my-release .
-
For custom configurations:
helm install my-release . --set services.app.replicaCount=2
Production Considerations
For production deployments, consider the following modifications to the generated chart:
- Replace hostPath volumes with appropriate persistent volume claims
- Adjust resource limits in
values.yaml
- Configure proper ingress settings for external access
- Enable and configure horizontal pod autoscaling
- Set up proper liveness and readiness probes
The generated Helm Chart is a starting point that you should review and customize to match your production requirements and security best practices.