diff --git a/pkg/kubelet/checkpointmanager/checkpoint_manager_test.go b/pkg/kubelet/checkpointmanager/checkpoint_manager_test.go index 6081e90483a..ecbab14c958 100644 --- a/pkg/kubelet/checkpointmanager/checkpoint_manager_test.go +++ b/pkg/kubelet/checkpointmanager/checkpoint_manager_test.go @@ -56,6 +56,8 @@ type PortMapping struct { ContainerPort *int32 // Port number on the host. HostPort *int32 + // Host ip to expose. + HostIP string } // CheckpointData is a sample example structure to be used in test cases for checkpointing @@ -151,17 +153,20 @@ func TestCheckpointManager(t *testing.T) { port80 := int32(80) port443 := int32(443) proto := protocol("tcp") + ip1234 := "1.2.3.4" portMappings := []*PortMapping{ { &proto, &port80, &port80, + ip1234, }, { &proto, &port443, &port443, + ip1234, }, } checkpoint1 := newFakeCheckpointV1("check1", portMappings, true) diff --git a/pkg/kubelet/dockershim/docker_checkpoint.go b/pkg/kubelet/dockershim/docker_checkpoint.go index e44f0bd62f2..24769dd69d6 100644 --- a/pkg/kubelet/dockershim/docker_checkpoint.go +++ b/pkg/kubelet/dockershim/docker_checkpoint.go @@ -47,6 +47,8 @@ type PortMapping struct { ContainerPort *int32 `json:"container_port,omitempty"` // Port number on the host. HostPort *int32 `json:"host_port,omitempty"` + // Host ip to expose. + HostIP string `json:"host_ip,omitempty"` } // CheckpointData contains all types of data that can be stored in the checkpoint. diff --git a/pkg/kubelet/dockershim/docker_sandbox.go b/pkg/kubelet/dockershim/docker_sandbox.go index 01d7f9b4951..d72712f0774 100644 --- a/pkg/kubelet/dockershim/docker_sandbox.go +++ b/pkg/kubelet/dockershim/docker_sandbox.go @@ -672,6 +672,7 @@ func constructPodSandboxCheckpoint(config *runtimeapi.PodSandboxConfig) checkpoi HostPort: &pm.HostPort, ContainerPort: &pm.ContainerPort, Protocol: &proto, + HostIP: pm.HostIp, }) } if config.GetLinux().GetSecurityContext().GetNamespaceOptions().GetNetwork() == runtimeapi.NamespaceMode_NODE { diff --git a/pkg/kubelet/dockershim/docker_service.go b/pkg/kubelet/dockershim/docker_service.go index 97f6543c4bb..1baa9a50183 100644 --- a/pkg/kubelet/dockershim/docker_service.go +++ b/pkg/kubelet/dockershim/docker_service.go @@ -387,6 +387,7 @@ func (ds *dockerService) GetPodPortMappings(podSandboxID string) ([]*hostport.Po HostPort: *pm.HostPort, ContainerPort: *pm.ContainerPort, Protocol: proto, + HostIP: pm.HostIP, }) } return portMappings, nil