Repository navigation
Include functionConfig in fn eval ResourceList output - #4801
Rohilalala wants to merge 2 commits into
Conversation
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>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
🟡 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.
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>
|
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 I checked the pipe case: with |

Fixes #3260.
kpt fn evalwrote its ResourceList output (-o stdout, or stdin input with no-o) without thefunctionConfigthe function received.kpt fn source --fn-configalready includes it.kpt fn eval pkg -o stdout -i set-labels:v0.1.5 --fn-config fn-config.yamlBefore:
items:only. After:items:followed byfunctionConfig:with the config the function ran with. That's the--fn-configfile when it is set, otherwise the ConfigMap built from the-- key=valuearguments.The
--fn-configfile is now read once inExecuteand used for both the function and the output, instead of being read again in the default filter provider.Notes:
kpt fn source, thefunctionConfigread from--fn-configkeeps the package reader's annotations (config.kubernetes.io/indexetc.).--imageand no--arguments, the function receives an empty ConfigMap, so that is what is written.-o unwrapand-o <dir>output is unchanged, because both dropfunctionConfigwhen re-reading.strings.Contains. I ran the fullTestFnEvale2e suite with Docker. Everything passes exceptwasm-function, which fails the same way onmain(unknown import: gojs::runtime.scheduleTimeoutEvent).AI usage: AI-assisted (Claude). I reviewed and tested the change.