eldadru / ksniff

Kubectl plugin to ease sniffing on kubernetes pods using tcpdump and wireshark
Apache License 2.0
3.18k stars 190 forks source link

Isolate Sniffers from Ksniff-wide Settings to avoid any side-affects #127

Open MichaelWasher opened 3 years ago

MichaelWasher commented 3 years ago

Sniffers should maintain their own state without fear of changes 'bleeding' out to any global state.

If side-affects come from instantiating a sniffer, this limits the ability to use the sniffers as reusable components. https://github.com/eldadru/ksniff/blob/e299ffb2ec044e21eae9f2d26a3eeb0d637fd617/pkg/service/sniffer/privileged_pod_sniffer_service.go#L31-L44

This PR copies the relevant configuration into the Sniffer internal state. I think there is more that can be done for this (renaming) but I wanted to be as un-invasive as possible.