mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #24080 from tyangliu/fix-infra-network-cfg
Pass dockerOpts by reference to setInfraContainerNetworkConfig
This commit is contained in:
commit
1fe0e0778f
@ -673,7 +673,7 @@ func (dm *DockerManager) runContainer(
|
|||||||
|
|
||||||
// Set network configuration for infra-container
|
// Set network configuration for infra-container
|
||||||
if container.Name == PodInfraContainerName {
|
if container.Name == PodInfraContainerName {
|
||||||
setInfraContainerNetworkConfig(pod, netMode, opts, dockerOpts)
|
setInfraContainerNetworkConfig(pod, netMode, opts, &dockerOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
setEntrypointAndCommand(container, opts, dockerOpts)
|
setEntrypointAndCommand(container, opts, dockerOpts)
|
||||||
@ -705,7 +705,7 @@ func (dm *DockerManager) runContainer(
|
|||||||
|
|
||||||
// setInfraContainerNetworkConfig sets the network configuration for the infra-container. We only set network configuration for infra-container, all
|
// setInfraContainerNetworkConfig sets the network configuration for the infra-container. We only set network configuration for infra-container, all
|
||||||
// the user containers will share the same network namespace with infra-container.
|
// the user containers will share the same network namespace with infra-container.
|
||||||
func setInfraContainerNetworkConfig(pod *api.Pod, netMode string, opts *kubecontainer.RunContainerOptions, dockerOpts dockertypes.ContainerCreateConfig) {
|
func setInfraContainerNetworkConfig(pod *api.Pod, netMode string, opts *kubecontainer.RunContainerOptions, dockerOpts *dockertypes.ContainerCreateConfig) {
|
||||||
exposedPorts, portBindings := makePortsAndBindings(opts.PortMappings)
|
exposedPorts, portBindings := makePortsAndBindings(opts.PortMappings)
|
||||||
dockerOpts.Config.ExposedPorts = exposedPorts
|
dockerOpts.Config.ExposedPorts = exposedPorts
|
||||||
dockerOpts.HostConfig.PortBindings = dockernat.PortMap(portBindings)
|
dockerOpts.HostConfig.PortBindings = dockernat.PortMap(portBindings)
|
||||||
|
Loading…
Reference in New Issue
Block a user