-
Notifications
You must be signed in to change notification settings - Fork 950
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
feature: user configuration for cri manager #722
feature: user configuration for cri manager #722
Conversation
Codecov Report
@@ Coverage Diff @@
## master #722 +/- ##
==========================================
- Coverage 12.26% 12.24% -0.02%
==========================================
Files 97 97
Lines 5856 5865 +9
==========================================
Hits 718 718
- Misses 5087 5096 +9
Partials 51 51
Continue to review full report at Codecov.
|
daemon/mgr/spec_process.go
Outdated
@@ -59,27 +58,20 @@ func setupProcessTTY(ctx context.Context, c *ContainerMeta, spec *SpecWrapper) e | |||
} | |||
|
|||
func setupProcessUser(ctx context.Context, c *ContainerMeta, spec *SpecWrapper) (err error) { | |||
// The user option is complicated, now we only handle case "uid". | |||
// TODO: handle other cases like "user", "uid:gid", etc. | |||
if c.Config.User != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use
if c.Config.user == "" {
return nil
}
fields := strings.Split(c.Config.User, ":")
......
to reduce ident?
daemon/mgr/spec_process.go
Outdated
fields := strings.SplitN(c.Config.User, ":", 2) | ||
var u, g string | ||
fields := strings.Split(c.Config.User, ":") | ||
var u string | ||
u = fields[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u still has possibility of being empty string, just make c.Config.User
to be :asdfghj
. right?
2d046be
to
89a3c14
Compare
Signed-off-by: YaoZengzeng <[email protected]>
89a3c14
to
03d0a3b
Compare
user.UID = uint32(uid) | ||
} else { | ||
user.Username = u | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allencloud it's OK if the user option ":group", we will get an empty spec.User{} and will not cause any bad influence.
LGTM |
Signed-off-by: YaoZengzeng [email protected]
Ⅰ. Describe what this PR did
Actually the user option is so complicated in docker, it could be in format as follows:
"" | "user" | "uid" | "user:group" | "uid:gid" | "user:gid" | "uid:group"
Hmmm... It is hard to implement all of them in a short time.
With this PR, you could only specify user option with "uid", but in most cases, it is enough 😄
Ⅱ. Does this pull request fix one issue?
fixes part of #635
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews