mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #66228 from liucimin/fix_cniplugin_get_expose_hostip
fix_the_checkpoint_no_hostip_bug
This commit is contained in:
commit
78573805a7
@ -56,6 +56,8 @@ type PortMapping struct {
|
|||||||
ContainerPort *int32
|
ContainerPort *int32
|
||||||
// Port number on the host.
|
// Port number on the host.
|
||||||
HostPort *int32
|
HostPort *int32
|
||||||
|
// Host ip to expose.
|
||||||
|
HostIP string
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckpointData is a sample example structure to be used in test cases for checkpointing
|
// 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)
|
port80 := int32(80)
|
||||||
port443 := int32(443)
|
port443 := int32(443)
|
||||||
proto := protocol("tcp")
|
proto := protocol("tcp")
|
||||||
|
ip1234 := "1.2.3.4"
|
||||||
|
|
||||||
portMappings := []*PortMapping{
|
portMappings := []*PortMapping{
|
||||||
{
|
{
|
||||||
&proto,
|
&proto,
|
||||||
&port80,
|
&port80,
|
||||||
&port80,
|
&port80,
|
||||||
|
ip1234,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&proto,
|
&proto,
|
||||||
&port443,
|
&port443,
|
||||||
&port443,
|
&port443,
|
||||||
|
ip1234,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
checkpoint1 := newFakeCheckpointV1("check1", portMappings, true)
|
checkpoint1 := newFakeCheckpointV1("check1", portMappings, true)
|
||||||
|
@ -47,6 +47,8 @@ type PortMapping struct {
|
|||||||
ContainerPort *int32 `json:"container_port,omitempty"`
|
ContainerPort *int32 `json:"container_port,omitempty"`
|
||||||
// Port number on the host.
|
// Port number on the host.
|
||||||
HostPort *int32 `json:"host_port,omitempty"`
|
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.
|
// CheckpointData contains all types of data that can be stored in the checkpoint.
|
||||||
|
@ -672,6 +672,7 @@ func constructPodSandboxCheckpoint(config *runtimeapi.PodSandboxConfig) checkpoi
|
|||||||
HostPort: &pm.HostPort,
|
HostPort: &pm.HostPort,
|
||||||
ContainerPort: &pm.ContainerPort,
|
ContainerPort: &pm.ContainerPort,
|
||||||
Protocol: &proto,
|
Protocol: &proto,
|
||||||
|
HostIP: pm.HostIp,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if config.GetLinux().GetSecurityContext().GetNamespaceOptions().GetNetwork() == runtimeapi.NamespaceMode_NODE {
|
if config.GetLinux().GetSecurityContext().GetNamespaceOptions().GetNetwork() == runtimeapi.NamespaceMode_NODE {
|
||||||
|
@ -387,6 +387,7 @@ func (ds *dockerService) GetPodPortMappings(podSandboxID string) ([]*hostport.Po
|
|||||||
HostPort: *pm.HostPort,
|
HostPort: *pm.HostPort,
|
||||||
ContainerPort: *pm.ContainerPort,
|
ContainerPort: *pm.ContainerPort,
|
||||||
Protocol: proto,
|
Protocol: proto,
|
||||||
|
HostIP: pm.HostIP,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return portMappings, nil
|
return portMappings, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user