Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rkt: Error out when the gid is empty. #27200

Merged
merged 1 commit into from
Jun 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions pkg/kubelet/rkt/rkt.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,16 @@ func setApp(imgManifest *appcschema.ImageManifest, c *api.Container, opts *kubec

// If 'User' or 'Group' are still empty at this point,
// then apply the root UID and GID.
// TODO(yifan): Instead of using root GID, we should use
// the GID which the user is in.
// TODO(yifan): If only the GID is empty, rkt should be able to determine the GID
// using the /etc/passwd file in the image.
// See https://github.com/appc/docker2aci/issues/175.
// Maybe we can remove this check in the future.
if app.User == "" {
app.User = "0"
app.Group = "0"
}
if app.Group == "" {
app.Group = "0"
return fmt.Errorf("cannot determine the GID of the app %q", imgManifest.Name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the GID of the current user maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmrts I think that requires rkt to support reading the /etc/passwd after unpacking the image.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmrts the split between in-the-container users and on-the-host users means you won't get a sensical result at best, and in reality the user here will be root because the kubelet runs as root.

Copy link
Contributor

@tmrts tmrts Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@euank I was referring to this comment. But, I see what you mean

}

// Set working directory.
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubelet/rkt/rkt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,8 @@ func generateMemoryIsolator(t *testing.T, request, limit string) appctypes.Isola

func baseApp(t *testing.T) *appctypes.App {
return &appctypes.App{
User: "0",
Group: "0",
Exec: appctypes.Exec{"/bin/foo", "bar"},
SupplementaryGIDs: []int{4, 5, 6},
WorkingDirectory: "/foo",
Expand Down