address review comments
This commit is contained in:
parent
90cc954eed
commit
851d778531
@ -114,7 +114,7 @@ type Runtime interface {
|
||||
GetContainerLogs(ctx context.Context, pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error)
|
||||
// Delete a container. If the container is still running, an error is returned.
|
||||
DeleteContainer(containerID ContainerID) error
|
||||
// Delete a sandbox. If the container is still running, an error is returned.
|
||||
// DeleteSandbox deletes a sandbox.
|
||||
DeleteSandbox(sandboxID string) error
|
||||
// ImageService provides methods to image-related methods.
|
||||
ImageService
|
||||
@ -311,7 +311,7 @@ type Status struct {
|
||||
// Name of the container.
|
||||
Name string
|
||||
// ID of the sandbox to which this container belongs.
|
||||
PodSandboxId string
|
||||
PodSandboxID string
|
||||
// Status of the container.
|
||||
State State
|
||||
// Creation time of the container.
|
||||
|
@ -474,7 +474,7 @@ func (m *kubeGenericRuntimeManager) getPodContainerStatuses(uid kubetypes.UID, n
|
||||
cStatus.Message += tMessage
|
||||
}
|
||||
}
|
||||
cStatus.PodSandboxId = c.PodSandboxId
|
||||
cStatus.PodSandboxID = c.PodSandboxId
|
||||
statuses[i] = cStatus
|
||||
}
|
||||
|
||||
|
@ -305,12 +305,12 @@ func (m *kubeGenericRuntimeManager) GetPortForward(podName, podNamespace string,
|
||||
return url.Parse(resp.Url)
|
||||
}
|
||||
|
||||
// DeleteSandbox removes the sandbox by sandboxID..
|
||||
// DeleteSandbox removes the sandbox by sandboxID.
|
||||
func (m *kubeGenericRuntimeManager) DeleteSandbox(sandboxID string) error {
|
||||
klog.V(4).Infof("Removing sandbox %q", sandboxID)
|
||||
// the stop sandbox is called as part of kill pod but the error is ignored. So,
|
||||
// we have to call stop sandbox again to make sure that all the resources like
|
||||
// netwrork are cleaned by runtime.
|
||||
// stop sandbox is called as part of kill pod function but the error is ignored. So,
|
||||
// we have to call stop sandbox again to make sure that all the resources like network
|
||||
// are cleaned by runtime.
|
||||
if err := m.runtimeService.StopPodSandbox(sandboxID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -46,8 +46,7 @@ func (a sandboxStatusByCreatedList) Less(i, j int) bool {
|
||||
func newPodSandboxDeleter(runtime kubecontainer.Runtime) *podSandboxDeleter {
|
||||
buffer := make(chan string, sandboxDeletionBufferLimit)
|
||||
go wait.Forever(func() {
|
||||
for {
|
||||
id := <-buffer
|
||||
for id := range buffer {
|
||||
if err := runtime.DeleteSandbox(id); err != nil {
|
||||
klog.Warningf("[pod_sandbox_deleter] DeleteSandbox returned error for (id=%v): %v", id, err)
|
||||
}
|
||||
@ -64,7 +63,7 @@ func newPodSandboxDeleter(runtime kubecontainer.Runtime) *podSandboxDeleter {
|
||||
func (p *podSandboxDeleter) deleteSandboxesInPod(podStatus *kubecontainer.PodStatus, toKeep int) {
|
||||
sandboxIDs := sets.NewString()
|
||||
for _, containerStatus := range podStatus.ContainerStatuses {
|
||||
sandboxIDs.Insert(containerStatus.PodSandboxId)
|
||||
sandboxIDs.Insert(containerStatus.PodSandboxID)
|
||||
}
|
||||
sandboxStatuses := podStatus.SandboxStatuses
|
||||
if toKeep > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user