Skip to content

Remove the WASM function runtime - #4885

Open
Adham-Kiwan wants to merge 3 commits into
kptdev:mainfrom
Adham-Kiwan:remove-wasm-runtime
Open

Adham-Kiwan wants to merge 3 commits into
kptdev:mainfrom
Adham-Kiwan:remove-wasm-runtime

Conversation

@Adham-Kiwan

@Adham-Kiwan Adham-Kiwan commented Nov 18, 2026 •

Copy link
Copy Markdown

Description

This removes the WASM function runtime from kpt, as agreed in #4881 and discussion #4878.

  • Delete pkg/fn/runtime/wasmtime.go, wasmtime_unsupported.go, nodejs.go and jsglue.go.
  • Drop the github.com/bytecodealliance/wasmtime-go and github.com/prep/wasmexec dependencies from go.mod.
  • Keep NewWasmFn and WasmFn.Run as stubs. Both now return a new ErrWasmFunctionsRemoved error: support for WASM functions has been removed from kpt, run the function as a container image or an executable instead. The WasmLoader, OciLoader and FsLoader types stay, as the issue asks, in case WASM support comes back later.
  • Keep the --allow-alpha-wasm flag and its original description on fn eval and fn render, and mark it deprecated with the message support for WASM functions has been removed from kpt (review feedback). Cobra prints that message when the flag is used and hides the flag from --help, and existing scripts get the clear error instead of "unknown flag".
  • Change the fn-render/basicpipeline-wasm and fn-eval/wasm-function e2e cases to expect the new error. Drop their setup.sh/teardown.sh and the KPT_FN_WASM_RUNTIME ?= nodejs default in make/info.mk, since nothing reads that variable any more.

What this PR leaves alone:

  • kpt alpha wasm push/pull and pkg/wasm. They are OCI push/pull helpers and do not use the runtime. I can remove them here or in a follow-up, whichever you prefer.

  • The documentation. Per the PR template, docs will come in a separate Docs: PR for Update WASM related documentation #4883.

  • A separate commit, "Build against the in-tree API and root modules", enables the replace directives in go.mod and cli/go.mod. Main hasn't built since Feature: krmignore refactor #4829: pkg/lib/krmvalidate uses kptfilev1.IsKustomization, which no released api version has yet, so every code PR fails CI the same way. Support per-step timeout field in Kptfile pipeline #4814 does the same thing. Drop that commit if main gets fixed another way first. With it, go mod tidy in cli/ works again and removes the WASM dependencies there too.

Fixes #4882

Testing

  • go build ./... in the root and cli/ modules with GOWORK=off, plus make fix fmt vet lint tidy (golangci-lint: 0 issues)
  • go test ./pkg/fn/... ./cli/fn/... pass
  • go test --tags=docker --run='TestFnRender/testdata/fn-render/basicpipeline-wasm|TestFnEval/testdata/fn-eval/wasm-function' ./e2e/ pass against a freshly built binary

AI usage

I have used AI in the creation of this PR.

I have used the following AI tools:

  • Claude Code (Claude Opus 5.5) to find the WASM code paths, make the change, and run the build and tests

I have reviewed the change and can explain it independently of the tool.

@Adham-Kiwan
Adham-Kiwan requested review from a team and a balanced review from Copilot November 18, 2026 23:34
@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kptdocs ready!

Built without sensitive environment variables

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

🟢 Approval recommended

No active review issues remain for the change removing WASM function execution.

No open issues 🎉

What changed in this PR

Removes WASM function execution from kpt for #4882, while retaining API stubs and CLI flags that report the feature’s removal. OCI push/pull helpers remain unchanged; documentation updates are deferred to #4883.

Changes:

  • Removes the Wasmtime and Node.js runtimes, JavaScript glue, and root-module runtime dependencies.
  • Makes NewWasmFn and WasmFn.Run return ErrWasmFunctionsRemoved and updates CLI flag help.
  • Updates end-to-end tests to expect failure and removes obsolete runtime setup.
File Description
pkg/​fn/​runtime/​wasmtime.go Deletes the Wasmtime runtime implementation.
pkg/​fn/​runtime/​wasmtime_unsupported.go Deletes the non-CGO Wasmtime fallback.
pkg/​fn/​runtime/​wasm.go Adds removal-error stubs while retaining loaders.
pkg/​fn/​runtime/​nodejs.go Deletes the Node.js WASM runtime.
pkg/​fn/​runtime/​jsglue.go Deletes JavaScript runtime glue.
make/​info.mk Removes the default WASM runtime environment setting.
go.sum Removes checksums for the deleted runtime dependencies.
go.mod Removes wasmtime-go and wasmexec dependencies.
e2e/​testdata/​fn-render/​basicpipeline-wasm/​.expected/​teardown.sh Removes obsolete environment cleanup.
e2e/​testdata/​fn-render/​basicpipeline-wasm/​.expected/​setup.sh Removes obsolete Node.js runtime selection.
e2e/​testdata/​fn-render/​basicpipeline-wasm/​.expected/​diff.patch Expects failed render status instead of resource mutations.
e2e/​testdata/​fn-render/​basicpipeline-wasm/​.expected/​config.yaml Expects a nonzero exit and the removal message.
e2e/​testdata/​fn-eval/​wasm-function/​.expected/​diff.patch Removes the expected successful resource mutation.
e2e/​testdata/​fn-eval/​wasm-function/​.expected/​config.yaml Expects a nonzero exit and the removal message.
cli/​fn/​render/​cmdrender.go Updates retained WASM flag help for render failures.
cli/​fn/​cmdeval/​cmdeval.go Updates retained WASM flag help for eval failures.

Review effort: Balanced

Comment thread cli/fn/cmdeval/cmdeval.go Resolved
Comment thread cli/fn/render/cmdrender.go Resolved
Adham-Kiwan and others added 3 commits November 19, 2026 15:31
Remove the wasmtime and Node.js based WASM runtimes together with the
wasmtime-go and wasmexec dependencies, as agreed in kptdev#4881.

NewWasmFn and WasmFn.Run are kept as stubs that return
ErrWasmFunctionsRemoved, so running a function with --allow-alpha-wasm
now fails with an error that says the feature was removed. The WASM
loaders are left in place in case WASM support is revisited.

The WASM e2e test cases now check for that error, and the
KPT_FN_WASM_RUNTIME default is dropped from the Makefile.

Fixes kptdev#4882

Assisted-by: Claude Code (claude-opus-5-5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
Since kptdev#4829, pkg/lib/krmvalidate uses kptfilev1.IsKustomization, which
no released github.com/kptdev/kpt/api version has yet, so the root and
cli modules no longer build from their go.mod alone. Enable the replace
directives the go.mod files keep for this case until the next API
release, and tidy both modules, which also drops the WASM runtime
dependencies from cli/go.mod.

Assisted-by: Claude Code (claude-opus-5-5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
Keep the original flag descriptions and mark the flag deprecated on fn
eval and fn render, with "support for WASM functions has been removed
from kpt" as the deprecation message. Cobra prints that message when the
flag is used and hides the flag from the help output.

Assisted-by: Claude Code (claude-opus-5-5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
@sonarqubecloud

Copy link
Copy Markdown

@aravindtga
aravindtga requested review from a team November 20, 2026 07:23
Comment thread cli/go.mod
// replace github.com/kptdev/kpt => ..
replace github.com/kptdev/kpt/api => ../api

replace github.com/kptdev/kpt => ..

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.

I think we should use the pseudo versions from main instead

Comment thread go.mod

// TODO: Comment the line below out when the next version of the API is released.
// replace github.com/kptdev/kpt/api => ./api
replace github.com/kptdev/kpt/api => ./api

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.

Use pseudo version from the head of main

@mozesl-nokia

Copy link
Copy Markdown
Contributor

@Adham-Kiwan could you please join our slack and one of the weekly community meetings to talk about your PR briefly?

(See https://github.com/kptdev/kpt#contact on how to join)

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.

Remove WASM runtime from kpt

4 participants