helm-operator-generator
npx machina-cli add skill typhoonzero/awesome-acp-skills/helm-operator-generator --openclawHelm Operator Generator
This skill provides a streamlined way to generate a Helm-based Kubernetes Operator project.
Overview
Creating a Helm operator typically involves running complex operator-sdk commands with multiple flags. This skill simplifies that process by providing a script that takes the essential parameters and executes the initialization for you.
Capabilities
- Scaffold Project: Creates a new directory with the complete structure for a Helm operator.
- Helm Chart Integration: Supports using local charts, repository charts, or boilerplate charts.
- Customization: Allows specifying API group, version, and kind.
Usage
This skill includes a Python script scripts/generate_operator.py that wraps the operator-sdk command.
Prerequisites
Ensure you have the following installed:
operator-sdk(installed in your PATH)helm(if using charts from repositories)kubectl(for deploying the operator)
Generating an Operator
To generate a new operator project, run the script from the terminal (assuming you are in the helm-operator-skill directory):
python3 scripts/generate_operator.py <project_name> \
--domain <domain> \
--group <group> \
--version <version> \
--kind <kind> \
[--helm-chart <chart>] \
[--helm-chart-repo <repo_url>] \
[--helm-chart-version <chart_version>]
Examples
1. Create a basic operator with the default Nginx chart:
python3 scripts/generate_operator.py nginx-operator \
--domain example.com \
--group demo \
--version v1alpha1 \
--kind Nginx
2. Create an operator from an existing local Helm chart:
python3 scripts/generate_operator.py my-app-operator \
--domain my.org \
--group apps \
--version v1 \
--kind MyApp \
--helm-chart ./charts/my-app
3. Create an operator from a remote Helm chart repository:
python3 scripts/generate_operator.py redis-operator \
--domain example.com \
--group cache \
--version v1alpha1 \
--kind Redis \
--helm-chart-repo https://charts.bitnami.com/bitnami \
--helm-chart redis
After Generation
Once the project is generated:
- Navigate into the project directory:
cd <project_name> - Build and push the image:
make docker-build docker-push IMG=<your-registry>/<image>:<tag> - Deploy the operator:
make deploy IMG=<your-registry>/<image>:<tag>
Source
git clone https://github.com/typhoonzero/awesome-acp-skills/blob/master/helm-operator-generator/SKILL.mdView on GitHub Overview
This skill automates creating a Helm-based Kubernetes Operator project. It wraps the operator-sdk init workflow to scaffold a new operator from a Helm chart—local, repository, or boilerplate—without manual command chaining.
How This Skill Works
A Python script (scripts/generate_operator.py) wraps operator-sdk init. It accepts project_name, domain, group, version, and kind, plus optional --helm-chart, --helm-chart-repo, and --helm-chart-version to integrate the chart into the generated scaffold.
When to Use It
- You need to wrap an existing Helm chart into an operator quickly
- You want to scaffold a new operator from a boilerplate chart
- You need to generate an operator from a local Helm chart
- You want to build an operator from a remote Helm chart repository
- You want a consistent API setup (domain/group/version/kind) across operators
Quick Start
- Step 1: Run the generator, e.g. python3 scripts/generate_operator.py <project_name> --domain <domain> --group <group> --version <version> --kind <kind> [--helm-chart <chart>] [--helm-chart-repo <repo_url>] [--helm-chart-version <chart_version>]
- Step 2: cd <project_name> to view the generated operator scaffold
- Step 3: Build and deploy: make docker-build docker-push IMG=<your-registry>/<image>:<tag> and then make deploy IMG=<your-registry>/<image>:<tag>
Best Practices
- Ensure prerequisites are installed: operator-sdk, helm, and kubectl in PATH
- Provide explicit API details: domain, group, version, and kind
- Choose --helm-chart for local charts or --helm-chart-repo for remote charts
- Validate chart compatibility with Helm and operator-sdk before generation
- Run the generator from a clean project root and review the generated scaffold
Example Use Cases
- Create a basic operator with the default Nginx chart
- Create an operator from an existing local Helm chart
- Create an operator from a remote Helm chart repository (e.g., Bitnami)
- Generate an operator from a boilerplate chart
- Produce a production-ready operator scaffold with explicit domain/group/kind