Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/wadm/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ pub struct ScaleComponent {
/// Named configuration to pass to the component.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub config: Vec<String>,
/// Whether to perform allow updates to the component (triggering a separate update)
#[serde(default)]
pub allow_update: bool,
}

from_impl!(ScaleComponent);
Expand Down
6 changes: 6 additions & 0 deletions crates/wadm/src/scaler/daemonscaler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ComponentDaemonScaler<S> {
model_name: self.spread_config.model_name.to_owned(),
annotations: BTreeMap::new(),
config: self.config.clone(),
allow_update: false,
}))
} else {
None
Expand Down Expand Up @@ -242,6 +243,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ComponentDaemonScaler<S> {
self.id(),
),
config: self.config.clone(),
allow_update: true,
}))
}
}
Expand Down Expand Up @@ -453,6 +455,7 @@ mod test {
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("ComplexOne", daemonscaler.id()),
config: vec![],
allow_update: false,
})));
assert!(cmds.contains(&Command::ScaleComponent(ScaleComponent {
component_id: component_id.to_string(),
Expand All @@ -462,6 +465,7 @@ mod test {
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("ComplexTwo", daemonscaler.id()),
config: vec![],
allow_update: false,
})));
assert!(cmds.contains(&Command::ScaleComponent(ScaleComponent {
component_id: component_id.to_string(),
Expand All @@ -471,6 +475,7 @@ mod test {
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("ComplexThree", daemonscaler.id()),
config: vec![],
allow_update: false,
})));
assert!(cmds.contains(&Command::ScaleComponent(ScaleComponent {
component_id: component_id.to_string(),
Expand All @@ -480,6 +485,7 @@ mod test {
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("ComplexFour", daemonscaler.id()),
config: vec![],
allow_update: false,
})));

Ok(())
Expand Down
18 changes: 13 additions & 5 deletions crates/wadm/src/scaler/spreadscaler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ComponentSpreadScaler<S> {
model_name: self.spread_config.model_name.to_owned(),
annotations: BTreeMap::new(),
config: self.config.clone(),
allow_update: false,
}))
} else {
None
Expand Down Expand Up @@ -237,6 +238,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ComponentSpreadScaler<S> {
model_name: self.spread_config.model_name.to_owned(),
annotations: spreadscaler_annotations(&spread.name, self.id()),
config: self.config.clone(),
allow_update: true,
})])
}
// Stop components to reach desired instances
Expand All @@ -261,6 +263,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ComponentSpreadScaler<S> {
model_name: self.spread_config.model_name.to_owned(),
annotations: spreadscaler_annotations(&spread.name, self.id()),
config: self.config.clone(),
allow_update: false,
}));
}
(current_stopped, commands)
Expand Down Expand Up @@ -869,7 +872,8 @@ mod test {
count: 53,
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("EastZone", spreadscaler.id()),
config: vec![]
config: vec![],
allow_update: false,
})));

assert!(cmds.contains(&Command::ScaleComponent(ScaleComponent {
Expand All @@ -879,7 +883,8 @@ mod test {
count: 3,
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("WestZone", spreadscaler.id()),
config: vec![]
config: vec![],
allow_update: false,
})));

assert!(cmds.contains(&Command::ScaleComponent(ScaleComponent {
Expand All @@ -889,7 +894,8 @@ mod test {
count: 47,
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("CentralZone", spreadscaler.id()),
config: vec![]
config: vec![],
allow_update: false,
})));

Ok(())
Expand Down Expand Up @@ -1322,7 +1328,8 @@ mod test {
count: 0,
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("default", spreadscaler.id()),
config: vec![]
config: vec![],
allow_update: false,
})));
assert!(cmds.contains(&Command::ScaleComponent(ScaleComponent {
component_id: component_id.clone(),
Expand All @@ -1331,7 +1338,8 @@ mod test {
count: 0,
model_name: MODEL_NAME.to_string(),
annotations: spreadscaler_annotations("default", spreadscaler.id()),
config: vec![]
config: vec![],
allow_update: false,
})));
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions crates/wadm/src/workers/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl Worker for CommandWorker {
component.count,
Some(annotations.into_iter().collect()),
component.config.clone(),
// TODO: component.allow_update
)
.await
}
Expand Down
2 changes: 2 additions & 0 deletions tests/command_consumer_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ async fn test_consumer_stream() {
model_name: "fake".into(),
annotations: BTreeMap::new(),
config: vec![],
allow_update: false,
})
.await;
wrapper
Expand Down Expand Up @@ -166,6 +167,7 @@ async fn test_nack_and_rereceive() {
model_name: "fake".into(),
annotations: BTreeMap::new(),
config: vec![],
allow_update: false,
})
.await;

Expand Down
13 changes: 12 additions & 1 deletion tests/command_worker_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async fn test_commands() {
model_name: "fake".into(),
annotations: BTreeMap::new(),
config: vec![],
allow_update: false,
})
.await;

Expand Down Expand Up @@ -295,6 +296,7 @@ async fn test_commands() {
model_name: "fake".into(),
annotations: BTreeMap::new(),
config: vec![],
allow_update: false,
})
.await;

Expand Down Expand Up @@ -353,7 +355,15 @@ async fn test_annotation_stop() {
// acts on _everything_. We could technically move this back down after the initial scale up of
// the managed components after https://github.com/wasmCloud/wasmCloud/issues/746 is resolved
ctl_client
.scale_component(host_id, HELLO_IMAGE_REF, "unmanaged-hello", 1, None, vec![])
.scale_component(
host_id,
HELLO_IMAGE_REF,
"unmanaged-hello",
1,
None,
vec![],
/* false */
)
.await
.unwrap();

Expand Down Expand Up @@ -433,6 +443,7 @@ async fn test_annotation_stop() {
model_name: "fake".into(),
annotations: BTreeMap::from_iter([("fake".to_string(), "wake".to_string())]),
config: vec![],
allow_update: false,
})
.await;

Expand Down