summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-08 10:06:56 -0500
committerGitHub <noreply@github.com>2021-03-08 10:06:56 -0500
commitbbb9d9b0781b06e189406cee95a64a415f9ed577 (patch)
tree6845dbcf804f56f6c1eba10d4c9f9b220569231a /libpod
parent6fe634c9165367ecf797794f016dd640bc28ff2f (diff)
parent0e36e65eaa1bab89b5d0a7a66253338e723429c5 (diff)
downloadpodman-bbb9d9b0781b06e189406cee95a64a415f9ed577.tar.gz
podman-bbb9d9b0781b06e189406cee95a64a415f9ed577.tar.bz2
podman-bbb9d9b0781b06e189406cee95a64a415f9ed577.zip
Merge pull request #9649 from rhatdan/kube
Allow users to generate a kubernetes yaml off non running containers
Diffstat (limited to 'libpod')
-rw-r--r--libpod/kube.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/libpod/kube.go b/libpod/kube.go
index 0c4f9f0a0..6feb69fea 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -676,8 +676,18 @@ func generateKubeSecurityContext(c *Container) (*v1.SecurityContext, error) {
return nil, errors.Wrapf(err, "unable to sync container during YAML generation")
}
+ mountpoint := c.state.Mountpoint
+ if mountpoint == "" {
+ var err error
+ mountpoint, err = c.mount()
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to mount %s mountpoint", c.ID())
+ }
+ defer c.unmount(false)
+ }
logrus.Debugf("Looking in container for user: %s", c.User())
- execUser, err := lookup.GetUserGroupInfo(c.state.Mountpoint, c.User(), nil)
+
+ execUser, err := lookup.GetUserGroupInfo(mountpoint, c.User(), nil)
if err != nil {
return nil, err
}