in controllers/policyendpoints_controller.go [331:359]
func (r *PolicyEndpointsReconciler) configureeBPFProbes(ctx context.Context, podIdentifier string,
targetPods []types.NamespacedName, ingressRules, egressRules []ebpf.EbpfFirewallRules) error {
var err error
//Loop over target pods and setup/configure/update eBPF probes/maps
for _, pod := range targetPods {
r.log.Info("Processing Pod: ", "name:", pod.Name, "namespace:", pod.Namespace, "podIdentifier: ", podIdentifier)
currentPodIdentifier := utils.GetPodIdentifier(pod.Name, pod.Namespace, r.log)
if currentPodIdentifier != podIdentifier {
r.log.Info("Target Pod doesn't belong to the current pod Identifier: ", "Name: ", pod.Name, "Pod ID: ", podIdentifier)
continue
}
err = r.ebpfClient.AttacheBPFProbes(pod, podIdentifier)
if err != nil {
r.log.Info("Attaching eBPF probe failed for", "pod", pod.Name, "namespace", pod.Namespace)
return err
}
r.log.Info("Successfully attached required eBPF probes for", "pod:", pod.Name, "in namespace", pod.Namespace)
}
err = r.updateeBPFMaps(ctx, podIdentifier, ingressRules, egressRules)
if err != nil {
r.log.Error(err, "failed to update map ", "podIdentifier ", podIdentifier)
return err
}
return nil
}