Skip to content

feat(overrides): add CEL valueExpression support for dynamic override values#601

Merged
JinghanFu merged 2 commits into
mainfrom
jinghanfu/kcl-override-celValue-clean
May 14, 2026
Merged

feat(overrides): add CEL valueExpression support for dynamic override values#601
JinghanFu merged 2 commits into
mainfrom
jinghanfu/kcl-override-celValue-clean

Conversation

@JinghanFu
Copy link
Copy Markdown
Contributor

Summary

This PR adds dynamic override values via CEL using valueExpression (originally proposed as valueProgram).

Previously, overrides could only set static value. With valueExpression, override values are computed at apply time from the current live resource state, which enables scenarios like preserving VPA-adjusted fields.

This PR also aligns null and error behavior for safer reconciliation:

  • valueExpression evaluating to null is treated as no-op (skip override)
  • invalid CEL evaluation is fail-open (keep synthesized/default value)
  • invalid override JSON is surfaced in override status

Motivation

Static overrides cannot read live cluster state, so Eno could not preserve external changes made by actors such as VPA.

valueExpression allows override logic to read from current resource state and apply computed values dynamically.

Changes

Mutation pipeline

  • Added CEL-backed dynamic value support through valueExpression
  • Added parsing and validation for valueExpression
  • Applied fail-open behavior when valueExpression evaluation fails
  • Treated valueExpression null as no-op
  • Added tests for dynamic evaluation, null handling, and missing current resource scenarios

Function override API

  • Added valueExpression field on override objects
  • Added CEL parse-time validation for valueExpression
  • Expanded tests for validation and annotation serialization behavior

Reconciliation integration tests

  • Added integration coverage across SnapshotWithOverrides to Op.Apply path
  • Added cases for live-state read and override preservation behavior

Resource snapshot override status

  • Captures invalid override JSON parse errors
  • Reports parse errors in override status as InvalidJSON

Documentation and e2e

  • Updated override docs with valueExpression usage and examples
  • Added e2e coverage for dynamic valueExpression and null no-op behavior

Testing

Executed targeted tests for mutation, resource, override, reconciliation, and e2e compile/no-op invocation paths.

Standalone validation confirms the intended override behavior for this change set.

@JinghanFu JinghanFu merged commit fd4893e into main May 14, 2026
69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants