Skip to content

Commit

Permalink
Merge pull request #42 from joonas/feat/custom-nats-leaf-image-option
Browse files Browse the repository at this point in the history
feat: Add option to customize NATS leaf node image
  • Loading branch information
joonas authored Jun 12, 2024
2 parents 3aa081e + 5be3953 commit 0952050
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.4"
version = "0.1.5"
edition = "2021"

[dependencies]
Expand Down
4 changes: 4 additions & 0 deletions crates/types/src/v1alpha1/wasmcloud_host_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub struct WasmCloudHostConfigSpec {
/// If not provided, the default image for the version will be used.
/// Also if provided, the version field will be ignored.
pub image: Option<String>,
/// The image to use for the NATS leaf that is deployed alongside the wasmCloud host.
/// If not provided, the default upstream image will be used.
/// If provided, it should be fully qualified by including the image tag.
pub nats_leaf_image: Option<String>,
/// The name of a secret containing the primary cluster issuer key along with an optional set
/// of NATS credentials.
pub secret_name: String,
Expand Down
7 changes: 6 additions & 1 deletion src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,15 @@ fn pod_template(config: &WasmCloudHostConfig, _ctx: Arc<Context>) -> PodTemplate
None => format!("ghcr.io/wasmcloud/wasmcloud:{}", config.spec.version),
};

let leaf_image = match &config.spec.nats_leaf_image {
Some(img) => img.clone(),
None => "nats:2.10-alpine".to_string(),
};

let containers = vec![
Container {
name: "nats-leaf".to_string(),
image: Some("nats:2.10-alpine".to_string()),
image: Some(leaf_image),
args: Some(vec![
"-js".to_string(),
"--config".to_string(),
Expand Down

0 comments on commit 0952050

Please sign in to comment.