Skip to content

Add oci.WithUser helper function.#2257

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
Random-Liu:add-with-user
Mar 30, 2018
Merged

Add oci.WithUser helper function.#2257
crosbymichael merged 1 commit intocontainerd:masterfrom
Random-Liu:add-with-user

Conversation

@Random-Liu
Copy link
Copy Markdown
Member

@Random-Liu Random-Liu commented Mar 30, 2018

For containerd/cri#710.

Add a oci.WithUser helper function which accepts valid user string defined in OCI image config.

This also addresses the // TODO: support username and groupname. In Kubernetes 1.10, we recently supported group id, and will support group name soon. This helper function will be very useful. :)

Signed-off-by: Lantao Liu lantaol@google.com

Signed-off-by: Lantao Liu <lantaol@google.com>
@Random-Liu Random-Liu added this to the 1.1 milestone Mar 30, 2018
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #2257 into master will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2257      +/-   ##
==========================================
+ Coverage   41.13%   41.19%   +0.06%     
==========================================
  Files          66       66              
  Lines        7758     7758              
==========================================
+ Hits         3191     3196       +5     
+ Misses       4063     4060       -3     
+ Partials      504      502       -2
Flag Coverage Δ
#windows 41.19% <ø> (+0.06%) ⬆️
Impacted Files Coverage Δ
gc/scheduler/scheduler.go 68.75% <0%> (+2.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84a7b9c...45b0045. Read the comment docs.

@stevvooe
Copy link
Copy Markdown
Member

LGTM

1 similar comment
@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit c0f7fcd into containerd:master Mar 30, 2018
@Random-Liu Random-Liu deleted the add-with-user branch March 30, 2018 20:27
Copy link
Copy Markdown
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

Ah, too slow

}
return WithUserID(uint32(v))(ctx, client, c, s)
case 2:
var username, groupname string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: use a var block

}
}

// WithUser accepts a valid user string in OCI Image Spec v1.0.0:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: The first line should be self contained usually

May something like

// WithUser sets the user to be used within the container
// It accepts a valid user string as defined in the OCI Image Spec v1.0.0:
//   user, uid, user:group, uid:gid, uid:group, user:gid

?

@Random-Liu
Copy link
Copy Markdown
Member Author

@mlaventure Will address your comments in another PR soon. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants