kmesh-net / kmesh

High Performance ServiceMesh Data Plane Based on Programmable Kernel
https://kmesh.net
Apache License 2.0
362 stars 46 forks source link

Donot insert iptables when sidecar not injected #474

Open hzxuzhonghu opened 3 days ago

hzxuzhonghu commented 3 days ago

What would you like to be added:

            enableSidecar, _ := checkSidecar(client, pod)
            enableKmesh := isKmeshManaged(pod)
            if !enableSidecar && !enableKmesh {
                log.Info("do not need process, pod is not managed by sidecar or kmesh")
                return
            }

In bypass controller, we check whether sidecar or kmesh enabled for the pod, this is right. But the way it checks sidecar, it ir nor right

If a namespace with injection label, we donot check whether pod has a sidecar anymore. And similarly, we also check pod annotation, without checking sidecar.

This can be mistaken, when the pod is started earlier.

Why is this needed: