Skip to content

Commit

Permalink
fix(qemu): panic due to unchecked nil map (#718)
Browse files Browse the repository at this point in the history
Approved-by: Alexander Jung <[email protected]>
  • Loading branch information
nderjung authored Aug 9, 2023
2 parents 8a562d8 + fd5f4bf commit 2ffc259
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions machine/qemu/v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ func (service *machineV1alpha1Service) Create(ctx context.Context, machine *mach
machine.Status.LogFile = filepath.Join(machine.Status.StateDir, "machine.log")
}

if machine.Spec.Resources.Requests == nil {
machine.Spec.Resources.Requests = make(corev1.ResourceList, 2)
}

if machine.Spec.Resources.Requests.Memory().Value() == 0 {
quantity, err := resource.ParseQuantity("64M")
if err != nil {
Expand Down

0 comments on commit 2ffc259

Please sign in to comment.