Hamburger Cross Icon
Helm Guardrails - Lunar Policy for Deployment And Infrastructure

Helm Guardrails

Enforce Helm chart best practices including lint validation, semantic versioning, values schema presence, and dependency version pinning. Helps ensure charts are production-ready and maintainable.

Add helm to your lunar-config.yml:
uses: github://earthly/lunar-lib/policies/helm@v1.0.5

Included Guardrails

This policy includes 4 guardrails that enforce standards for your deployment and infrastructure.

Guardrail

lint-passed

Validates that all Helm charts pass helm lint. Charts that fail linting may have template errors, missing required values, or invalid YAML that will cause deployment failures.

helm lint chart validation template errors
View Guardrail
Guardrail

version-semver

Ensures Helm chart versions follow semantic versioning (semver). Consistent versioning enables reliable dependency resolution and rollback strategies.

semver semantic versioning chart version
View Guardrail
Guardrail

values-schema

Requires Helm charts to include a values.schema.json file. A values schema validates user-provided values at install time, preventing misconfiguration.

values schema values.schema.json input validation
View Guardrail
Guardrail

dependencies-pinned

Ensures all Helm chart dependencies specify version constraints. Unpinned dependencies (using * or empty version) can pull breaking changes unexpectedly.

dependencies version pinning chart dependencies
View Guardrail

How Guardrails Fit into Lunar

Lunar guardrails define your engineering standards as code. They evaluate data collected by integrations and produce pass/fail checks with actionable feedback.

Policies support gradual enforcement—from silent scoring to blocking PRs or deployments—letting you roll out standards at your own pace without disrupting existing workflows.

Learn How Lunar Works
1
Integrations Gather Data
Collectors extract metadata from code, CI pipelines, tool outputs, and scans
2
{ } Centralized as JSON
All data merged into each component's unified metadata document
3
Guardrails Enforce Standards This Policy
Real-time feedback in PRs and AI workflows

Required Integrations

This policy evaluates data gathered by one or more of the following integration(s). Make sure to enable them in your lunar-config.yml.

Documentation

View on GitHub

Helm Guardrails

Enforces Helm chart best practices for production-ready charts.

Overview

This policy validates Helm charts against best practices including lint validation, semantic versioning, values schema presence, and dependency version pinning. It helps ensure your Helm charts are well-structured, properly versioned, and safe to deploy.

Policies

This policy provides the following guardrails (use include to select a subset):

Policy Description Failure Meaning
lint-passed Validates charts pass helm lint Chart has template or YAML errors
version-semver Checks chart versions follow semver Chart version is not valid semver
values-schema Requires values.schema.json Chart missing values input validation
dependencies-pinned Checks dependency version constraints Dependency using * or empty version

Required Data

This policy reads from the following Component JSON paths:

Path Type Provided By
.k8s.helm.charts[] array helm collector
.k8s.helm.charts[].lint_passed boolean helm collector
.k8s.helm.charts[].lint_errors array helm collector
.k8s.helm.charts[].version string helm collector
.k8s.helm.charts[].version_is_semver boolean helm collector
.k8s.helm.charts[].has_values_schema boolean helm collector
.k8s.helm.charts[].dependencies[] array helm collector
.k8s.helm.charts[].dependencies[].name string helm collector
.k8s.helm.charts[].dependencies[].version string helm collector
.k8s.helm.charts[].dependencies[].is_pinned boolean helm collector

Note: Ensure the helm collector is configured before enabling this policy.

Installation

Add to your lunar-config.yml:

collectors:
  - uses: github://earthly/lunar-lib/collectors/helm@v1.0.0
    on: [kubernetes, helm]

policies:
  - uses: github://earthly/lunar-lib/policies/helm@v1.0.0
    on: [kubernetes, helm]
    enforcement: report-pr
    # include: [lint-passed, version-semver]  # Only run specific checks

Examples

Passing Example

A compliant chart with proper versioning, lint results, schema, and pinned dependencies:

{
  "k8s": {
    "helm": {
      "charts": [
        {
          "path": "charts/api",
          "name": "api",
          "version": "1.2.3",
          "version_is_semver": true,
          "lint_passed": true,
          "lint_errors": [],
          "has_values_schema": true,
          "schema_path": "charts/api/values.schema.json",
          "dependencies": [
            {
              "name": "postgresql",
              "version": "~11.9.0",
              "is_pinned": true
            }
          ]
        }
      ]
    }
  }
}

Failing Example

A chart with lint errors, non-semver version, no schema, and unpinned dependencies:

{
  "k8s": {
    "helm": {
      "charts": [
        {
          "path": "charts/app",
          "name": "app",
          "version": "latest",
          "version_is_semver": false,
          "lint_passed": false,
          "lint_errors": ["templates/deployment.yaml: error converting YAML to JSON"],
          "has_values_schema": false,
          "dependencies": [
            {
              "name": "redis",
              "version": "*",
              "is_pinned": false
            }
          ]
        }
      ]
    }
  }
}

Failure messages:

  • charts/app: Chart 'app' failed helm lint: templates/deployment.yaml: error converting YAML to JSON
  • charts/app: Chart 'app' version 'latest' is not valid semver
  • charts/app: Chart 'app' missing values.schema.json
  • charts/app: Dependency 'redis' version '*' is not pinned

Remediation

When this policy fails, resolve it by:

  1. For lint-passed failures: Run helm lint <chart-dir> locally and fix reported errors
  2. For version-semver failures: Update the version field in Chart.yaml to follow semver (e.g., 1.0.0)
  3. For values-schema failures: Add a values.schema.json file to validate chart values at install time
  4. For dependencies-pinned failures: Replace * or empty versions in Chart.yaml dependencies with version constraints (e.g., ~1.2.0, ^2.0.0, >=1.0.0 <2.0.0)

Open Source

This policy is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.

View Repository

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo