Skip to content

Include functionConfig in fn eval ResourceList output - #4801

Open
Rohilalala wants to merge 2 commits into
kptdev:mainfrom
Rohilalala:fix/eval-output-function-config
Open

Rohilalala wants to merge 2 commits into
kptdev:mainfrom
Rohilalala:fix/eval-output-function-config

Conversation

@Rohilalala

Copy link
Copy Markdown

Fixes #3260.

kpt fn eval wrote its ResourceList output (-o stdout, or stdin input with no -o) without the functionConfig the function received. kpt fn source --fn-config already includes it.

kpt fn eval pkg -o stdout -i set-labels:v0.1.5 --fn-config fn-config.yaml

Before: items: only. After: items: followed by functionConfig: with the config the function ran with. That's the --fn-config file when it is set, otherwise the ConfigMap built from the -- key=value arguments.

The --fn-config file is now read once in Execute and used for both the function and the output, instead of being read again in the default filter provider.

Notes:

  • Like kpt fn source, the functionConfig read from --fn-config keeps the package reader's annotations (config.kubernetes.io/index etc.).
  • With --image and no -- arguments, the function receives an empty ConfigMap, so that is what is written.
  • -o unwrap and -o <dir> output is unchanged, because both drop functionConfig when re-reading.
  • The e2e goldens didn't need changes: the runner matches stdout with strings.Contains. I ran the full TestFnEval e2e suite with Docker. Everything passes except wasm-function, which fails the same way on main (unknown import: gojs::runtime.scheduleTimeoutEvent).

AI usage: AI-assisted (Claude). I reviewed and tested the change.

kpt fn eval wrote its ResourceList output (-o stdout, or stdin input
with no -o) without the functionConfig the function received, unlike
kpt fn source. Pass the same config to the output writer.

Read the --fn-config file once in Execute, so the function and the
output get the same value, instead of reading it again in the filter
provider.

Fixes kptdev#3260

Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>
@Rohilalala
Rohilalala requested review from a team and a balanced review from Copilot October 12, 2026 20:24
@netlify

netlify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit d4df756
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6ace004a3200d1e9ec3c3c1a
😎 Deploy Preview https://deploy-preview-4801--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.

🟡 Changes recommended

The new path-based test bypasses the behavior it intends to verify by re-reading the configuration in its fake provider.

1 open finding
What changed in this PR

Adds functionConfig to wrapped kpt fn eval ResourceList output.

Changes:

  • Reads file-based function configuration once during execution.
  • Writes the effective function configuration into ResourceList output.
  • Adds output-focused unit tests.
File Description
thirdparty/​kyaml/​runfn/​runfn.go Loads and emits the effective function configuration.
thirdparty/​kyaml/​runfn/​runfn_test.go Tests ResourceList functionConfig output.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread thirdparty/kyaml/runfn/runfn_test.go Outdated
The path test's fake provider re-read FnConfigPath itself, so it passed
even if the function got the command-line config. Use the provider that
takes the config passed by getFilters.

Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>

@mozesl-nokia mozesl-nokia 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.

Just a heads up, this issue has not been triaged yet in our current (neverending) triaging round!

(Also, I cannot assign the issue to you, maybe you need to leave a comment on it so your handle shows up in the list.)

Comment thread thirdparty/kyaml/runfn/runfn.go
@Rohilalala

Copy link
Copy Markdown
Author

I think you mean #4639 (and #4673 for render). Those keep a function's own fn-config file out of its input items. This PR doesn't change that. It only adds the separate functionConfig field to eval's ResourceList output, as kpt fn source --fn-config already does.

I checked the pipe case: with kpt fn eval pkg -o stdout -- first=one | kpt fn eval - -- second=two, the second function receives only the package resources as items, plus its own config. kio.ByteReader reads an incoming functionConfig into its FunctionConfig field, not into items, and runfn uses the CLI config for the next function.

This branch has not been deployed

No deployments
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.

kpt fn eval swallow functionConfig in output

3 participants