wasmmodule

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RunnerConfigName is the name of the ConfigMap containing runner configuration.
	RunnerConfigName = "config-runner"
)

Variables

View Source
var (
	// DefaultRunnerImage is the default image for the WASM runner.
	// Can be overridden at build time with -ldflags "-X pkg/reconciler/wasmmodule.DefaultRunnerImage=...".
	//nolint:gochecknoglobals // Build-time configuration
	DefaultRunnerImage = "ghcr.io/cardil/knative-serving-wasm/runner"

	// DefaultImagePullPolicy is the default image pull policy for the WASM runner.
	// Can be overridden at build time with -ldflags "-X pkg/reconciler/wasmmodule.DefaultImagePullPolicy=Always"
	// Empty string means use Kubernetes default (IfNotPresent).
	//nolint:gochecknoglobals // Build-time configuration
	DefaultImagePullPolicy = ""

	// ErrValueFromNotSupported is returned when an env var uses valueFrom.
	ErrValueFromNotSupported = errors.New("valueFrom is not yet supported")
	// ErrUndefinedVolume is returned when a volume mount references a volume that is not defined.
	ErrUndefinedVolume = errors.New("undefined volume reference")
)

Functions

func BuildRunnerConfig

func BuildRunnerConfig(wm *api.WasmModule) (string, error)

BuildRunnerConfig builds the WASI configuration JSON for the runner.

func MatchesInsecureRegistry added in v0.2.0

func MatchesInsecureRegistry(image string, insecureRegistries []string) bool

MatchesInsecureRegistry reports whether the OCI image reference's registry host matches any entry in the insecure registries list.

func NewController

func NewController(
	ctx context.Context,
	cmw configmap.Watcher,
) *controller.Impl

NewController creates a Reconciler and returns the result of NewImpl.

Types

type Reconciler

type Reconciler struct {
	// Tracker builds an index of what resources are watching other resources
	// so that we can immediately react to changes tracked resources.
	Tracker tracker.Interface

	// Listers index properties about resources
	ServiceLister servingv1listers.ServiceLister

	// Client is used to create the service
	Client servingv1client.ServingV1Interface

	// RunnerConfigStore holds the runner configuration from config-runner ConfigMap.
	RunnerConfigStore *RunnerConfigStore
}

Reconciler implements apireconciler.Interface for WasmModule resources.

func (*Reconciler) ReconcileKind

func (r *Reconciler) ReconcileKind(ctx context.Context, module *api.WasmModule) reconciler.Event

ReconcileKind implements Interface.ReconcileKind.

type RunnerConfig added in v0.2.0

type RunnerConfig struct {
	// InsecureRegistries is the list of registry host[:port] entries that the
	// runner should access over plain HTTP instead of HTTPS.
	InsecureRegistries []string
}

RunnerConfig holds the runner-level configuration read from the config-runner ConfigMap.

func NewRunnerConfigFromConfigMap added in v0.2.0

func NewRunnerConfigFromConfigMap(cm *corev1.ConfigMap) (*RunnerConfig, error)

NewRunnerConfigFromConfigMap creates a RunnerConfig from the given ConfigMap.

type RunnerConfigStore added in v0.2.0

type RunnerConfigStore struct {
	*configmap.UntypedStore
}

RunnerConfigStore is a store for the runner configuration.

func NewRunnerConfigStore added in v0.2.0

func NewRunnerConfigStore(logger configmap.Logger) *RunnerConfigStore

NewRunnerConfigStore creates a new RunnerConfigStore.

func (*RunnerConfigStore) GetRunnerConfig added in v0.2.0

func (s *RunnerConfigStore) GetRunnerConfig() *RunnerConfig

GetRunnerConfig fetches the current RunnerConfig from the store.

type RunnerDirConfig

type RunnerDirConfig struct {
	HostPath  string `json:"hostPath"`
	GuestPath string `json:"guestPath"`
	ReadOnly  bool   `json:"readOnly"`
}

RunnerDirConfig represents a directory mount configuration.

type RunnerNetworkConfig

type RunnerNetworkConfig struct {
	Inherit           bool     `json:"inherit,omitempty"`
	AllowIPNameLookup bool     `json:"allowIpNameLookup,omitempty"`
	TCPBind           []string `json:"tcpBind,omitempty"`
	TCPConnect        []string `json:"tcpConnect,omitempty"`
	UDPBind           []string `json:"udpBind,omitempty"`
	UDPConnect        []string `json:"udpConnect,omitempty"`
	UDPOutgoing       []string `json:"udpOutgoing,omitempty"`
}

RunnerNetworkConfig represents network configuration for the runner.

type RunnerWasiConfig

type RunnerWasiConfig struct {
	Args    []string             `json:"args,omitempty"`
	Env     map[string]string    `json:"env,omitempty"`
	Dirs    []RunnerDirConfig    `json:"dirs,omitempty"`
	Network *RunnerNetworkConfig `json:"network,omitempty"`
}

RunnerWasiConfig represents the WASI configuration passed to the runner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL