Merge pull request #43890 from xlgao-zju/more-robust

Automatic merge from submit-queue

Make func modifySandboxNamespaceOptions() more robust

Make func `modifySandboxNamespaceOptions()` more robust, just like what we do in func [`modifyContainerNamespaceOptions`](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/dockershim/security_context.go#L117).

/cc @feiskyer 

Signed-off-by: Xianglin Gao <xlgao@zju.edu.cn>
This commit is contained in:
Kubernetes Submit Queue 2017-03-31 12:27:03 -07:00 committed by GitHub
commit 8dde5f2cb0

View File

@ -109,8 +109,12 @@ func modifyHostConfig(sc *runtimeapi.LinuxContainerSecurityContext, hostConfig *
// modifySandboxNamespaceOptions apply namespace options for sandbox
func modifySandboxNamespaceOptions(nsOpts *runtimeapi.NamespaceOption, hostConfig *dockercontainer.HostConfig, network *knetwork.PluginManager) {
hostNetwork := false
if nsOpts != nil {
hostNetwork = nsOpts.HostNetwork
}
modifyCommonNamespaceOptions(nsOpts, hostConfig)
modifyHostNetworkOptionForSandbox(nsOpts.HostNetwork, network, hostConfig)
modifyHostNetworkOptionForSandbox(hostNetwork, network, hostConfig)
}
// modifyContainerNamespaceOptions apply namespace options for container