helmgen 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- helmgen-0.1.0/LICENSE +21 -0
- helmgen-0.1.0/MANIFEST.in +1 -0
- helmgen-0.1.0/PKG-INFO +273 -0
- helmgen-0.1.0/README.md +254 -0
- helmgen-0.1.0/helmgen/__init__.py +18 -0
- helmgen-0.1.0/helmgen/__main__.py +8 -0
- helmgen-0.1.0/helmgen/generator.py +258 -0
- helmgen-0.1.0/helmgen/helm_templates/deployment.yaml +47 -0
- helmgen-0.1.0/helmgen/helm_templates/externalsecret.yaml +27 -0
- helmgen-0.1.0/helmgen/helm_templates/ingress.yaml +37 -0
- helmgen-0.1.0/helmgen/helm_templates/pvc.yaml +15 -0
- helmgen-0.1.0/helmgen/helm_templates/secrets.yaml +14 -0
- helmgen-0.1.0/helmgen/helm_templates/secretstore.yaml +16 -0
- helmgen-0.1.0/helmgen/helm_templates/service.yaml +18 -0
- helmgen-0.1.0/helmgen.egg-info/PKG-INFO +273 -0
- helmgen-0.1.0/helmgen.egg-info/SOURCES.txt +22 -0
- helmgen-0.1.0/helmgen.egg-info/dependency_links.txt +1 -0
- helmgen-0.1.0/helmgen.egg-info/entry_points.txt +2 -0
- helmgen-0.1.0/helmgen.egg-info/requires.txt +5 -0
- helmgen-0.1.0/helmgen.egg-info/top_level.txt +1 -0
- helmgen-0.1.0/pyproject.toml +32 -0
- helmgen-0.1.0/setup.cfg +4 -0
- helmgen-0.1.0/tests/test_chart_output.py +30 -0
- helmgen-0.1.0/tests/test_cli_basic.py +13 -0
helmgen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 marcelodevops
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include helmgen/helm_templates *.yaml
|
helmgen-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: helmgen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Auto-generate Helm charts from Docker Compose files
|
|
5
|
+
Author-email: Marcelo Garcia <marcelo.garcia@linux.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/marcelodevops/helmgen
|
|
8
|
+
Project-URL: repository, https://github.com/marcelodevops/helmgen
|
|
9
|
+
Project-URL: issues, https://github.com/marcelodevops/helmgen/issues
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: PyYAML>=6.0.2
|
|
14
|
+
Requires-Dist: ruamel.yaml>=0.18.6
|
|
15
|
+
Requires-Dist: jinja2>=3.1.4
|
|
16
|
+
Requires-Dist: click>=8.1.7
|
|
17
|
+
Requires-Dist: rich>=13.7.1
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
## Helmgen
|
|
21
|
+
Auto-generate Helm charts from Docker Compose files.
|
|
22
|
+
|
|
23
|
+
**HelmGen** is a Python CLI tool that automatically converts your `docker-compose.yml` into a fully structured Helm chart — including Deployments, Services, PVCs, Ingress, and Secrets (internal or ExternalSecrets).
|
|
24
|
+
##### Features:
|
|
25
|
+
- Convert **Docker Compose** files directly into **Helm charts**
|
|
26
|
+
- Auto-detect **databases** → generate StatefulSets + PVCs
|
|
27
|
+
- Auto-generate **Kubernetes Secrets** or **ExternalSecrets**
|
|
28
|
+
- Support for **Vault**, **AWS Secrets Manager**, or **ExternalSecrets Operator**
|
|
29
|
+
- Generate **SecretStore** or **ClusterSecretStore** automatically
|
|
30
|
+
- Auto-generate **Ingress** resources for web services
|
|
31
|
+
- Replace hardcoded secrets with safe placeholders in `values.yaml`
|
|
32
|
+
- Detect whether secrets should be env vars or mounted files
|
|
33
|
+
- CLI support for flexible options and overrides
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
##### From source (recommended for development)
|
|
38
|
+
```bash
|
|
39
|
+
git clone https://github.com/yourusername/helmgen.git
|
|
40
|
+
cd helmgen
|
|
41
|
+
pip install -e .
|
|
42
|
+
```
|
|
43
|
+
- Then you can run it as a command:
|
|
44
|
+
```bash
|
|
45
|
+
helmgen --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Usage
|
|
49
|
+
```bash
|
|
50
|
+
helmgen docker-compose.yml [options]
|
|
51
|
+
```
|
|
52
|
+
### Example
|
|
53
|
+
```bash
|
|
54
|
+
helmgen docker-compose.yml \
|
|
55
|
+
--output ./charts/myapp \
|
|
56
|
+
--secret-provider externalsecret \
|
|
57
|
+
--store-scope cluster \
|
|
58
|
+
--reuse-store global-vault-store
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
- This generates
|
|
63
|
+
```bash
|
|
64
|
+
charts/myapp/
|
|
65
|
+
├── Chart.yaml
|
|
66
|
+
├── values.yaml
|
|
67
|
+
└── templates/
|
|
68
|
+
├── deployment.yaml
|
|
69
|
+
├── service.yaml
|
|
70
|
+
├── pvc.yaml
|
|
71
|
+
├── ingress.yaml
|
|
72
|
+
├── secrets.yaml
|
|
73
|
+
├── externalsecret.yaml
|
|
74
|
+
└── secretstore.yaml
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
- Then you can deploy
|
|
78
|
+
```bash
|
|
79
|
+
helm install myapp ./charts/myapp
|
|
80
|
+
```
|
|
81
|
+
### CLI options
|
|
82
|
+
|
|
83
|
+
| Option | Description | Default |
|
|
84
|
+
| ----------------------- | ----------------------------------------------- | ------------------- |
|
|
85
|
+
| `--output, -o` | Directory for generated Helm chart | `./generated-chart` |
|
|
86
|
+
| `--secret-provider, -s` | `internal` (Helm Secret) or `externalsecret` | `internal` |
|
|
87
|
+
| `--store-scope` | `namespace` or `cluster` SecretStore | `namespace` |
|
|
88
|
+
| `--reuse-store` | Name of existing SecretStore/ClusterSecretStore | *None* |
|
|
89
|
+
|
|
90
|
+
### Example
|
|
91
|
+
|
|
92
|
+
```yaml
|
|
93
|
+
version: "3.8"
|
|
94
|
+
services:
|
|
95
|
+
web:
|
|
96
|
+
image: nginx:alpine
|
|
97
|
+
ports:
|
|
98
|
+
- "8080:80"
|
|
99
|
+
environment:
|
|
100
|
+
APP_ENV: production
|
|
101
|
+
SECRET_KEY: supersecret
|
|
102
|
+
|
|
103
|
+
db:
|
|
104
|
+
image: postgres:14
|
|
105
|
+
environment:
|
|
106
|
+
POSTGRES_USER: user
|
|
107
|
+
POSTGRES_PASSWORD: pass123
|
|
108
|
+
volumes:
|
|
109
|
+
- db-data:/var/lib/postgresql/data
|
|
110
|
+
ports:
|
|
111
|
+
- "5432:5432"
|
|
112
|
+
|
|
113
|
+
volumes:
|
|
114
|
+
db-data:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- This will generate a Helm Chart with
|
|
119
|
+
|
|
120
|
+
- StatefulSet for Postgres
|
|
121
|
+
- Deployment for web
|
|
122
|
+
- Secrets/ExternalSecrets for passwords
|
|
123
|
+
- PVC for db-data
|
|
124
|
+
- Ingress if ports are exposed
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
- In this example the sensitive data is hard coded in the compose file with is a very bad practice but it's being used only for purpose of the example demonstration
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
##### Secret management
|
|
131
|
+
- There are 2 options
|
|
132
|
+
1. Internal (default helm secret)
|
|
133
|
+
2. External
|
|
134
|
+
|
|
135
|
+
##### if you want to run it as a python script (not recommended)
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python3 generator.py docker-compose.yml \
|
|
139
|
+
--output ./charts/myapp \
|
|
140
|
+
--secret-provider externalsecret \
|
|
141
|
+
--store-scope cluster \
|
|
142
|
+
--reuse-store global-vault-store
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
##### This will create a complete Helm chart with:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
charts/myapp/
|
|
149
|
+
├── Chart.yaml
|
|
150
|
+
├── values.yaml
|
|
151
|
+
└── templates/
|
|
152
|
+
├── deployment.yaml
|
|
153
|
+
├── service.yaml
|
|
154
|
+
├── pvc.yaml
|
|
155
|
+
├── ingress.yaml
|
|
156
|
+
├── secrets.yaml
|
|
157
|
+
├── externalsecret.yaml
|
|
158
|
+
└── secretstore.yaml
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
##### Templates
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
helm_templates/
|
|
166
|
+
├── deployment.yaml
|
|
167
|
+
├── service.yaml
|
|
168
|
+
├── pvc.yaml
|
|
169
|
+
├── ingress.yaml
|
|
170
|
+
├── secrets.yaml
|
|
171
|
+
├── externalsecret.yaml
|
|
172
|
+
└── secretstore.yaml
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
##### Summary
|
|
177
|
+
|
|
178
|
+
Files and templates directory:
|
|
179
|
+
- generator.py → generates chart structure and populates values.yaml.
|
|
180
|
+
- helm_templates/ → reusable Jinja-style templates compatible with Helm.
|
|
181
|
+
- Seamless handling of:
|
|
182
|
+
|
|
183
|
+
- Secrets and ExternalSecrets
|
|
184
|
+
- Databases as StatefulSets (via PVC)
|
|
185
|
+
- Ingress auto-detection
|
|
186
|
+
- ClusterSecretStore / SecretStore support
|
|
187
|
+
|
|
188
|
+
##### Run this version
|
|
189
|
+
- Generate files and templates from compose file:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
python3 generator.py docker-compose.yml --output ./charts/myapp --secret-provider externalsecret
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
- Then install chart:
|
|
196
|
+
```bash
|
|
197
|
+
helm install myapp ./charts/myapp
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
##### Dependencies
|
|
202
|
+
|
|
203
|
+
| Package | Purpose |
|
|
204
|
+
| --------------- | ----------------------------------------------------------------------------------------------------- |
|
|
205
|
+
| **PyYAML** | Primary YAML parser for reading `docker-compose.yml`. |
|
|
206
|
+
| **ruamel.yaml** | More advanced YAML manipulation (preserves comments, ordering). |
|
|
207
|
+
| **jinja2** | Template rendering for Helm YAML files (used when writing `templates/`). |
|
|
208
|
+
| **click** | Optional CLI framework (if you upgrade from `argparse` later for nicer commands). |
|
|
209
|
+
| **rich** | Optional but recommended — adds colored console output, status spinners, and better error formatting. |
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
##### Install dependencies
|
|
213
|
+
```bash
|
|
214
|
+
pip install -r requirements.txt
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
##### Update to run it as a CLI tool
|
|
218
|
+
- Usage
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
helmgen docker-compose.yml --output ./charts/myapp
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
##### How it works
|
|
226
|
+
|
|
227
|
+
- project.scripts exposes a command called helmgen
|
|
228
|
+
- That command runs the main() function inside your generator.py
|
|
229
|
+
- Everything else is metadata (version, author, URLs, etc.)
|
|
230
|
+
- Dependencies match the ones from your requirements.txt
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
##### Project layout
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
|
|
237
|
+
helmgen/
|
|
238
|
+
├── generator.py
|
|
239
|
+
├── pyproject.toml
|
|
240
|
+
├── README.md
|
|
241
|
+
├── requirements.txt
|
|
242
|
+
└── helm_templates/
|
|
243
|
+
├── deployment.yaml
|
|
244
|
+
├── service.yaml
|
|
245
|
+
├── pvc.yaml
|
|
246
|
+
├── ingress.yaml
|
|
247
|
+
├── secrets.yaml
|
|
248
|
+
├── externalsecret.yaml
|
|
249
|
+
└── secretstore.yaml
|
|
250
|
+
```
|
|
251
|
+
##### Install locally for development
|
|
252
|
+
- From the folder containing pyproject.toml:
|
|
253
|
+
```bash
|
|
254
|
+
pip install -e .
|
|
255
|
+
```
|
|
256
|
+
##### Then you can run it directly:
|
|
257
|
+
```bash
|
|
258
|
+
helmgen docker-compose.yml --output ./charts/myapp
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
##### Build a distributable package
|
|
263
|
+
- to share it or publish it to PyPI (optional):
|
|
264
|
+
```bash
|
|
265
|
+
python -m build
|
|
266
|
+
```
|
|
267
|
+
- and it generates
|
|
268
|
+
```bash
|
|
269
|
+
dist/
|
|
270
|
+
├── helmgen-0.1.0-py3-none-any.whl
|
|
271
|
+
└── helmgen-0.1.0.tar.gz
|
|
272
|
+
|
|
273
|
+
```
|
helmgen-0.1.0/README.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
## Helmgen
|
|
2
|
+
Auto-generate Helm charts from Docker Compose files.
|
|
3
|
+
|
|
4
|
+
**HelmGen** is a Python CLI tool that automatically converts your `docker-compose.yml` into a fully structured Helm chart — including Deployments, Services, PVCs, Ingress, and Secrets (internal or ExternalSecrets).
|
|
5
|
+
##### Features:
|
|
6
|
+
- Convert **Docker Compose** files directly into **Helm charts**
|
|
7
|
+
- Auto-detect **databases** → generate StatefulSets + PVCs
|
|
8
|
+
- Auto-generate **Kubernetes Secrets** or **ExternalSecrets**
|
|
9
|
+
- Support for **Vault**, **AWS Secrets Manager**, or **ExternalSecrets Operator**
|
|
10
|
+
- Generate **SecretStore** or **ClusterSecretStore** automatically
|
|
11
|
+
- Auto-generate **Ingress** resources for web services
|
|
12
|
+
- Replace hardcoded secrets with safe placeholders in `values.yaml`
|
|
13
|
+
- Detect whether secrets should be env vars or mounted files
|
|
14
|
+
- CLI support for flexible options and overrides
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
##### From source (recommended for development)
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/yourusername/helmgen.git
|
|
21
|
+
cd helmgen
|
|
22
|
+
pip install -e .
|
|
23
|
+
```
|
|
24
|
+
- Then you can run it as a command:
|
|
25
|
+
```bash
|
|
26
|
+
helmgen --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Usage
|
|
30
|
+
```bash
|
|
31
|
+
helmgen docker-compose.yml [options]
|
|
32
|
+
```
|
|
33
|
+
### Example
|
|
34
|
+
```bash
|
|
35
|
+
helmgen docker-compose.yml \
|
|
36
|
+
--output ./charts/myapp \
|
|
37
|
+
--secret-provider externalsecret \
|
|
38
|
+
--store-scope cluster \
|
|
39
|
+
--reuse-store global-vault-store
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- This generates
|
|
44
|
+
```bash
|
|
45
|
+
charts/myapp/
|
|
46
|
+
├── Chart.yaml
|
|
47
|
+
├── values.yaml
|
|
48
|
+
└── templates/
|
|
49
|
+
├── deployment.yaml
|
|
50
|
+
├── service.yaml
|
|
51
|
+
├── pvc.yaml
|
|
52
|
+
├── ingress.yaml
|
|
53
|
+
├── secrets.yaml
|
|
54
|
+
├── externalsecret.yaml
|
|
55
|
+
└── secretstore.yaml
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
- Then you can deploy
|
|
59
|
+
```bash
|
|
60
|
+
helm install myapp ./charts/myapp
|
|
61
|
+
```
|
|
62
|
+
### CLI options
|
|
63
|
+
|
|
64
|
+
| Option | Description | Default |
|
|
65
|
+
| ----------------------- | ----------------------------------------------- | ------------------- |
|
|
66
|
+
| `--output, -o` | Directory for generated Helm chart | `./generated-chart` |
|
|
67
|
+
| `--secret-provider, -s` | `internal` (Helm Secret) or `externalsecret` | `internal` |
|
|
68
|
+
| `--store-scope` | `namespace` or `cluster` SecretStore | `namespace` |
|
|
69
|
+
| `--reuse-store` | Name of existing SecretStore/ClusterSecretStore | *None* |
|
|
70
|
+
|
|
71
|
+
### Example
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
version: "3.8"
|
|
75
|
+
services:
|
|
76
|
+
web:
|
|
77
|
+
image: nginx:alpine
|
|
78
|
+
ports:
|
|
79
|
+
- "8080:80"
|
|
80
|
+
environment:
|
|
81
|
+
APP_ENV: production
|
|
82
|
+
SECRET_KEY: supersecret
|
|
83
|
+
|
|
84
|
+
db:
|
|
85
|
+
image: postgres:14
|
|
86
|
+
environment:
|
|
87
|
+
POSTGRES_USER: user
|
|
88
|
+
POSTGRES_PASSWORD: pass123
|
|
89
|
+
volumes:
|
|
90
|
+
- db-data:/var/lib/postgresql/data
|
|
91
|
+
ports:
|
|
92
|
+
- "5432:5432"
|
|
93
|
+
|
|
94
|
+
volumes:
|
|
95
|
+
db-data:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- This will generate a Helm Chart with
|
|
100
|
+
|
|
101
|
+
- StatefulSet for Postgres
|
|
102
|
+
- Deployment for web
|
|
103
|
+
- Secrets/ExternalSecrets for passwords
|
|
104
|
+
- PVC for db-data
|
|
105
|
+
- Ingress if ports are exposed
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
- In this example the sensitive data is hard coded in the compose file with is a very bad practice but it's being used only for purpose of the example demonstration
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
##### Secret management
|
|
112
|
+
- There are 2 options
|
|
113
|
+
1. Internal (default helm secret)
|
|
114
|
+
2. External
|
|
115
|
+
|
|
116
|
+
##### if you want to run it as a python script (not recommended)
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python3 generator.py docker-compose.yml \
|
|
120
|
+
--output ./charts/myapp \
|
|
121
|
+
--secret-provider externalsecret \
|
|
122
|
+
--store-scope cluster \
|
|
123
|
+
--reuse-store global-vault-store
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
##### This will create a complete Helm chart with:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
charts/myapp/
|
|
130
|
+
├── Chart.yaml
|
|
131
|
+
├── values.yaml
|
|
132
|
+
└── templates/
|
|
133
|
+
├── deployment.yaml
|
|
134
|
+
├── service.yaml
|
|
135
|
+
├── pvc.yaml
|
|
136
|
+
├── ingress.yaml
|
|
137
|
+
├── secrets.yaml
|
|
138
|
+
├── externalsecret.yaml
|
|
139
|
+
└── secretstore.yaml
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
##### Templates
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
helm_templates/
|
|
147
|
+
├── deployment.yaml
|
|
148
|
+
├── service.yaml
|
|
149
|
+
├── pvc.yaml
|
|
150
|
+
├── ingress.yaml
|
|
151
|
+
├── secrets.yaml
|
|
152
|
+
├── externalsecret.yaml
|
|
153
|
+
└── secretstore.yaml
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
##### Summary
|
|
158
|
+
|
|
159
|
+
Files and templates directory:
|
|
160
|
+
- generator.py → generates chart structure and populates values.yaml.
|
|
161
|
+
- helm_templates/ → reusable Jinja-style templates compatible with Helm.
|
|
162
|
+
- Seamless handling of:
|
|
163
|
+
|
|
164
|
+
- Secrets and ExternalSecrets
|
|
165
|
+
- Databases as StatefulSets (via PVC)
|
|
166
|
+
- Ingress auto-detection
|
|
167
|
+
- ClusterSecretStore / SecretStore support
|
|
168
|
+
|
|
169
|
+
##### Run this version
|
|
170
|
+
- Generate files and templates from compose file:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
python3 generator.py docker-compose.yml --output ./charts/myapp --secret-provider externalsecret
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- Then install chart:
|
|
177
|
+
```bash
|
|
178
|
+
helm install myapp ./charts/myapp
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
##### Dependencies
|
|
183
|
+
|
|
184
|
+
| Package | Purpose |
|
|
185
|
+
| --------------- | ----------------------------------------------------------------------------------------------------- |
|
|
186
|
+
| **PyYAML** | Primary YAML parser for reading `docker-compose.yml`. |
|
|
187
|
+
| **ruamel.yaml** | More advanced YAML manipulation (preserves comments, ordering). |
|
|
188
|
+
| **jinja2** | Template rendering for Helm YAML files (used when writing `templates/`). |
|
|
189
|
+
| **click** | Optional CLI framework (if you upgrade from `argparse` later for nicer commands). |
|
|
190
|
+
| **rich** | Optional but recommended — adds colored console output, status spinners, and better error formatting. |
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
##### Install dependencies
|
|
194
|
+
```bash
|
|
195
|
+
pip install -r requirements.txt
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
##### Update to run it as a CLI tool
|
|
199
|
+
- Usage
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
helmgen docker-compose.yml --output ./charts/myapp
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
##### How it works
|
|
207
|
+
|
|
208
|
+
- project.scripts exposes a command called helmgen
|
|
209
|
+
- That command runs the main() function inside your generator.py
|
|
210
|
+
- Everything else is metadata (version, author, URLs, etc.)
|
|
211
|
+
- Dependencies match the ones from your requirements.txt
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
##### Project layout
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
|
|
218
|
+
helmgen/
|
|
219
|
+
├── generator.py
|
|
220
|
+
├── pyproject.toml
|
|
221
|
+
├── README.md
|
|
222
|
+
├── requirements.txt
|
|
223
|
+
└── helm_templates/
|
|
224
|
+
├── deployment.yaml
|
|
225
|
+
├── service.yaml
|
|
226
|
+
├── pvc.yaml
|
|
227
|
+
├── ingress.yaml
|
|
228
|
+
├── secrets.yaml
|
|
229
|
+
├── externalsecret.yaml
|
|
230
|
+
└── secretstore.yaml
|
|
231
|
+
```
|
|
232
|
+
##### Install locally for development
|
|
233
|
+
- From the folder containing pyproject.toml:
|
|
234
|
+
```bash
|
|
235
|
+
pip install -e .
|
|
236
|
+
```
|
|
237
|
+
##### Then you can run it directly:
|
|
238
|
+
```bash
|
|
239
|
+
helmgen docker-compose.yml --output ./charts/myapp
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
##### Build a distributable package
|
|
244
|
+
- to share it or publish it to PyPI (optional):
|
|
245
|
+
```bash
|
|
246
|
+
python -m build
|
|
247
|
+
```
|
|
248
|
+
- and it generates
|
|
249
|
+
```bash
|
|
250
|
+
dist/
|
|
251
|
+
├── helmgen-0.1.0-py3-none-any.whl
|
|
252
|
+
└── helmgen-0.1.0.tar.gz
|
|
253
|
+
|
|
254
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
HelmGen — Auto-generate Helm charts from Docker Compose files.
|
|
3
|
+
|
|
4
|
+
This package provides:
|
|
5
|
+
- A CLI entry point (helmgen)
|
|
6
|
+
- A generator that parses docker-compose.yml
|
|
7
|
+
- Template rendering for Helm charts
|
|
8
|
+
|
|
9
|
+
Author: Marcelo Garcia
|
|
10
|
+
License: MIT
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__version__ = "0.1.0"
|
|
14
|
+
|
|
15
|
+
from .generator import main
|
|
16
|
+
|
|
17
|
+
if __name__ == "__main__":
|
|
18
|
+
main()
|