Skip to content

Exclude fn-config from function input items in kpt fn eval#4639

Open
aravindtga wants to merge 2 commits into
kptdev:mainfrom
Nordix:fn-eval-exclude-fnconfig-from-items
Open

Exclude fn-config from function input items in kpt fn eval#4639
aravindtga wants to merge 2 commits into
kptdev:mainfrom
Nordix:fn-eval-exclude-fnconfig-from-items

Conversation

@aravindtga

Copy link
Copy Markdown
Contributor

Description

  • What changed: When --fn-config points to a file inside the package, the fn-config resource is now excluded from the function's input items in kpt fn eval. The file is preserved unmodified on disk.
  • Why it's needed: The fn-config was being passed to the function both as resourceList.functionConfig and as one of resourceList.items, causing functions like create-setters and set-namespace to modify their own configuration file.
  • How it works: Before passing resources to the function pipeline, the fn-config is identified by matching its path annotation against FnConfigPath and removed from inputResources. It is added back unmodified to outputResources before writing so the file is not deleted from disk.

Related Issue(s)

Type of Change

  • Bug fix
  • Tests

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

AI Disclosure

  • I have used AI in the creation of this PR.

If so, please describe how:
- Kiro to analyse the issue, implement the fix, and generate unit tests.

Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
@netlify

netlify Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit ce5ad89
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a58e0f7dd3aac0008466223
😎 Deploy Preview https://deploy-preview-4639--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes kpt fn eval behavior when --fn-config points to a file inside the package, ensuring the fn-config resource is not included in resourceList.items (so functions don’t accidentally mutate their own configuration) while still preserving the file on disk.

Changes:

  • Excludes the fn-config resource from function input items when it resides inside the package, and re-adds it to outputs so it isn’t deleted.
  • Adds a unit test covering fn-config exclusion behavior.
  • Updates e2e expected outputs and CLI documentation to reflect the new semantics.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
thirdparty/kyaml/runfn/runfn.go Filters fn-config out of function input items and ensures it is written back unmodified.
thirdparty/kyaml/runfn/runfn_test.go Adds a unit test for fn-config exclusion/preservation behavior.
e2e/testdata/fn-eval/save-fn/custom-pkg-path/.expected/diff.patch Updates expected patch output so fn-config is no longer modified.
e2e/testdata/fn-eval/save-fn/custom-pkg-path/.expected/config.yaml Updates expected results summary counts after fn-config exclusion.
documentation/content/en/reference/cli/fn/eval/_index.md Documents that fn-config is not treated as an input resource and won’t be modified.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread thirdparty/kyaml/runfn/runfn.go
Comment thread thirdparty/kyaml/runfn/runfn.go
Comment thread thirdparty/kyaml/runfn/runfn_test.go
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
@aravindtga
aravindtga marked this pull request as ready for review July 16, 2026 13:52
@aravindtga
aravindtga requested review from a team July 16, 2026 13:52
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. area/fn-runtime KRM function runtime bug Something isn't working labels Jul 16, 2026
@dosubot dosubot Bot added the lgtm label Jul 16, 2026
@aravindtga
aravindtga requested a review from a team July 16, 2026 14:03
@efiacor

efiacor commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Just wondering if this is the intended behaviour. Not sure myself

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

Labels

area/fn-runtime KRM function runtime bug Something isn't working lgtm size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create-setters adds incorrect comments

4 participants