-
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: support update hostname #2230
feature: support update hostname #2230
Conversation
e8c7a3e
to
f16afaa
Compare
I think this pr has updated or added too many codes, so I am afraid we have to add more pr description s to make the demand and implementation clearly. @wangforthinker |
Codecov Report
@@ Coverage Diff @@
## master #2230 +/- ##
=========================================
Coverage ? 67.44%
=========================================
Files ? 281
Lines ? 18866
Branches ? 0
=========================================
Hits ? 12724
Misses ? 4626
Partials ? 1516
|
f16afaa
to
0032d42
Compare
ping @wangforthinker |
Signed-off-by: allen.wang allen.wq@alipay.com
Ⅰ. Describe what this PR did
Consider to update container's hostname in a running container, It should join container namespace. So it imports package github.com/opencontainers/runc/libcontainer/nsenter to meet the requirement(about more implementation details refferring to Ⅳ. Describe how to verify it). Otherwise, It provides more register functions which can do more in container namespace.
Ⅱ. Does this pull request fix one issue?
fixes #2179
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
add test TestRunningContainerUpdateHostname and TestStoppedContainerUpdateHostname.
Ⅳ. Describe how to verify it
after doing update hostname, we can exec into container, and run command "hostname" to verify it.
Ⅴ. Special notes for reviews
It adds a package pkg/nsexec, which defines a function NsExec to join container namespace. It provides register functions map to allow do something in container namespace such as update hostname. It registers a reexec command called nsexec, which imports github.com/opencontainers/runc/libcontainer/nsenter to join container namespace by calling C code. Package pkg/nsexec executes new command to call pouchd nsexec.