Skip to content

Commit f6a4eda

Browse files
Adham-Kiwanclaude
andcommitted
Remove the WASM function runtime
Remove the wasmtime and Node.js based WASM runtimes together with the wasmtime-go and wasmexec dependencies, as agreed in #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 #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>
1 parent 8558eb7 commit f6a4eda

16 files changed

Lines changed: 34 additions & 1032 deletions

File tree

‎cli/fn/cmdeval/cmdeval.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ func GetEvalFnRunner(ctx context.Context, parent string) *EvalFnRunner {
103103
})
104104

105105
r.Command.Flags().BoolVar(
106-
&r.RunnerOptions.AllowWasm, "allow-alpha-wasm", false, "allow alpha wasm functions to be run."+
107-
" If true, you can specify a wasm image with --image flag or a path to a wasm file (must have the .wasm file extension) with --exec flag.")
106+
&r.RunnerOptions.AllowWasm, "allow-alpha-wasm", false, "support for WASM functions has been removed from kpt."+
107+
" If true, running a function given with --image, or a .wasm file given with --exec, fails with an error.")
108108

109109
// selector flags
110110
r.Command.Flags().StringVar(

‎cli/fn/render/cmdrender.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func NewRunner(ctx context.Context, parent string) *Runner {
6868
c.Flags().BoolVar(&r.RunnerOptions.AllowNetwork, "allow-network", false,
6969
"allow functions to access network during pipeline execution.")
7070
c.Flags().BoolVar(&r.RunnerOptions.AllowWasm, "allow-alpha-wasm", r.RunnerOptions.AllowWasm,
71-
"allow wasm to be used during pipeline execution.")
71+
"support for WASM functions has been removed from kpt. If true, every pipeline function fails with an error.")
7272
cmdutil.FixDocs("kpt", parent, c)
7373
r.Command = c
7474
return r

‎e2e/testdata/fn-eval/wasm-function/.expected/config.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2022 The kpt Authors
1+
# Copyright 2022-2026 The kpt Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -17,3 +17,5 @@ image: ghcr.io/kptdev/krm-functions-catalog/wasm/set-namespace:v0.5.1
1717
args:
1818
namespace: staging
1919
allowWasm: true
20+
exitCode: 1
21+
stdErr: "support for WASM functions has been removed from kpt"

‎e2e/testdata/fn-eval/wasm-function/.expected/diff.patch‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎e2e/testdata/fn-render/basicpipeline-wasm/.expected/config.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2022 The kpt Authors
1+
# Copyright 2022-2026 The kpt Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -14,3 +14,5 @@
1414

1515
sequential: true
1616
allowWasm: true
17+
exitCode: 1
18+
stdErr: "support for WASM functions has been removed from kpt"
Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,22 @@
11
diff --git a/Kptfile b/Kptfile
2-
index 17a7822..98fa855 100644
2+
index 17a7822..b3032ae 100644
33
--- a/Kptfile
44
+++ b/Kptfile
5-
@@ -12,3 +12,22 @@ pipeline:
5+
@@ -12,3 +12,17 @@ pipeline:
66
- image: ghcr.io/kptdev/krm-functions-catalog/wasm/set-labels:v0.2.4
77
configMap:
88
tier: backend
99
+status:
1010
+ conditions:
1111
+ - type: Rendered
12-
+ status: "True"
13-
+ reason: RenderSuccess
12+
+ status: "False"
13+
+ reason: RenderFailed
14+
+ message: |-
15+
+ pkg.render: pkg .:
16+
+ pipeline.run: support for WASM functions has been removed from kpt, run the function as a container image or an executable instead
1417
+ renderStatus:
1518
+ mutationSteps:
1619
+ - image: ghcr.io/kptdev/krm-functions-catalog/wasm/set-namespace:v0.5.1
17-
+ exitCode: 0
18-
+ results:
19-
+ - message: namespace [default] updated to "staging", 1 value(s) changed
20-
+ severity: info
21-
+ - message: all `depends-on` annotations are up-to-date. no `namespace` changed
22-
+ severity: info
23-
+ - image: ghcr.io/kptdev/krm-functions-catalog/wasm/set-labels:v0.2.4
24-
+ exitCode: 0
25-
+ results:
26-
+ - message: set 4 labels in total
27-
+ severity: info
28-
diff --git a/resources.yaml b/resources.yaml
29-
index eed43d6..c1de2b0 100644
30-
--- a/resources.yaml
31-
+++ b/resources.yaml
32-
@@ -15,12 +15,20 @@ apiVersion: apps/v1
33-
kind: Deployment
34-
metadata:
35-
name: nginx-deployment
36-
+ namespace: staging
37-
+ labels:
38-
+ tier: backend
39-
spec:
40-
replicas: 3
41-
+ selector:
42-
+ matchLabels:
43-
+ tier: backend
44-
---
45-
apiVersion: custom.io/v1
46-
kind: Custom
47-
metadata:
48-
name: custom
49-
+ labels:
50-
+ tier: backend
51-
spec:
52-
image: nginx:1.2.3
20+
+ executionError: support for WASM functions has been removed from kpt, run the function as a container image or an executable instead
21+
+ exitCode: 1
22+
+ errorSummary: 'ghcr.io/kptdev/krm-functions-catalog/wasm/set-namespace:v0.5.1: support for WASM functions has been removed from kpt, run the function as a container image or an executable instead'

‎e2e/testdata/fn-render/basicpipeline-wasm/.expected/setup.sh‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎e2e/testdata/fn-render/basicpipeline-wasm/.expected/teardown.sh‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎go.mod‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ go 1.26.9
77

88
require (
99
github.com/Masterminds/semver/v3 v3.5.0
10-
github.com/bytecodealliance/wasmtime-go v1.0.0
1110
github.com/cpuguy83/go-md2man/v2 v2.0.7
1211
github.com/distribution/reference v0.6.0
1312
github.com/go-errors/errors v1.5.1
@@ -18,7 +17,6 @@ require (
1817
github.com/otiai10/copy v1.14.1
1918
github.com/philopon/go-toposort v0.0.0-20170620085441-9be86dbd762f
2019
github.com/pkg/errors v0.9.1
21-
github.com/prep/wasmexec v0.0.0-20220807105708-6554945c1dec
2220
github.com/regclient/regclient v0.11.5
2321
github.com/spf13/cobra v1.10.2
2422
github.com/stretchr/testify v1.11.1

‎go.sum‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
1414
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
1515
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
1616
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
17-
github.com/bytecodealliance/wasmtime-go v1.0.0 h1:9u9gqaUiaJeN5IoD1L7egD8atOnTGyJcNp8BhkL9cUU=
18-
github.com/bytecodealliance/wasmtime-go v1.0.0/go.mod h1:jjlqQbWUfVSbehpErw3UoWFndBXRRMvfikYH6KsCwOg=
1917
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
2018
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
2119
github.com/chai2010/gettext-go v1.0.3 h1:9liNh8t+u26xl5ddmWLmsOsdNLwkdRTg5AG+JnTiM80=
@@ -164,8 +162,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
164162
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
165163
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
166164
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
167-
github.com/prep/wasmexec v0.0.0-20220807105708-6554945c1dec h1:Yz85KaIsPzF0YRrznNaD35o4GEk65/3mqio3m9sgqi4=
168-
github.com/prep/wasmexec v0.0.0-20220807105708-6554945c1dec/go.mod h1:/AG7CoBOwtk42jdCTLbd280PA4h50oaFK88jee+BaVA=
169165
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
170166
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
171167
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=

0 commit comments

Comments
 (0)