Helm chart validation has traditionally relied on JSON Schema, which, while functional, can be limiting when you need more expressive validation rules. Enter the Helm CEL Plugin - a powerful new tool that leverages Common Expression Language (CEL) to provide more flexible and powerful validation capabilities for your Helm charts.
What is CEL?Common Expression Language (CEL) is a simple, powerful expression language created by Google that makes it easy to write complex validation rules. With CEL, you can write more intuitive and expressive validation rules compared to JSON Schema while maintaining excellent performance and safety guarantees.
Getting StartedInstallation is straightforward using Helm's plugin management system:
helm plugin install https://github.com/idsulik/helm-cel Core Features Value ValidationThe plugin introduces a new command for validating your chart values:
helm cel validate ./mychartYou can specify custom files for both values and rules:
helm cel validate ./mychart --values-file prod.values.yaml --rules-file prod.cel.yaml Rule GenerationOne of the standout features is the ability to generate validation rules based on your existing values structure automatically:
helm cel generate ./mychartThis is particularly useful when starting with a new chart or when you want to create a baseline set of rules that you can then customize.
Writing Validation RulesThe rules are defined in a values.cel.yaml file, with each rule consisting of:
Here's a practical example:
rules: - expr: "has(values.service) && has(values.service.port)" desc: "service port is required" - expr: "values.service.port >= 1 && values.service.port <= 65535" desc: "service port must be between 1 and 65535" severity: warning Advanced Features Severity LevelsThe plugin supports two severity levels:
This flexibility allows you to implement both strict requirements and best-practice recommendations in your validation rules.
Reusable ExpressionsTo keep your rules DRY (Don't Repeat Yourself), you can define reusable expressions:
expressions: portRange: 'values.service.port >= 1 && values.service.port <= 65535' nodePortRange: 'values.service.nodePort >= 30000 && values.service.nodePort <= 32767' rules: - expr: "${portRange}" desc: "Service port must be valid" - expr: 'values.service.type == "NodePort" ? ${nodePortRange} : true' desc: "NodePort must be valid when type is NodePort" Common Validation PatternsHere are some practical examples of common validation scenarios:
The plugin provides clear, actionable feedback when validation fails:
❌ Validation failed: replica count must be at least 1 Rule: values.replicaCount >= 1 Path: replicaCount Current value: 0For warnings, you'll see:
⚠️ Service port must be between 1 and 65535 Rule: values.service.port >= 1 && values.service.port <= 65535 Path: service.port Current value: 80801 Why Choose Helm CEL Plugin?The Helm CEL Plugin brings a new level of sophistication to Helm chart validation. By leveraging the power of CEL, it provides a more expressive and maintainable way to ensure your Helm charts are configured correctly. Whether you're managing a single chart or maintaining a large repository of charts, this plugin can help you catch configuration issues early and ensure consistency across your Kubernetes deployments.
\ If you're tired of the limitations of JSON Schema validation, give the Helm CEL Plugin a try. Your future self (and your team) will thank you.
All Rights Reserved. Copyright , Central Coast Communications, Inc.