mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 21:21:14 +00:00
IP: Shared IPC.
This commit is contained in:
@@ -37,6 +37,10 @@ import (
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
const (
|
||||
PodInfraContainerName = "POD" // This should match the constant defined in kubelet
|
||||
)
|
||||
|
||||
// DockerInterface is an abstract interface for testability. It abstracts the interface of docker.Client.
|
||||
type DockerInterface interface {
|
||||
ListContainers(options docker.ListContainersOptions) ([]docker.APIContainers, error)
|
||||
@@ -372,8 +376,8 @@ var (
|
||||
// ErrNoContainersInPod is returned when there are no containers for a given pod
|
||||
ErrNoContainersInPod = errors.New("no containers exist for this pod")
|
||||
|
||||
// ErrNoNetworkContainerInPod is returned when there is no network container for a given pod
|
||||
ErrNoNetworkContainerInPod = errors.New("No network container exists for this pod")
|
||||
// ErrNoPodInfraContainerInPod is returned when there is no pod infra container for a given pod
|
||||
ErrNoPodInfraContainerInPod = errors.New("No pod infra container exists for this pod")
|
||||
|
||||
// ErrContainerCannotRun is returned when a container is created, but cannot run properly
|
||||
ErrContainerCannotRun = errors.New("Container cannot run")
|
||||
@@ -401,7 +405,7 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str
|
||||
containerStatus.State.Running = &api.ContainerStateRunning{
|
||||
StartedAt: util.NewTime(inspectResult.State.StartedAt),
|
||||
}
|
||||
if containerName == "net" && inspectResult.NetworkSettings != nil {
|
||||
if containerName == PodInfraContainerName && inspectResult.NetworkSettings != nil {
|
||||
containerStatus.PodIP = inspectResult.NetworkSettings.IPAddress
|
||||
}
|
||||
waiting = false
|
||||
@@ -454,7 +458,7 @@ func GetDockerPodInfo(client DockerInterface, manifest api.PodSpec, podFullName
|
||||
for _, container := range manifest.Containers {
|
||||
expectedContainers[container.Name] = container
|
||||
}
|
||||
expectedContainers["net"] = api.Container{}
|
||||
expectedContainers[PodInfraContainerName] = api.Container{}
|
||||
|
||||
containers, err := client.ListContainers(docker.ListContainersOptions{All: true})
|
||||
if err != nil {
|
||||
@@ -498,9 +502,9 @@ func GetDockerPodInfo(client DockerInterface, manifest api.PodSpec, podFullName
|
||||
return nil, ErrNoContainersInPod
|
||||
}
|
||||
|
||||
// First make sure we are not missing network container
|
||||
if _, found := info["net"]; !found {
|
||||
return nil, ErrNoNetworkContainerInPod
|
||||
// First make sure we are not missing pod infra container
|
||||
if _, found := info[PodInfraContainerName]; !found {
|
||||
return nil, ErrNoPodInfraContainerInPod
|
||||
}
|
||||
|
||||
if len(info) < (len(manifest.Containers) + 1) {
|
||||
|
Reference in New Issue
Block a user