Purpose & When-To-Use
Trigger conditions:
- Deploying applications to multiple Kubernetes environments (dev, staging, prod)
- Packaging Kubernetes manifests for reusability and distribution
- Managing complex applications with dependencies (databases, message queues)
- Implementing GitOps workflows with parameterized deployments
- Version-controlling Kubernetes configurations with semantic versioning
Not for:
- Simple single-environment deployments (use kubernetes-manifest-generator)
- Serverless deployments (use cloud-serverless-designer)
- Service mesh configuration (use kubernetes-servicemesh-configurator)
- Complete orchestration across deployment types (use cloud-native-orchestrator agent)
Pre-Checks
Time normalization:
- Compute
NOW_ET using NIST/time.gov semantics (America/New_York, ISO-8601): 2025-10-26T01:33:54-04:00
- Use
NOW_ET for all citation access dates
Input validation:
chart_name must be DNS-1123 compliant (lowercase, alphanumeric, hyphens)
app_version must follow semantic versioning (e.g., 1.0.0)
chart_version must follow semantic versioning
resources array must contain valid K8s resource types (Deployment, Service, etc.)
Source freshness:
Decision thresholds:
- T1 for basic chart structure with single environment
- T2 for multi-environment charts with dependencies and hooks
Procedure
T1: Basic Helm Chart Structure (≤2k tokens)
Step 1: Create chart directory structure
- Generate Chart.yaml with metadata (name, version, appVersion, description)
- Create values.yaml with default configuration parameters
- Build templates/ directory with basic resource templates
- Add NOTES.txt for post-install instructions
Step 2: Parameterize templates
- Convert static manifests to Helm templates with {{ .Values.* }}
- Add image repository, tag, and pull policy parameters
- Parameterize replica count, resource limits, service ports
- Include conditional blocks for optional resources
Output:
- Basic Helm chart structure
- Parameterized templates for core resources
- values.yaml with sensible defaults
- helm install command
Abort conditions:
- chart_name conflicts with existing chart
- Invalid Kubernetes resource types in resources array
T2: Production-Grade Helm Chart (≤6k tokens)
All T1 steps plus:
Step 1: Multi-environment configuration
- Create values-dev.yaml, values-staging.yaml, values-prod.yaml
- Environment-specific overrides (replicas, resources, ingress)
- Secret management strategy (external-secrets, sealed-secrets)
- ConfigMap templating for environment config
Step 2: Chart dependencies
- Define dependencies in Chart.yaml (PostgreSQL, Redis, etc.)
- Configure dependency conditions (enable/disable based on values)
- Add subchart value overrides
- Generate Chart.lock with dependency versions
Step 3: Helm hooks
- Pre-install hook for database migration jobs
- Post-install hook for validation or smoke tests
- Pre-upgrade hook for backup or compatibility checks
- Add hook deletion policies (before-hook-creation, hook-succeeded)
Step 4: Advanced templating
- Named templates (_helpers.tpl) for reusable snippets
- Range loops for multiple similar resources
- Conditional resource creation with {{ if .Values.enabled }}
- Template functions (quote, toYaml, include, etc.)
Step 5: Validation and linting
- Run helm lint to check chart structure and templates
- Validate with helm template --debug
- Test installation in dry-run mode
- Generate schema for values.yaml validation
Output:
- Complete multi-environment Helm chart
- Chart dependencies with Chart.lock
- Helm hooks for lifecycle management
- Validation and installation instructions
- values.schema.json for values validation
Abort conditions:
- Dependency versions incompatible or unavailable
- Template syntax errors in complex conditionals
- Hook jobs fail validation
T3: Enterprise Helm Chart (≤12k tokens)
All T1 + T2 steps plus:
Step 1: Chart testing
- Create tests/ directory with connection tests
- Add helm test YAML for post-deployment validation
- Include integration test scripts
Step 2: Documentation
- Generate comprehensive README.md with parameter tables
- Document all values.yaml parameters with descriptions
- Add upgrade guides and migration notes
- Include troubleshooting section
Step 3: Chart repository packaging
- Package chart with helm package
- Generate index.yaml for chart repository
- Sign chart with GPG for provenance
Output:
- Enterprise-ready Helm chart with tests
- Complete documentation
- Packaged and signed chart ready for distribution
- Chart repository index
Decision Rules
Chart structure patterns:
- Simple app: Deployment, Service, ConfigMap, Secret templates only
- Stateful app: Add StatefulSet, PersistentVolumeClaim, headless Service
- Ingress required: Include Ingress template with TLS configuration
- Jobs/CronJobs: Add job templates with completion tracking
Dependency management:
- Include subchart: Common dependencies (PostgreSQL, Redis) as subcharts
- External dependency: Reference external charts in Chart.yaml dependencies
- Conditional dependency: Use
condition or tags for optional dependencies
Hook usage:
- Pre-install: Database schema initialization, secret generation
- Post-install: Smoke tests, notification webhooks
- Pre-upgrade: Backup jobs, compatibility validation
- Post-upgrade: Migration cleanup, cache invalidation
Values organization:
- Global values: Shared across all environments (image repository, labels)
- Environment values: Replicas, resources, domains (in values-{env}.yaml)
- Secret values: Not in values files, use external-secrets or Vault
Ambiguity handling:
- If environments not specified → create values.yaml only (single environment)
- If dependencies unclear → request application architecture diagram
- If resource types unknown → infer from application type (web app → Deployment + Service)
Output Contract
Required fields (all tiers):
chart_structure:
Chart.yaml: "chart metadata"
values.yaml: "default configuration values"
templates/:
- deployment.yaml
- service.yaml
- _helpers.tpl
NOTES.txt: "post-install instructions"
validation_results:
helm_lint: "output of helm lint"
template_render: "output of helm template"
errors: ["array of validation errors if any"]
Additional T2 fields:
multi_environment:
values_dev.yaml: "development overrides"
values_staging.yaml: "staging overrides"
values_prod.yaml: "production overrides"
dependencies:
Chart.yaml_dependencies: ["array of chart dependencies"]
Chart.lock: "locked dependency versions"
hooks:
pre_install: ["array of pre-install hook jobs"]
post_install: ["array of post-install hook jobs"]
pre_upgrade: ["array of pre-upgrade hook jobs"]
helpers:
_helpers.tpl: "named template definitions"
values_schema:
values.schema.json: "JSON schema for values validation"
Additional T3 fields:
testing:
tests/: ["array of test YAML files"]
test_commands: ["helm test chart-name"]
documentation:
README.md: "comprehensive chart documentation"
UPGRADING.md: "upgrade and migration guide"
packaging:
chart_package: "chart-name-version.tgz"
chart_signature: "chart-name-version.tgz.prov"
index.yaml: "chart repository index"
Examples
# T1 Example: Chart.yaml
apiVersion: v2
name: myapp
description: A Helm chart for my application
type: application
version: 0.1.0
appVersion: "1.0.0"
maintainers:
- name: Developer
email: dev@example.com
# T1 Example: values.yaml
replicaCount: 3
image:
repository: myregistry/myapp
pullPolicy: IfNotPresent
tag: "1.0.0"
service:
type: ClusterIP
port: 80
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
autoscaling:
enabled: false
minReplicas: 2
maxReplicas: 10
# T1 Example: templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "myapp.fullname" . }}
labels:
{{- include "myapp.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "myapp.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "myapp.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: 8080
resources:
{{- toYaml .Values.resources | nindent 12 }}
Quality Gates
Token budgets (enforced):
- T1: ≤2,000 tokens - basic chart structure with parameterization
- T2: ≤6,000 tokens - multi-environment, dependencies, hooks, validation
- T3: ≤12,000 tokens - testing, documentation, packaging, signing
Safety checks:
- No hardcoded secrets in values.yaml or templates
- Image tags are parameterized (not hardcoded :latest)
- Resource limits defined in values.yaml
- NOTES.txt provides clear installation instructions
Auditability:
- Chart.yaml includes maintainer information
- Semantic versioning for chart and app versions
- All template functions cite Helm documentation
- Dependency versions locked in Chart.lock
Determinism:
- helm template renders identical output for same values
- Chart dependencies are version-locked
- Named templates produce consistent output
Validation requirements:
- Chart must pass
helm lint without errors
- Templates must render without errors using
helm template
- T2+ charts must include values.schema.json validation
- T3 charts must pass
helm test successfully
Resources
Official Documentation (accessed 2025-10-26T01:33:54-04:00):
Template Functions:
Validation and Testing:
Chart Repositories:
1---2name: helm-chart-builder3description: Build production-grade Helm charts with templating, values.yaml parameterization, dependencies, and hooks for multi-environment Kubernetes deployments.4license: MIT5---67## Purpose & When-To-Use89**Trigger conditions:**10- Deploying applications to multiple Kubernetes environments (dev, staging, prod)11- Packaging Kubernetes manifests for reusability and distribution12- Managing complex applications with dependencies (databases, message queues)13- Implementing GitOps workflows with parameterized deployments14- Version-controlling Kubernetes configurations with semantic versioning1516**Not for:**17- Simple single-environment deployments (use kubernetes-manifest-generator)18- Serverless deployments (use cloud-serverless-designer)19- Service mesh configuration (use kubernetes-servicemesh-configurator)20- Complete orchestration across deployment types (use cloud-native-orchestrator agent)2122---2324## Pre-Checks2526**Time normalization:**27- Compute `NOW_ET` using NIST/time.gov semantics (America/New_York, ISO-8601): 2025-10-26T01:33:54-04:0028- Use `NOW_ET` for all citation access dates2930**Input validation:**31- `chart_name` must be DNS-1123 compliant (lowercase, alphanumeric, hyphens)32- `app_version` must follow semantic versioning (e.g., 1.0.0)33- `chart_version` must follow semantic versioning34- `resources` array must contain valid K8s resource types (Deployment, Service, etc.)3536**Source freshness:**37- Helm Documentation (accessed 2025-10-26T01:33:54-04:00): https://helm.sh/docs/38- Helm Best Practices (accessed 2025-10-26T01:33:54-04:00): https://helm.sh/docs/chart_best_practices/39- Helm Chart Template Guide (accessed 2025-10-26T01:33:54-04:00): https://helm.sh/docs/chart_template_guide/4041**Decision thresholds:**42- T1 for basic chart structure with single environment43- T2 for multi-environment charts with dependencies and hooks4445---4647## Procedure4849### T1: Basic Helm Chart Structure (≤2k tokens)5051**Step 1: Create chart directory structure**52- Generate Chart.yaml with metadata (name, version, appVersion, description)53- Create values.yaml with default configuration parameters54- Build templates/ directory with basic resource templates55- Add NOTES.txt for post-install instructions5657**Step 2: Parameterize templates**58- Convert static manifests to Helm templates with {{ .Values.* }}59- Add image repository, tag, and pull policy parameters60- Parameterize replica count, resource limits, service ports61- Include conditional blocks for optional resources6263**Output:**64- Basic Helm chart structure65- Parameterized templates for core resources66- values.yaml with sensible defaults67- helm install command6869**Abort conditions:**70- chart_name conflicts with existing chart71- Invalid Kubernetes resource types in resources array7273---7475### T2: Production-Grade Helm Chart (≤6k tokens)7677**All T1 steps plus:**7879**Step 1: Multi-environment configuration**80- Create values-dev.yaml, values-staging.yaml, values-prod.yaml81- Environment-specific overrides (replicas, resources, ingress)82- Secret management strategy (external-secrets, sealed-secrets)83- ConfigMap templating for environment config8485**Step 2: Chart dependencies**86- Define dependencies in Chart.yaml (PostgreSQL, Redis, etc.)87- Configure dependency conditions (enable/disable based on values)88- Add subchart value overrides89- Generate Chart.lock with dependency versions9091**Step 3: Helm hooks**92- Pre-install hook for database migration jobs93- Post-install hook for validation or smoke tests94- Pre-upgrade hook for backup or compatibility checks95- Add hook deletion policies (before-hook-creation, hook-succeeded)9697**Step 4: Advanced templating**98- Named templates (_helpers.tpl) for reusable snippets99- Range loops for multiple similar resources100- Conditional resource creation with {{ if .Values.enabled }}101- Template functions (quote, toYaml, include, etc.)102103**Step 5: Validation and linting**104- Run helm lint to check chart structure and templates105- Validate with helm template --debug106- Test installation in dry-run mode107- Generate schema for values.yaml validation108109**Output:**110- Complete multi-environment Helm chart111- Chart dependencies with Chart.lock112- Helm hooks for lifecycle management113- Validation and installation instructions114- values.schema.json for values validation115116**Abort conditions:**117- Dependency versions incompatible or unavailable118- Template syntax errors in complex conditionals119- Hook jobs fail validation120121---122123### T3: Enterprise Helm Chart (≤12k tokens)124125**All T1 + T2 steps plus:**126127**Step 1: Chart testing**128- Create tests/ directory with connection tests129- Add helm test YAML for post-deployment validation130- Include integration test scripts131132**Step 2: Documentation**133- Generate comprehensive README.md with parameter tables134- Document all values.yaml parameters with descriptions135- Add upgrade guides and migration notes136- Include troubleshooting section137138**Step 3: Chart repository packaging**139- Package chart with helm package140- Generate index.yaml for chart repository141- Sign chart with GPG for provenance142143**Output:**144- Enterprise-ready Helm chart with tests145- Complete documentation146- Packaged and signed chart ready for distribution147- Chart repository index148149---150151## Decision Rules152153**Chart structure patterns:**154- **Simple app**: Deployment, Service, ConfigMap, Secret templates only155- **Stateful app**: Add StatefulSet, PersistentVolumeClaim, headless Service156- **Ingress required**: Include Ingress template with TLS configuration157- **Jobs/CronJobs**: Add job templates with completion tracking158159**Dependency management:**160- **Include subchart**: Common dependencies (PostgreSQL, Redis) as subcharts161- **External dependency**: Reference external charts in Chart.yaml dependencies162- **Conditional dependency**: Use `condition` or `tags` for optional dependencies163164**Hook usage:**165- **Pre-install**: Database schema initialization, secret generation166- **Post-install**: Smoke tests, notification webhooks167- **Pre-upgrade**: Backup jobs, compatibility validation168- **Post-upgrade**: Migration cleanup, cache invalidation169170**Values organization:**171- **Global values**: Shared across all environments (image repository, labels)172- **Environment values**: Replicas, resources, domains (in values-{env}.yaml)173- **Secret values**: Not in values files, use external-secrets or Vault174175**Ambiguity handling:**176- If environments not specified → create values.yaml only (single environment)177- If dependencies unclear → request application architecture diagram178- If resource types unknown → infer from application type (web app → Deployment + Service)179180---181182## Output Contract183184**Required fields (all tiers):**185```yaml186chart_structure:187 Chart.yaml: "chart metadata"188 values.yaml: "default configuration values"189 templates/:190 - deployment.yaml191 - service.yaml192 - _helpers.tpl193 NOTES.txt: "post-install instructions"194195validation_results:196 helm_lint: "output of helm lint"197 template_render: "output of helm template"198 errors: ["array of validation errors if any"]199```200201**Additional T2 fields:**202```yaml203multi_environment:204 values_dev.yaml: "development overrides"205 values_staging.yaml: "staging overrides"206 values_prod.yaml: "production overrides"207208dependencies:209 Chart.yaml_dependencies: ["array of chart dependencies"]210 Chart.lock: "locked dependency versions"211212hooks:213 pre_install: ["array of pre-install hook jobs"]214 post_install: ["array of post-install hook jobs"]215 pre_upgrade: ["array of pre-upgrade hook jobs"]216217helpers:218 _helpers.tpl: "named template definitions"219220values_schema:221 values.schema.json: "JSON schema for values validation"222```223224**Additional T3 fields:**225```yaml226testing:227 tests/: ["array of test YAML files"]228 test_commands: ["helm test chart-name"]229230documentation:231 README.md: "comprehensive chart documentation"232 UPGRADING.md: "upgrade and migration guide"233234packaging:235 chart_package: "chart-name-version.tgz"236 chart_signature: "chart-name-version.tgz.prov"237 index.yaml: "chart repository index"238```239240---241242## Examples243244```yaml245# T1 Example: Chart.yaml246apiVersion: v2247name: myapp248description: A Helm chart for my application249type: application250version: 0.1.0251appVersion: "1.0.0"252maintainers:253- name: Developer254 email: dev@example.com255```256257```yaml258# T1 Example: values.yaml259replicaCount: 3260261image:262 repository: myregistry/myapp263 pullPolicy: IfNotPresent264 tag: "1.0.0"265266service:267 type: ClusterIP268 port: 80269270resources:271 limits:272 cpu: 500m273 memory: 512Mi274 requests:275 cpu: 250m276 memory: 256Mi277278autoscaling:279 enabled: false280 minReplicas: 2281 maxReplicas: 10282```283284```yaml285# T1 Example: templates/deployment.yaml286apiVersion: apps/v1287kind: Deployment288metadata:289 name: {{ include "myapp.fullname" . }}290 labels:291 {{- include "myapp.labels" . | nindent 4 }}292spec:293 replicas: {{ .Values.replicaCount }}294 selector:295 matchLabels:296 {{- include "myapp.selectorLabels" . | nindent 6 }}297 template:298 metadata:299 labels:300 {{- include "myapp.selectorLabels" . | nindent 8 }}301 spec:302 containers:303 - name: {{ .Chart.Name }}304 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"305 ports:306 - containerPort: 8080307 resources:308 {{- toYaml .Values.resources | nindent 12 }}309```310311---312313## Quality Gates314315**Token budgets (enforced):**316- **T1**: ≤2,000 tokens - basic chart structure with parameterization317- **T2**: ≤6,000 tokens - multi-environment, dependencies, hooks, validation318- **T3**: ≤12,000 tokens - testing, documentation, packaging, signing319320**Safety checks:**321- No hardcoded secrets in values.yaml or templates322- Image tags are parameterized (not hardcoded :latest)323- Resource limits defined in values.yaml324- NOTES.txt provides clear installation instructions325326**Auditability:**327- Chart.yaml includes maintainer information328- Semantic versioning for chart and app versions329- All template functions cite Helm documentation330- Dependency versions locked in Chart.lock331332**Determinism:**333- helm template renders identical output for same values334- Chart dependencies are version-locked335- Named templates produce consistent output336337**Validation requirements:**338- Chart must pass `helm lint` without errors339- Templates must render without errors using `helm template`340- T2+ charts must include values.schema.json validation341- T3 charts must pass `helm test` successfully342343---344345## Resources346347**Official Documentation (accessed 2025-10-26T01:33:54-04:00):**348- Helm Documentation: https://helm.sh/docs/349- Helm Chart Best Practices: https://helm.sh/docs/chart_best_practices/350- Chart Template Guide: https://helm.sh/docs/chart_template_guide/351- Helm Hooks: https://helm.sh/docs/topics/charts_hooks/352- Chart Dependencies: https://helm.sh/docs/helm/helm_dependency/353- Values Files: https://helm.sh/docs/chart_template_guide/values_files/354355**Template Functions:**356- Sprig Functions: http://masterminds.github.io/sprig/357- Template Function List: https://helm.sh/docs/chart_template_guide/function_list/358359**Validation and Testing:**360- Helm Lint: https://helm.sh/docs/helm/helm_lint/361- Helm Test: https://helm.sh/docs/helm/helm_test/362- Chart Testing (ct): https://github.com/helm/chart-testing363364**Chart Repositories:**365- Artifact Hub: https://artifacthub.io/366- Helm Chart Repository Guide: https://helm.sh/docs/topics/chart_repository/