Skip to content
Merged
Changes from 5 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
14 changes: 13 additions & 1 deletion packages/api/internal/template-manager/template_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,19 @@ func (tm *TemplateManager) DeleteBuild(ctx context.Context, buildID uuid.UUID, t

client, err := tm.GetClusterBuildClient(clusterID, nodeID)
if err != nil {
return fmt.Errorf("failed to get builder client: %w", err)
// nodeID can be an orchestrator ID, if the build corresponds to a snapshot.
// We may want to improve this later by adding the Delete method to Orchestrator as well.
// This way we can remove the build (snapshot) from cache as well
nodeID, err = tm.GetAvailableBuildClient(ctx, clusterID)
if err != nil {
return fmt.Errorf("failed to get any available node in the cluster: %w", err)
}

zap.L().Info("Fallback to available node", zap.String("nodeID", nodeID), zap.String("clusterID", clusterID.String()))
client, err = tm.GetClusterBuildClient(clusterID, nodeID)
if err != nil {
return fmt.Errorf("failed to get builder client: %w", err)
}
}

reqCtx := metadata.NewOutgoingContext(ctx, client.GRPC.Metadata)
Expand Down
Loading