Skip to content

Commit

Permalink
feat: Add support for configuring wasmCloud Secrets
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Bergius <joonas@cosmonic.com>
  • Loading branch information
joonas committed Jul 26, 2024
1 parent 5988e64 commit a779dbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions examples/full-config/wasmcloud-annotated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ spec:
traces:
enable: false
endpoint: "traces-specific-otel-collector.svc"
secrets_topic_prefix: "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

0 comments on commit a779dbb

Please sign in to comment.