Skip to content
Merged
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
13 changes: 9 additions & 4 deletions crates/wash-runtime/src/washlet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ async fn workload_start(
anyhow::bail!("workload is required");
};

let workload_id = req.workload_id.clone();
if workload_id.is_empty() {
anyhow::bail!("workload_id is required");
}

let (components, host_interfaces) = if let Some(wit_world) = wit_world {
let mut pulled_components = Vec::with_capacity(wit_world.components.len());
for component in &wit_world.components {
Expand All @@ -307,7 +312,7 @@ async fn workload_start(
Err(e) => {
return Ok(types::v2::WorkloadStartResponse {
workload_status: Some(types::v2::WorkloadStatus {
workload_id: "".into(),
workload_id: workload_id.clone(),
workload_state: types::v2::WorkloadState::Error.into(),
message: format!(
"failed to pull component image {}: {}",
Expand Down Expand Up @@ -348,7 +353,7 @@ async fn workload_start(
Err(e) => {
return Ok(types::v2::WorkloadStartResponse {
workload_status: Some(types::v2::WorkloadStatus {
workload_id: "".into(),
workload_id: workload_id.clone(),
workload_state: types::v2::WorkloadState::Error.into(),
message: format!("failed to pull service image {}: {}", service.image, e),
}),
Expand All @@ -371,7 +376,7 @@ async fn workload_start(
let volumes = volumes.into_iter().map(Into::into).collect();

let request = crate::types::WorkloadStartRequest {
workload_id: uuid::Uuid::new_v4().to_string(),
workload_id: workload_id.clone(),
workload: crate::types::Workload {
namespace,
name,
Expand All @@ -384,7 +389,7 @@ async fn workload_start(
};

info!(
worload_id=?request.workload_id,
worload_id=?workload_id,
namespace=?request.workload.namespace,
name=?request.workload.name,
"Starting workload");
Expand Down
7 changes: 7 additions & 0 deletions proto/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,13 @@ <h3 id="wasmcloud.runtime.v2.WorkloadStartRequest">WorkloadStartRequest</h3>
<td><p> </p></td>
</tr>

<tr>
<td>workload_id</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>

</tbody>
</table>

Expand Down
1 change: 1 addition & 0 deletions proto/wasmcloud/runtime/v2/workload_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ service WorkloadService {

message WorkloadStartRequest {
Workload workload = 1;
string workload_id = 2;
}

message WorkloadStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func (r *WorkloadReconciler) reconcilePlacement(ctx context.Context, workload *r
}

req := &runtimev2.WorkloadStartRequest{
WorkloadId: string(workload.GetUID()),
Workload: &runtimev2.Workload{
Namespace: workload.Namespace,
Name: workload.Name,
Expand Down
146 changes: 78 additions & 68 deletions runtime-operator/pkg/rpc/wasmcloud/runtime/v2/workload_service.pb.go

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

Loading