modifyContainerNamespaceOptions apply namespace options for container
( nsOpts *runtimeapi.NamespaceOption, podSandboxID string, hostConfig *dockercontainer.HostConfig, )
| 187 | |
| 188 | // modifyContainerNamespaceOptions apply namespace options for container |
| 189 | func modifyContainerNamespaceOptions( |
| 190 | nsOpts *runtimeapi.NamespaceOption, |
| 191 | podSandboxID string, |
| 192 | hostConfig *dockercontainer.HostConfig, |
| 193 | ) { |
| 194 | switch nsOpts.GetPid() { |
| 195 | case runtimeapi.NamespaceMode_NODE: |
| 196 | hostConfig.PidMode = namespaceModeHost |
| 197 | case runtimeapi.NamespaceMode_POD: |
| 198 | hostConfig.PidMode = dockercontainer.PidMode(fmt.Sprintf("container:%v", podSandboxID)) |
| 199 | case runtimeapi.NamespaceMode_TARGET: |
| 200 | hostConfig.PidMode = dockercontainer.PidMode( |
| 201 | fmt.Sprintf("container:%v", nsOpts.GetTargetId()), |
| 202 | ) |
| 203 | } |
| 204 | modifyHostOptionsForContainer(nsOpts, podSandboxID, hostConfig) |
| 205 | } |
| 206 | |
| 207 | // modifyHostOptionsForSandbox applies NetworkMode/UTSMode to sandbox's dockercontainer.HostConfig. |
| 208 | func modifyHostOptionsForSandbox( |
searching dependent graphs…