Skip to content

feat: implement Kpt function conditional rendering via CEL (Issue #1084)#1086

Open
SurbhiAgarwal1 wants to merge 2 commits into
nephio-project:mainfrom
SurbhiAgarwal1:main
Open

feat: implement Kpt function conditional rendering via CEL (Issue #1084)#1086
SurbhiAgarwal1 wants to merge 2 commits into
nephio-project:mainfrom
SurbhiAgarwal1:main

Conversation

@SurbhiAgarwal1
Copy link
Copy Markdown

Fixes kptdev/porch#905

Summary

This PR implements kpt function conditional rendering via CEL expressions to ensure server-side rendering in Porch stays consistent with local kpt fn render.

Changes

  • Fixed bug in GetFunctionCondition (kptfile.go): corrected variable name in validators loop, method names, and type names
  • Implemented CEL condition evaluation in cel.go with proper YAML unmarshaling
  • Added unit tests for CEL evaluation (cel_test.go)
  • Added unit tests for GetFunctionCondition in kptfile_test.go
  • Added e2e pipeline test with condition: "false" on ipam-fn demonstrating function skipping
  • Updated dependencies: added cel-go to lib module, fixed genproto version conflicts

Testing

  • All unit tests pass: go test ./cel/... ./kptfile/...
  • E2e test passes: go test -run TestPipelinesWithConditions
  • Test coverage includes mutators, validators, and container runtime

Verification

Functions with a condition field in the Kptfile pipeline are now properly evaluated and skipped when the CEL expression evaluates to false, matching the behavior of local kpt fn render.

- Fix GetFunctionCondition bug in kptfile.go (m → v in validators loop, GetFieldString → GetString, SubObjects → SliceSubObjects)
- Implement CEL condition evaluation in cel.go with proper YAML unmarshaling
- Add unit tests: cel_test.go and GetFunctionCondition tests in kptfile_test.go
- Add e2e pipeline test with condition: 'false' on ipam-fn (upf_pkg_cond testdata)
- Ensure server-side rendering stays consistent with local kpt fn render
- Update dependencies: add cel-go to lib, fix genproto/googleapis/api version
@nephio-prow
Copy link
Copy Markdown
Contributor

nephio-prow Bot commented Apr 4, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign johnbelamaric for approval by writing /assign @johnbelamaric in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 4, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

@nephio-prow
Copy link
Copy Markdown
Contributor

nephio-prow Bot commented Apr 4, 2026

Hi @SurbhiAgarwal1. Thanks for your PR.

I'm waiting for a nephio-project member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nagygergo
Copy link
Copy Markdown

Hey, you're trying to work against the wrong repository here, please check: https://github.com/nephio-project/porch. All the porch issues are tracked against the nephio repository for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kpt function conditional rendering

2 participants