-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add Inspektor Gadget TCP and DNS traces #230
Open
peterbom
wants to merge
28
commits into
Azure:master
Choose a base branch
from
peterbom:feature/ig-inprocess
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
1ba403e
add gadget top block-io
bravebeaver ddf3e76
create trace using client-go and stream result
bravebeaver 5f53de6
check existence of trace crd rather than pod. more reliable way to se…
bravebeaver b03c937
allow periscope to run exec on pods
bravebeaver 7f0c785
collect stream and delete pod
bravebeaver b8c0bef
wait and wait
bravebeaver 1aa75b2
dns needs a bit more time to collect
bravebeaver 96c9bf6
add tcp tracer
bravebeaver 60ea45d
implement data exporter
bravebeaver d4ee312
tidy up logging
bravebeaver 018a605
add readme
bravebeaver 534b14d
try using IG packages directly
peterbom 53862ab
try to add e2e tests
peterbom 8d01839
make tests work
peterbom eef7ec4
fix and test TCP trace collector
peterbom efbbf5f
tidy go.mod
peterbom 2a44057
fix some build errors
peterbom e0431c3
allow building in a container (without .git folder)
peterbom bd44c1e
reduce collection time for traces to avoid huge log outputs
peterbom c94cf06
ensure container collection can map between containers and PIDs
peterbom d5005e8
fix Windows compilation errors
peterbom 1471203
fixup! try to add e2e tests
peterbom e5cd7b8
revert changes for running IG as daemonset
peterbom 0acc84b
try to fix linting error and test failure
peterbom 1475a27
fix systemlogs test
peterbom ed625da
fix go linting issues
bravebeaver 9760839
Merge pull request #11 from bravebeaver/feature/ig-inprocess
peterbom f7e18fe
fix windows build errors
peterbom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -344,3 +344,6 @@ deployment/overlays/temp | |
# Local deployment configuration files | ||
**/.env | ||
**/.env.* | ||
|
||
# Test binaries | ||
__debug_bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,22 +8,15 @@ | |
"name": "Launch Tests", | ||
"type": "go", | ||
"request": "launch", | ||
"program": "${fileDirname}", | ||
"mode": "test", | ||
"program": "${fileDirname}/__debug_bin", | ||
"mode": "exec", | ||
"env": {}, | ||
"args": ["-test.v"], | ||
"showLog": true | ||
}, | ||
{ | ||
"name": "Launch Tests with race check", | ||
"type": "go", | ||
"request": "launch", | ||
"program": "${fileDirname}", | ||
"mode": "test", | ||
"env": {}, | ||
"buildFlags": "-race", | ||
"args": ["-test.v"], | ||
"showLog": true | ||
"showLog": true, | ||
// https://github.com/golang/vscode-go/blob/master/docs/debugging.md#debug-a-package-test-as-root | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question please: 💡 What is the relevance of this |
||
"console": "integratedTerminal", | ||
"asRoot": true, | ||
"preLaunchTask": "go test (debug)", | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "go test (debug)", | ||
"type": "shell", | ||
"command": "go", | ||
"args": [ | ||
"test", | ||
"-race", | ||
"-c", | ||
"-gcflags=all=-N -l", | ||
"-o", | ||
"${fileDirname}/__debug_bin" | ||
], | ||
"options": { | ||
"cwd": "${fileDirname}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"time" | ||
|
||
"github.com/Azure/aks-periscope/pkg/collector" | ||
"github.com/Azure/aks-periscope/pkg/interfaces" | ||
"github.com/Azure/aks-periscope/pkg/utils" | ||
|
||
containercollection "github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection" | ||
"github.com/inspektor-gadget/inspektor-gadget/pkg/runcfanotify" | ||
|
||
restclient "k8s.io/client-go/rest" | ||
) | ||
|
||
func addOSSpecificCollectors(collectors []interfaces.Collector, config *restclient.Config, runtimeInfo *utils.RuntimeInfo) []interfaces.Collector { | ||
// Use the default InspektorGadget behaviour for determining containers: | ||
// https://github.com/inspektor-gadget/inspektor-gadget/blob/6b00fea3f925c9da478126931e774e340ca9bfdf/pkg/gadgettracermanager/gadgettracermanager.go#L275-L283 | ||
var containerCollectionOptions []containercollection.ContainerCollectionOption | ||
if runcfanotify.Supported() { | ||
containerCollectionOptions = []containercollection.ContainerCollectionOption{ | ||
containercollection.WithRuncFanotify(), | ||
containercollection.WithInitialKubernetesContainers(runtimeInfo.HostNodeName), | ||
} | ||
} else { | ||
containerCollectionOptions = []containercollection.ContainerCollectionOption{ | ||
containercollection.WithPodInformer(runtimeInfo.HostNodeName), | ||
} | ||
} | ||
|
||
containerCollectionOptions = append( | ||
containerCollectionOptions, | ||
containercollection.WithNodeName(runtimeInfo.HostNodeName), | ||
containercollection.WithCgroupEnrichment(), | ||
containercollection.WithLinuxNamespaceEnrichment(), | ||
containercollection.WithKubernetesEnrichment(runtimeInfo.HostNodeName, config), | ||
) | ||
|
||
// Traces can produce a lot of data. | ||
// TODO: Consider whether this should be lower or configurable. | ||
traceCollectionPeriod := 30 * time.Second | ||
traceWaiter := func() { | ||
log.Printf("\twait for %v to stop collection", traceCollectionPeriod) | ||
time.Sleep(traceCollectionPeriod) | ||
} | ||
|
||
return append(collectors, | ||
collector.NewInspektorGadgetDNSTraceCollector(runtimeInfo, traceWaiter, containerCollectionOptions), | ||
collector.NewInspektorGadgetTCPTraceCollector(runtimeInfo, traceWaiter, containerCollectionOptions), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/Azure/aks-periscope/pkg/interfaces" | ||
"github.com/Azure/aks-periscope/pkg/utils" | ||
restclient "k8s.io/client-go/rest" | ||
) | ||
|
||
func addOSSpecificCollectors(collectors []interfaces.Collector, config *restclient.Config, runtimeInfo *utils.RuntimeInfo) []interfaces.Collector { | ||
return collectors | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡Thank you for this. Archiving only: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#administrative-privileges - if anyone ponders
sudo
use.minor small question is: Why is
sudo
needed?