Skip to content

Commit

Permalink
feat(create): Assign memory to VM (#1616)
Browse files Browse the repository at this point in the history
Reviewed-by: Alexander Jung <alex@unikraft.io>
Approved-by: Alexander Jung <alex@unikraft.io>
  • Loading branch information
nderjung committed Apr 29, 2024
2 parents dc59dbf + 376fae5 commit 3b6315f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/cli/kraft/compose/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,18 @@ func createService(ctx context.Context, project *compose.Project, service types.
ports = append(ports, fmt.Sprintf("%s:%s:%d/%s", port.HostIP, port.Published, port.Target, port.Protocol))
}

memory := ""
if service.MemLimit > 0 {
memory = fmt.Sprintf("%d", service.MemLimit)
} else if service.MemReservation > 0 {
memory = fmt.Sprintf("%d", service.MemReservation)
}

runOptions := run.RunOptions{
Architecture: arch,
Detach: true,
Env: environ,
Memory: memory,
Name: service.Name,
Networks: networks,
NoStart: true,
Expand Down

0 comments on commit 3b6315f

Please sign in to comment.