diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-11-07 16:05:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-07 16:05:03 +0100 |
commit | b4a83bf9aebb1aba3b4a5fcceb777f37036f64cb (patch) | |
tree | 22cb6ef9e56cd36bacd2b9efe9410d04ec127b5d /libpod/kube.go | |
parent | a889fd397ae56f16c71be2bf8b0a886def1559fa (diff) | |
parent | a6108f1c19f4432eff4ee1e52eef9e60d13329e5 (diff) | |
download | podman-b4a83bf9aebb1aba3b4a5fcceb777f37036f64cb.tar.gz podman-b4a83bf9aebb1aba3b4a5fcceb777f37036f64cb.tar.bz2 podman-b4a83bf9aebb1aba3b4a5fcceb777f37036f64cb.zip |
Merge pull request #4447 from rhatdan/runasuser
Add support for RunAsUser and RunAsGroup
Diffstat (limited to 'libpod/kube.go')
-rw-r--r-- | libpod/kube.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libpod/kube.go b/libpod/kube.go index d0e7baf95..47a77991e 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -487,13 +487,16 @@ func generateKubeSecurityContext(c *Container) (*v1.SecurityContext, error) { if err := c.syncContainer(); err != nil { return nil, errors.Wrapf(err, "unable to sync container during YAML generation") } + logrus.Debugf("Looking in container for user: %s", c.User()) - u, err := lookup.GetUser(c.state.Mountpoint, c.User()) + execUser, err := lookup.GetUserGroupInfo(c.state.Mountpoint, c.User(), nil) if err != nil { return nil, err } - user := int64(u.Uid) - sc.RunAsUser = &user + uid := int64(execUser.Uid) + gid := int64(execUser.Gid) + sc.RunAsUser = &uid + sc.RunAsGroup = &gid } return &sc, nil } |