Skip to content
Open
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
10 changes: 7 additions & 3 deletions pkg/unikontainers/unikontainers.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func New(bundlePath string, containerID string, rootDir string, cfg *UruncConfig
return nil, err
}

if spec.Linux == nil {
return nil, fmt.Errorf("Linux platform is required for urunc containers")
}

containerName := spec.Annotations["io.kubernetes.cri.container-name"]
if containerName == "queue-proxy" {
uniklog.Warn("This is a queue-proxy container. Adding IP env.")
Expand Down Expand Up @@ -260,7 +264,7 @@ func (u *Unikontainer) Exec(metrics m.Writer) error {

// ExecArgs
// If memory limit is set in spec, use it instead of the config default value
if u.Spec.Linux.Resources.Memory != nil {
if u.Spec.Linux.Resources != nil && u.Spec.Linux.Resources.Memory != nil {
if u.Spec.Linux.Resources.Memory.Limit != nil {
if *u.Spec.Linux.Resources.Memory.Limit > 0 {
vmmArgs.MemSizeB = uint64(*u.Spec.Linux.Resources.Memory.Limit) // nolint:gosec
Expand Down Expand Up @@ -454,10 +458,10 @@ func (u *Unikontainer) Exec(metrics m.Writer) error {
vmmArgs.Command = unikernelCmd

// pivot
_, err = findNS(u.Spec.Linux.Namespaces, specs.MountNamespace)
// We just want to check if a mount namespace was define din the list
// We just want to check if a mount namespace was defined in the list.
// Therefore, if there was no error and the mount namespace was found
// we can pivot.
_, err = findNS(u.Spec.Linux.Namespaces, specs.MountNamespace)
withPivot := err != nil
err = changeRoot(rootfsParams.MonRootfs, withPivot)
if err != nil {
Expand Down