func (ch *ContainerdHandler) GetContainerdContainers() map[string]context.Context {
	containers := map[string]context.Context{}
	req := pb.ListContainersRequest{}
	if containerList, err := ch.client.List(ch.docker, &req); err == nil {
		for _, container := range containerList.Containers {
			containers[container.ID] = ch.docker
		}
	}
	if containerList, err := ch.client.List(ch.containerd, &req); err == nil {
		for _, container := range containerList.Containers {
			containers[container.ID] = ch.containerd
		}
	}
	return containers
}
======================= //
== Containerd Events == //
======================= //
GetContainerdContainers Function
package core
import (
	"context"
	"fmt"
	"os"
	"path/filepath"
	"strconv"
	"time"
	kl "github.com/kubearmor/KubeArmor/KubeArmor/common"
	kg "github.com/kubearmor/KubeArmor/KubeArmor/log"
	tp "github.com/kubearmor/KubeArmor/KubeArmor/types"
	pb "github.com/containerd/containerd/api/services/containers/v1"
	pt "github.com/containerd/containerd/api/services/tasks/v1"
	"github.com/containerd/containerd/namespaces"
	"github.com/containerd/typeurl"
	"google.golang.org/grpc"
	specs "github.com/opencontainers/runtime-spec/specs-go"
)
var Containerd *ContainerdHandler
func init() {
	const prefix = "types.containerd.io"
	major := strconv.Itoa(specs.VersionMajor)
	typeurl.Register(&specs.Spec{}, prefix, "opencontainers/runtime-spec", major, "Spec")
	typeurl.Register(&specs.Process{}, prefix, "opencontainers/runtime-spec", major, "Process")
	Containerd = NewContainerdHandler()
}
type ContainerdHandler struct {
	conn *grpc.ClientConn
	client pb.ContainersClient
	taskClient pt.TasksClient
	containerd context.Context
	docker     context.Context
	containers map[string]context.Context
}
func NewContainerdHandler() *ContainerdHandler {
	ch := &ContainerdHandler{}
	sockFile := "unix://"
	for _, candidate := range []string{"/var/run/containerd/containerd.sock", "/var/snap/microk8s/common/run/containerd.sock"} {
		if _, err := os.Stat(filepath.Clean(candidate)); err == nil {
			sockFile = sockFile + candidate
			break
		}
	}
	if sockFile == "unix://" {
		return nil
	}
	conn, err := grpc.Dial(sockFile, grpc.WithInsecure())
	if err != nil {
		return nil
	}
	ch.conn = conn
	ch.client = pb.NewContainersClient(ch.conn)
	ch.taskClient = pt.NewTasksClient(ch.conn)
	ch.docker = namespaces.WithNamespace(context.Background(), "moby")
	ch.containerd = namespaces.WithNamespace(context.Background(), "k8s.io")
	ch.containers = map[string]context.Context{}
	return ch
}
func (ch *ContainerdHandler) Close() {
	if ch.conn != nil {
		if err := ch.conn.Close(); err != nil {
			kg.Err(err.Error())
		}
	}
}
func (ch *ContainerdHandler) GetContainerInfo(ctx context.Context, containerID string) (tp.Container, error) {
	req := pb.GetContainerRequest{ID: containerID}
	res, err := ch.client.Get(ctx, &req)
	if err != nil {
		return tp.Container{}, err
	}
	container := tp.Container{}
	container.ContainerID = res.Container.ID
	container.ContainerName = res.Container.ID[:12]
	container.NamespaceName = "Unknown"
	container.EndPointName = "Unknown"
	containerLabels := res.Container.Labels
	if _, ok := containerLabels["io.kubernetes.pod.namespace"]; ok {  
		if val, ok := containerLabels["io.kubernetes.pod.namespace"]; ok {
			container.NamespaceName = val
		}
		if val, ok := containerLabels["io.kubernetes.pod.name"]; ok {
			container.EndPointName = val
		}
	}
	iface, err := typeurl.UnmarshalAny(res.Container.Spec)
	if err != nil {
		return tp.Container{}, err
	}
	spec := iface.(*specs.Spec)
	container.AppArmorProfile = spec.Process.ApparmorProfile
	taskReq := pt.ListPidsRequest{ContainerID: container.ContainerID}
	if taskRes, err := Containerd.taskClient.ListPids(ctx, &taskReq); err == nil {
		if len(taskRes.Processes) == 0 {
			return container, err
		}
		pid := strconv.Itoa(int(taskRes.Processes[0].Pid))
		if data, err := kl.GetCommandOutputWithErr("readlink", []string{"/proc/" + pid + "/ns/pid"}); err == nil {
			if _, err := fmt.Sscanf(data, "pid:[%d]\n", &container.PidNS); err != nil {
				kg.Errf("Failed to get PidNS (%s, %s, %s)", containerID, pid, err.Error())
			}
		}
		if data, err := kl.GetCommandOutputWithErr("readlink", []string{"/proc/" + pid + "/ns/mnt"}); err == nil {
			if _, err := fmt.Sscanf(data, "mnt:[%d]\n", &container.MntNS); err != nil {
				kg.Errf("Failed to get MntNS (%s, %s, %s)", containerID, pid, err.Error())
			}
		}
	} else {
		return container, err
	}
	return container, nil
}