Skip to content

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

Open
MichaelWasher wants to merge 2 commits into
eldadru:masterfrom
MichaelWasher:multi-pod-collection
Open

Isolate Sniffers from Ksniff-wide Settings to avoid any side-affects#127
MichaelWasher wants to merge 2 commits into
eldadru:masterfrom
MichaelWasher:multi-pod-collection

Conversation

@MichaelWasher

Copy link
Copy Markdown
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