diff --git a/pkg/policyfilter/rthooks/rthooks.go b/pkg/policyfilter/rthooks/rthooks.go index bdd5d573367..65c6d1eac5b 100644 --- a/pkg/policyfilter/rthooks/rthooks.go +++ b/pkg/policyfilter/rthooks/rthooks.go @@ -92,15 +92,12 @@ func createContainerHook(_ context.Context, arg *rthooks.CreateContainerArg) err return err } - var containerFound bool - var container *corev1.ContainerStatus namespace := pod.ObjectMeta.Namespace - pod, container, containerFound = arg.Watcher.FindContainer(containerID) - if !containerFound { - log.WithError(err).Warnf("failed to find container information %s, aborting hook.", containerID) - } - containerName := container.Name + containerName := arg.Req.ContainerName + if containerName == "" { + log.Warnf("failed to find container information for %s, but will continue", containerID) + } log.WithFields(logrus.Fields{ "pod-id": podID,