PitchHut
Log in / Sign up
helm-cel
13 views
Elevate your Helm charts with powerful CEL validation.
Pitch

Helm CEL is a plugin that enhances your Helm charts by allowing you to validate values using the Common Expression Language (CEL). With this tool, you can replace the traditional JSON Schema validation with more expressive rules, making your configurations robust and easier to manage.

Description

Introducing Helm CEL Plugin, a powerful Helm extension that elevates your configuration management to new heights by utilizing the Common Expression Language (CEL) for value validation. This plugin simplifies the validation process by allowing users to define expressive and concise validation rules in values.cel.yaml, as opposed to the traditional values.schema.json JSON Schema format.

Key Features

  • Expressive Validation: Define complex rules that ensure your Helm charts are configured correctly, catching potential errors early in the deployment process.
  • Seamless Integration: Effortlessly integrate CEL validation into your existing Helm charts by adding a simple YAML file.

Usage Example

To start using the Helm CEL Plugin, create a values.cel.yaml file in your chart directory. Here is an example of how to set up validation rules:

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"
  
  - expr: "!(has(values.replicaCount)) || values.replicaCount >= 1"
    desc: "if replicaCount is set, it must be at least 1"

Run the validation using:

helm cel /path/to/your/chart

If any validation rules fail, you'll receive descriptive error messages that pinpoint the exact issue, making debugging efficient:

❌ Validation failed: replica count must be at least 1
   Rule: values.replicaCount >= 1
   Path: replicaCount
   Current value: 0

Writing Validation Rules

Each rule in your values.cel.yaml consists of:

  • expr: A CEL expression that evaluates to true for valid configurations.
  • desc: A concise description of what each rule checks.

Leverage high-level functions like has(), type(), and size() to craft robust validation expressions. Here are common validation patterns integrated:

- expr: "has(values.fieldName)"
  desc: "fieldName is required"

- expr: "type(values.ports) == list"
  desc: "ports must be a list"

Contributing

Contributing to the Helm CEL Plugin is simple: fork the repository, create a feature branch, commit your changes, push it, and submit a Pull Request.

This plugin is an essential tool for anyone looking to streamline their Helm chart validations, ensuring higher quality and more reliable configurations. Start enhancing your Helm charts today with the Helm CEL Plugin!