propeller logo
k8s

String Input (WASM Component)

Pass string inputs to a WASM component via the Kubernetes operator

This runs the greet-component WASM module — a WASM Component Model binary that takes a string input and returns a greeting — through the Propeller Kubernetes operator.

Prerequisites

The operator must be deployed and a Proplet registered. Follow the end-to-end example first.

String inputs require WAVE encoding: the value must be wrapped in quotes at the WAVE layer, then escaped for YAML.

Build the WASM Module

cd propeller
make greet-component

Apply the Task

WASM_B64=$(base64 -w0 propeller/build/greet-component.wasm)
kubectl apply -n propeller-workloads -f - <<EOF
apiVersion: propeller.propeller.absmach.eu/v1
kind: Task
metadata:
  name: greet-component-example
spec:
  name: greet-component-example
  functionName: greet
  file: "${WASM_B64}"
  inputs:
    - '"John Doe"'
  propletSelector:
    propletId: "k8s-proplet"
EOF

The input '"John Doe"' is YAML for the JSON string "\"John Doe\"". The double quotes are part of the WAVE encoding for string values.

Watch and Verify

kubectl get task greet-component-example -n propeller-workloads \
  -o jsonpath='{.status.results}'

Expected result: "Hello, John Doe!"

Reference

FieldValue
functionNamegreet
inputs['"John Doe"'] (WAVE-encoded)
daemonfalse
Proplet envnone required (auto-detects component)

On this page