How idsulik/helm-cel works
Project Type and Purpose
• This is a command-line Helm plugin written in Go. It integrates with the Helm CLI (via helm plugin install) or can run in a Docker container. Its two main functions are:
• validate: load user chart values and CEL rules, run expressions to enforce constraints
• generate: scan chart values and emit a skeletal CEL rules file
• Key indicators: cmd/helm-cel/main.go as entrypoint, pkg/validator and pkg/generator subdirectories, README describing Helm commands and Docker usage.
File Structure Analysis
• Top-level
• cmd/helm-cel – CLI entrypoint and command-registration
• pkg/generator – “generate” logic, building rules from values
• pkg/validator – “validate” logic, loading values, loading rules, invoking CEL engine
• pkg/models – shared data structures (e.g., chart values, rule definitions)
• pkg/utils – file I/O helpers
• scripts, Dockerfile, GitHub workflows – build/test/release automation
• Patterns
• Layered CLI architecture:
– Presentation (cmd)
– Application / orchestration (generator & validator packages)
– Domain models
– Infrastructure (utils for file loading, external calls)
• Config & Deployment
• Dockerfile for containerized plugin
• goreleaser, GitHub Actions workflows for build/test/release
README Insights
• Describes command names, flags, input/output formats, exit codes
• Discusses how rules are structured (.cel.yaml), how expressions are reused
• Mentions integration points: reading from file system, writing to stdout/exit codes, Helm plugin interface
a. Main Components
• CLI Front-end
• Command Dispatcher (parses flags, selects “validate” or “generate”)
• Generator Module
• Validator Module
• CEL Expression Engine (third-party library)
• File System (chart directory, values.yaml, .cel.yaml files)
• Output Renderer (text/json/yaml)
• External Dependencies: Helm CLI, Docker runtime (optional)
b. Relationships & Data Flows
• User invokes helm cel validate or Docker wrapper → CLI Front-end
• Dispatcher loads values files via File System → hands off to Validator
• Validator loads rules, invokes CEL Engine, produces a result object
• Result goes to Output Renderer → stdout, exit code
• Generator follows analogous flow: read values, build rule skeletons, write .cel.yaml
• All components depend on Models to share data definitions
c. Architectural Patterns
• Layered separation of concerns
• Dependency injection of file-loading and expression evaluation
• Plugin-style entrypoint decoupled from core logic
d. Technologies & Frameworks
• Go 1.22+, Go modules
• CEL library for expression parsing and evaluation
• Helm Plugin SDK (implicit via CLI approach)
• Docker for container distribution
• GitHub Actions & goreleaser for CI/CD