Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MichaelWasher
Copy link
Contributor

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.

if p.settings.UseDefaultImage {
p.settings.Image = p.runtimeBridge.GetDefaultImage()
}
if p.settings.UseDefaultTCPDumpImage {
p.settings.TCPDumpImage = p.runtimeBridge.GetDefaultTCPImage()
}
if p.settings.UseDefaultSocketPath {
p.settings.SocketPath = p.runtimeBridge.GetDefaultSocketPath()
}
p.privilegedPod, err = p.kubernetesApiService.CreatePrivilegedPod(

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.

Copy kSniff Settings to internal PrivilegedPodSniffer state
Create PrivilegedSnifferServiceConfig config struct to contain PrivilegedSnifferService configuration
…struct

Create StaticTcpdumpSnifferServiceConfig config struct to contain StaticTcpdumpSnifferService configuration
Copy kSniff settings on creation of StaticTcpdumpSnifferService to allow multi-use sniffer objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant