fix_the_checkpoint_no_hostip_bug

pull/564/head
liucimin 2018-11-12 14:41:04 +08:00
parent afcc156806
commit 5b78dc8b67
4 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -46,6 +46,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.

View File

@ -643,6 +643,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 {

View File

@ -394,6 +394,7 @@ func (ds *dockerService) GetPodPortMappings(podSandboxID string) ([]*hostport.Po
HostPort: *pm.HostPort,
ContainerPort: *pm.ContainerPort,
Protocol: proto,
HostIP: pm.HostIP,
})
}
return portMappings, nil