Skip to content

Commit

Permalink
Merge pull request #19367 from dfr/freebsd-kube
Browse files Browse the repository at this point in the history
libpod: fix 'podman kube generate' on FreeBSD
  • Loading branch information
openshift-merge-robot authored Jul 28, 2023
2 parents bd0fe69 + afe8d5d commit e992899
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libpod/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ func containerToV1Container(ctx context.Context, c *Container, getService bool)
}

// NOTE: a privileged container mounts all of /dev/*.
if !c.Privileged() && len(c.config.Spec.Linux.Devices) > 0 {
if !c.Privileged() && c.config.Spec.Linux != nil && len(c.config.Spec.Linux.Devices) > 0 {
// TODO Enable when we can support devices and their names
kubeContainer.VolumeDevices = generateKubeVolumeDeviceFromLinuxDevice(c.config.Spec.Linux.Devices)
return kubeContainer, kubeVolumes, nil, annotations, fmt.Errorf("linux devices: %w", define.ErrNotImplemented)
Expand Down Expand Up @@ -1134,6 +1134,11 @@ func determineCapAddDropFromCapabilities(defaultCaps, containerCaps []string) *v
}

func (c *Container) capAddDrop(caps *specs.LinuxCapabilities) *v1.Capabilities {
// FreeBSD containers don't have caps so don't dereference if it's nil
if caps == nil {
return nil
}

// Combine all the container's capabilities into a slice
containerCaps := make([]string, 0, len(caps.Ambient)+len(caps.Bounding)+len(caps.Effective)+len(caps.Inheritable)+len(caps.Permitted))
containerCaps = append(containerCaps, caps.Ambient...)
Expand Down

0 comments on commit e992899

Please sign in to comment.