diff --git a/crates/types/src/v1alpha1/wasmcloud_host_config.rs b/crates/types/src/v1alpha1/wasmcloud_host_config.rs index 46e4337..5514e31 100644 --- a/crates/types/src/v1alpha1/wasmcloud_host_config.rs +++ b/crates/types/src/v1alpha1/wasmcloud_host_config.rs @@ -82,6 +82,8 @@ pub struct WasmCloudHostConfigSpec { pub certificates: Option, /// wasmCloud secrets topic prefix, must not be empty if set. pub secrets_topic_prefix: Option, + /// Maximum memory in bytes that components can use. + pub max_linear_memory_bytes: Option, } #[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)] diff --git a/examples/full-config/wasmcloud-annotated.yaml b/examples/full-config/wasmcloud-annotated.yaml index 58a1cb2..26f738c 100644 --- a/examples/full-config/wasmcloud-annotated.yaml +++ b/examples/full-config/wasmcloud-annotated.yaml @@ -71,6 +71,8 @@ spec: # Optional: Subject prefix that will be used by the host to query for wasmCloud Secrets. # See https://wasmcloud.com/docs/concepts/secrets for more context secretsTopicPrefix: "wasmcloud.secrets" + # Optional: The maximum amount of memory bytes that a component can allocate. + maxLinearMemoryBytes: 20000000 # Optional: Additional options to control how the underlying wasmCloud hosts are scheduled in Kubernetes. # This includes setting resource requirements for the nats and wasmCloud host # containers along with any additional pot template settings. diff --git a/src/controller.rs b/src/controller.rs index 06b98ce..c08038c 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -381,6 +381,14 @@ async fn pod_template(config: &WasmCloudHostConfig, ctx: Arc) -> Result }) } + if let Some(max_linear_memory_bytes) = &config.spec.max_linear_memory_bytes { + wasmcloud_env.push(EnvVar { + name: "WASMCLOUD_MAX_LINEAR_MEMORY".to_string(), + value: Some(max_linear_memory_bytes.to_string()), + ..Default::default() + }) + } + let mut wasmcloud_args = configure_observability(&config.spec); let mut nats_resources: Option = None;