feat: add CEL validation rules to the CRDs#15028
Merged
Joibel merged 3 commits intoargoproj:mainfrom Nov 18, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds Common Expression Language (CEL) validation rules to Kubernetes Custom Resource Definitions (CRDs) for Argo Workflows. These validations implement some of the simpler validation rules from the existing Go validation code directly in the CRD schema, enabling Kubernetes to reject invalid resources at admission time rather than requiring application-level validation.
Key changes:
- Added CEL validation rules for template reference exclusivity, mutual exclusivity constraints, and various field validations
- Implemented validation for naming patterns, numeric constraints, and enum values
- Added format validation for cron schedules and metric configurations
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/apis/workflow/v1alpha1/workflow_types.go | Added CEL validation annotations to core workflow type definitions |
| pkg/apis/workflow/v1alpha1/generated.proto | Added CEL validation annotations to protobuf definitions |
| pkg/apis/workflow/v1alpha1/cron_workflow_types.go | Added validation for CronWorkflow schedules and concurrency policy |
| pkg/plugins/executor/swagger.yml | Added CEL validations to plugin executor swagger spec |
| manifests/*.yaml | Generated CRD manifests with CEL validation rules applied |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d1e46bc to
a5290bf
Compare
Signed-off-by: Alan Clucas <alan@clucas.org>
a5290bf to
4dae3fa
Compare
MasonM
reviewed
Nov 16, 2025
Member
MasonM
left a comment
There was a problem hiding this comment.
Looks good, but I found a few edge cases that these new validation rules would disallow
Co-authored-by: Mason Malone <651224+MasonM@users.noreply.github.com> Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
MasonM
approved these changes
Nov 17, 2025
guanguxiansheng
pushed a commit
to guanguxiansheng/argo-workflows
that referenced
this pull request
Dec 15, 2025
Signed-off-by: Alan Clucas <alan@clucas.org> Co-authored-by: Mason Malone <651224+MasonM@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #15009 and benefitting from #15003
Motivation
With full CRDs we can benefit from using CEL to validate workflows (and Cron/WFT/CWFT).
Modifications
Implement some of the simpler rules from validate.go as CEL rules too. Also implemented a few rules which seemed obvious from reading through the CRD go spec.
This is not intended as a comprehensive go at this, just a good starting point.
Template Reference Exclusivity:
Mutual Exclusivity Rules:
DAG Task Constraints:
Timeout on Non-Leaf Templates:
Cron Schedule Format:
Metric Validation:
Artifact Mode Validation:
Enum Validations:
all have restricted allowed values.
Name Pattern Constraints:
Minimum Array Sizes:
Numeric Constraints:
Verification
The #15009 test already validates all our yaml against these rules.
I deliberately violated some rules locally to prove they worked for me.
Documentation
Added comprehensive feature note