Move PLEG event back to CRI
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
fc50334ca9
commit
f857626d64
@ -43,10 +43,6 @@ import (
|
|||||||
type CRIService interface {
|
type CRIService interface {
|
||||||
// TODO: we should implement Event backoff in Controller.
|
// TODO: we should implement Event backoff in Controller.
|
||||||
BackOffEvent(id string, event interface{})
|
BackOffEvent(id string, event interface{})
|
||||||
|
|
||||||
// TODO: refactor event generator for PLEG.
|
|
||||||
// GenerateAndSendContainerEvent is called by controller for sandbox container events.
|
|
||||||
GenerateAndSendContainerEvent(ctx context.Context, containerID string, sandboxID string, eventType runtime.ContainerEventType)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageService specifies dependencies to CRI image service.
|
// ImageService specifies dependencies to CRI image service.
|
||||||
|
@ -20,8 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
|
||||||
|
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
@ -59,10 +57,5 @@ func (c *Controller) Shutdown(ctx context.Context, sandboxID string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send CONTAINER_DELETED event with ContainerId equal to SandboxId.
|
|
||||||
c.cri.GenerateAndSendContainerEvent(ctx, sandboxID, sandboxID, runtime.ContainerEventType_CONTAINER_DELETED_EVENT)
|
|
||||||
|
|
||||||
c.sandboxStore.Delete(sandboxID)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,9 @@ func (c *criService) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodS
|
|||||||
return nil, fmt.Errorf("failed to delete sandbox %q: %w", id, err)
|
return nil, fmt.Errorf("failed to delete sandbox %q: %w", id, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send CONTAINER_DELETED event with ContainerId equal to SandboxId.
|
||||||
|
c.generateAndSendContainerEvent(ctx, id, id, runtime.ContainerEventType_CONTAINER_DELETED_EVENT)
|
||||||
|
|
||||||
err = c.nri.RemovePodSandbox(ctx, &sandbox)
|
err = c.nri.RemovePodSandbox(ctx, &sandbox)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.G(ctx).WithError(err).Errorf("NRI pod removal notification failed")
|
log.G(ctx).WithError(err).Errorf("NRI pod removal notification failed")
|
||||||
|
@ -215,12 +215,6 @@ func (c *criService) BackOffEvent(id string, event interface{}) {
|
|||||||
c.eventMonitor.backOff.enBackOff(id, event)
|
c.eventMonitor.backOff.enBackOff(id, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateAndSendContainerEvent is a temporary workaround to send PLEG events from podsandbopx/ controller
|
|
||||||
// TODO: refactor PLEG event generator so both podsandbox/ controller and CRI service can access it.
|
|
||||||
func (c *criService) GenerateAndSendContainerEvent(ctx context.Context, containerID string, sandboxID string, eventType runtime.ContainerEventType) {
|
|
||||||
c.generateAndSendContainerEvent(ctx, containerID, sandboxID, eventType)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register registers all required services onto a specific grpc server.
|
// Register registers all required services onto a specific grpc server.
|
||||||
// This is used by containerd cri plugin.
|
// This is used by containerd cri plugin.
|
||||||
func (c *criService) Register(s *grpc.Server) error {
|
func (c *criService) Register(s *grpc.Server) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user