Skip to content

Commit

Permalink
feat: Add support for configuring wasmCloud Secrets (#82)
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Bergius <joonas@cosmonic.com>
  • Loading branch information
joonas authored Aug 1, 2024
1 parent 5988e64 commit d90e460
Show file tree
Hide file tree
Showing 8 changed files with 800 additions and 475 deletions.
225 changes: 202 additions & 23 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmcloud-operator"
version = "0.3.1"
version = "0.4.0"
edition = "2021"

[[bin]]
Expand Down Expand Up @@ -94,9 +94,9 @@ tracing-opentelemetry = "0.22"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
utoipa = { version = "4.1", features = ["axum_extras"] }
uuid = { version = "1", features = ["v5"] }
wadm = "0.12.2"
wadm-client = "0.1.2"
wadm-types = "0.1.0"
wadm = "0.13.0"
wadm-client = "0.2.0"
wadm-types = "0.2.0"
wasmcloud-operator-types = { version = "*", path = "./crates/types" }

[workspace]
Expand Down
2 changes: 1 addition & 1 deletion crates/types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmcloud-operator-types"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

[dependencies]
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/v1alpha1/wasmcloud_host_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ pub struct WasmCloudHostConfigSpec {
pub observability: Option<ObservabilityConfiguration>,
/// Certificates: Authorities, client certificates
pub certificates: Option<WasmCloudHostCertificates>,
/// wasmCloud secrets topic prefix, must not be empty if set.
pub secrets_topic_prefix: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
Expand Down
3 changes: 3 additions & 0 deletions examples/full-config/wasmcloud-annotated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ spec:
traces:
enable: false
endpoint: "traces-specific-otel-collector.svc"
# 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: 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.
Expand Down
8 changes: 8 additions & 0 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,14 @@ async fn pod_template(config: &WasmCloudHostConfig, ctx: Arc<Context>) -> Result
}
}

if let Some(secrets_prefix) = &config.spec.secrets_topic_prefix {
wasmcloud_env.push(EnvVar {
name: "WASMCLOUD_SECRETS_TOPIC".to_string(),
value: Some(secrets_prefix.clone()),
..Default::default()
})
}

let mut wasmcloud_args = configure_observability(&config.spec);

let mut nats_resources: Option<k8s_openapi::api::core::v1::ResourceRequirements> = None;
Expand Down
Loading

0 comments on commit d90e460

Please sign in to comment.