helmgen is a Helm plugin designed to simplify and accelerate the creation of Helm charts.
Ensure you have Helm installed. See the official Helm installation guide for details.
helmgen requires the jinja2
library for template rendering.
If you see an error like ModuleNotFoundError: No module named 'jinja2'
,
you need to install it for the Python environment used by Helm.
On macOS or other systems with "externally managed" Python environments (PEP 668), you may need to use the following command:
python3 -m pip install --break-system-packages jinja2==3.1.6
- If you are using a requirements file:
python3 -m pip install --break-system-packages -r requirements.txt
Warning:
The--break-system-packages
option allows pip to install packages into the system Python environment, which may risk breaking system tools.
Use this option only if you understand the risks.
For more information, see PEP 668.
Alternatively, you can use a virtual environment:
python3 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt
- Install the helmgen plugin by running:
helm plugin install https://github.com/namejsjeongkr/helmgen
- Verify the installation by running
helm plugin list
. You should seehelmgen
in the list of installed plugins.
- To create a new Helm chart, execute the following command (replace
my-app
with your desired chart name):
helm helmgen create <my-app> <ENV>
- The generated chart will be saved in the
my-app
folder within your current directory. - Review the chart structure and modify it as needed:
<my-app>/
├── Chart.yaml
├── values.yaml
└── templates/
└── ...
- To deploy your application using the chart:
helm install <release-name> <my-app>
- Automated generation of basic Helm chart structure
- Custom template support: Place your custom templates in the
templates/
directory. helmgen supports.yaml
,.tpl
, and.txt
files. - Chart validation
For more detailed usage information and options, use the command helm helmgen --help
.
If you encounter this error on macOS or Ubuntu, your Python environment may be "externally managed." To fix this, install dependencies with:
python3 -m pip install --break-system-packages -r requirements.txt
If you encounter issues, try the following:
- Ensure you have the required Helm version installed.
- Verify that the
helmgen.sh
script has execute permissions (chmod +x helmgen.sh
). - Check the output of
helm plugin install --debug https://github.com/namejsjeongkr/helmgen
for more detailed error messages.
helmgen allows you to customize the generated Helm charts to fit your specific deployment needs:
-
Pre-defined Templates: The
pre-defined-templates
folder contains base templates for various Kubernetes objects. You can modify these templates or add new ones to suit your environment. -
Custom Values: The
values.yaml
file in thepre-defined-templates
folder can be customized to set default values for your charts. These values can be overridden during chart installation. -
Template Customization: In the
pre-defined-templates/templates
directory, you can add or modify Kubernetes object definitions (like Deployments, Services, ConfigMaps, etc.) to match your application's requirements.
To use your customized templates:
- Fork the helmgen repository
- Modify the templates in the
pre-defined-templates
folder - Update the
helmgen.sh
script to use your forked repository
This way, you can create Helm charts that are tailored to your specific deployment environment and application needs.