Skip to content

Commit 6f63289

Browse files
authored
feat: Configure max component memory (#91)
* feat: Configure max component memory Signed-off-by: Lucas Fontes <[email protected]> * chore: Bumping versions Signed-off-by: Lucas Fontes <[email protected]> --------- Signed-off-by: Lucas Fontes <[email protected]>
1 parent 788cbc0 commit 6f63289

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

Diff for: Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasmcloud-operator"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition = "2021"
55

66
[[bin]]
@@ -77,7 +77,7 @@ opentelemetry_sdk = { version = "0.21", features = [
7777
"metrics",
7878
"trace",
7979
"rt-tokio",
80-
]}
80+
] }
8181
opentelemetry-otlp = { version = "0.14", features = ["tokio"] }
8282
rcgen = "0.11"
8383
schemars = "0.8"

Diff for: crates/types/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "wasmcloud-operator-types"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
edition = "2021"
55

66
[dependencies]
7-
k8s-openapi = {workspace = true}
8-
kube = {workspace = true, features = ["derive"]}
9-
schemars = {workspace = true}
10-
serde = {workspace = true}
11-
serde_json = {workspace = true}
7+
k8s-openapi = { workspace = true }
8+
kube = { workspace = true, features = ["derive"] }
9+
schemars = { workspace = true }
10+
serde = { workspace = true }
11+
serde_json = { workspace = true }

Diff for: crates/types/src/v1alpha1/wasmcloud_host_config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ pub struct WasmCloudHostConfigSpec {
8282
pub certificates: Option<WasmCloudHostCertificates>,
8383
/// wasmCloud secrets topic prefix, must not be empty if set.
8484
pub secrets_topic_prefix: Option<String>,
85+
/// Maximum memory in bytes that components can use.
86+
pub max_linear_memory_bytes: Option<u32>,
8587
}
8688

8789
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]

Diff for: examples/full-config/wasmcloud-annotated.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ spec:
7171
# Optional: Subject prefix that will be used by the host to query for wasmCloud Secrets.
7272
# See https://wasmcloud.com/docs/concepts/secrets for more context
7373
secretsTopicPrefix: "wasmcloud.secrets"
74+
# Optional: The maximum amount of memory bytes that a component can allocate.
75+
maxLinearMemoryBytes: 20000000
7476
# Optional: Additional options to control how the underlying wasmCloud hosts are scheduled in Kubernetes.
7577
# This includes setting resource requirements for the nats and wasmCloud host
7678
# containers along with any additional pot template settings.

Diff for: src/controller.rs

+8
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ async fn pod_template(config: &WasmCloudHostConfig, ctx: Arc<Context>) -> Result
381381
})
382382
}
383383

384+
if let Some(max_linear_memory_bytes) = &config.spec.max_linear_memory_bytes {
385+
wasmcloud_env.push(EnvVar {
386+
name: "WASMCLOUD_MAX_LINEAR_MEMORY".to_string(),
387+
value: Some(max_linear_memory_bytes.to_string()),
388+
..Default::default()
389+
})
390+
}
391+
384392
let mut wasmcloud_args = configure_observability(&config.spec);
385393

386394
let mut nats_resources: Option<k8s_openapi::api::core::v1::ResourceRequirements> = None;

0 commit comments

Comments
 (0)