diff --git a/README.md b/README.md index 00de9ee15d..d27c4fb39c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ # Retina +[![goreport][goreport-img]][goreport] ![GitHub release][release-img] [![retina-publish][godoc-badge]][godoc] ![license] [![retina-test][retina-test-image-badge]][retina-test-image] [![retinash][retinash-badge]][retinash] [![retina-publish][retina-publish-badge]][retina-publish] [![retina-publish-ghcr][retina-publish-ghcr-badge]][retina-publish-ghcr] ![retina-codeql-img][retina-codeql-badge] ![retina-golangci-lint-img][retina-golangci-lint-badge] + ## Overview Retina is a cloud and vendor agnostic container workload observability platform which helps customers with enterprise grade DevOps, SecOps and compliance use cases. It is designed to cater to cluster network administrators, cluster security administrators and DevOps engineers by providing a centralized platform for monitoring application and network health, and security. Retina is capable of collecting telemetry data from multiple sources and aggregating it into a single time-series database. Retina is also capable of sending data to multiple destinations, such as Prometheus, Azure Monitor, and other vendors, and visualizing the data in a variety of ways, like Grafana, Azure Monitor, Azure log analytics, and more. +![Retina features](/site/static/img/retina-features.png) + ## Documentation See [retina.sh](http://retina.sh) for more information and examples. @@ -59,3 +63,20 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope ## Contact "Retina Devs" + +[goreport-img]: https://goreportcard.com/badge/github.com/microsoft/retina +[goreport]: https://goreportcard.com/report/github.com/microsoft/retina +[godoc]: https://godoc.org/github.com/microsoft/retina +[godoc-badge]: https://godoc.org/github.com/microsoft/retina?status.svg +[release-img]: https://img.shields.io/github/v/release/microsoft/retina.svg +[license]: https://img.shields.io/badge/license-MIT-blue?link=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fretina%2Fblob%2Fmain%2FLICENSE +[retina-test-image-badge]: https://github.com/microsoft/retina/actions/workflows/test.yaml/badge.svg?branch=main +[retina-test-image]: https://github.com/microsoft/retina/actions/workflows/test.yaml?query=branch%3Amain +[retinash-badge]: https://github.com/microsoft/retina/actions/workflows/docs.yaml/badge.svg?branch=main +[retinash]: https://retina.sh/ +[retina-publish-badge]: https://github.com/microsoft/retina/actions/workflows/images.yaml/badge.svg?branch=main +[retina-publish]: https://github.com/microsoft/retina/actions/workflows/images.yaml?query=branch%3Amain +[retina-publish-ghcr-badge]: https://github.com/microsoft/retina/actions/workflows/images-ghcr.yaml/badge.svg?branch=main +[retina-publish-ghcr]: https://github.com/microsoft/retina/actions/workflows/images-ghcr.yaml?query=branch%3Amain +[retina-codeql-badge]: https://github.com/microsoft/retina/actions/workflows/codeql.yaml/badge.svg?branch=main +[retina-golangci-lint-badge]: https://github.com/microsoft/retina/actions/workflows/golangci-lint.yaml/badge.svg?branch=main diff --git a/pkg/capture/crd_to_job.go b/pkg/capture/crd_to_job.go index 85c57512af..edb2c6d486 100644 --- a/pkg/capture/crd_to_job.go +++ b/pkg/capture/crd_to_job.go @@ -158,7 +158,7 @@ func (translator *CaptureToPodTranslator) initJobTemplate(capture *retinav1alpha }, // Usually, the Capture Pod takes no more than 10m CPU // and 10Mi memory. And considering the Capture Pod - // does not consumes much resources as requried by + // does not consumes much resources as required by // the workload, it's safe to hard-code the resource // requests and limits. Resources: corev1.ResourceRequirements{ @@ -791,7 +791,7 @@ func filterToIPPortsMap(filters []string) (map[string][]string, error) { } continue } - // If any(* or emtpy) port is specified with an ip address, we should ignore the other ports with combination + // If any(* or empty) port is specified with an ip address, we should ignore the other ports with combination // with this ip address, and the final combination for this ip address will be this_ipaddress:*. if portFilter == anyIPOrPort { filterIPPorts[ipAddressFilter] = map[string]struct{}{ diff --git a/pkg/capture/provider/network_capture_win.go b/pkg/capture/provider/network_capture_win.go index ea3e5b97eb..29b3a64f3a 100644 --- a/pkg/capture/provider/network_capture_win.go +++ b/pkg/capture/provider/network_capture_win.go @@ -75,7 +75,7 @@ func (ncp *NetworkCaptureProvider) CaptureNetworkPacket(filter string, duration, ) // We should split arguments organized in a string delimited by spaces as - // seperate ones, otherwise the whole string will be treated as one argument. + // separate ones, otherwise the whole string will be treated as one argument. // For example, given the following filter, exec lib will treat IPv4.Address // as the argument and the rest as the value of IPv4.Address. // "IPv4.Address=(10.244.1.85,10.244.1.235) IPv6.Address=(fd5c:d9f1:79c5:fd83::1bc,fd5c:d9f1:79c5:fd83::11b)" diff --git a/pkg/controllers/cache/cache_test.go b/pkg/controllers/cache/cache_test.go index d94472f038..71dd95238f 100644 --- a/pkg/controllers/cache/cache_test.go +++ b/pkg/controllers/cache/cache_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" + gomock "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/common" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/pubsub" - gomock "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) diff --git a/pkg/controllers/daemon/namespace/namespace_controller_test.go b/pkg/controllers/daemon/namespace/namespace_controller_test.go index de42b6076d..895cfef779 100644 --- a/pkg/controllers/daemon/namespace/namespace_controller_test.go +++ b/pkg/controllers/daemon/namespace/namespace_controller_test.go @@ -8,12 +8,12 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" retinav1alpha1 "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/common" "github.com/microsoft/retina/pkg/controllers/cache" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/module/metrics" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/deprecated/cache/cache_test.go b/pkg/deprecated/cache/cache_test.go index 05c23ca7e5..545a71a744 100644 --- a/pkg/deprecated/cache/cache_test.go +++ b/pkg/deprecated/cache/cache_test.go @@ -343,7 +343,7 @@ func TestGetPodOwner(t *testing.T) { ownerKind: "Deployment", }, { - name: "Test unkown owner", + name: "Test unknown owner", args: args{ obj: &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/enricher/enricher.go b/pkg/enricher/enricher.go index fd7ff9a385..8bef3f3bd0 100644 --- a/pkg/enricher/enricher.go +++ b/pkg/enricher/enricher.go @@ -8,12 +8,12 @@ import ( "reflect" "sync" - "github.com/microsoft/retina/pkg/common" - "github.com/microsoft/retina/pkg/controllers/cache" - "github.com/microsoft/retina/pkg/log" "github.com/cilium/cilium/api/v1/flow" v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "github.com/cilium/cilium/pkg/hubble/container" + "github.com/microsoft/retina/pkg/common" + "github.com/microsoft/retina/pkg/controllers/cache" + "github.com/microsoft/retina/pkg/log" "go.uber.org/zap" ) diff --git a/pkg/enricher/enricher_test.go b/pkg/enricher/enricher_test.go index 95ff53b24a..ec5a4ab9a8 100644 --- a/pkg/enricher/enricher_test.go +++ b/pkg/enricher/enricher_test.go @@ -10,12 +10,12 @@ import ( "testing" "time" + "github.com/cilium/cilium/api/v1/flow" + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "github.com/microsoft/retina/pkg/common" "github.com/microsoft/retina/pkg/controllers/cache" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/pubsub" - "github.com/cilium/cilium/api/v1/flow" - v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "github.com/stretchr/testify/assert" "go.uber.org/zap" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/pkg/managers/filtermanager/manager_test.go b/pkg/managers/filtermanager/manager_test.go index 682758c7c0..560627b9f2 100644 --- a/pkg/managers/filtermanager/manager_test.go +++ b/pkg/managers/filtermanager/manager_test.go @@ -8,9 +8,9 @@ import ( "net" "testing" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/plugin/filter/mocks" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) diff --git a/pkg/managers/filtermanager/types.go b/pkg/managers/filtermanager/types.go index f42010a564..fe60ed8d83 100644 --- a/pkg/managers/filtermanager/types.go +++ b/pkg/managers/filtermanager/types.go @@ -20,21 +20,21 @@ type IFilterManager interface { // AddIPs adds the given IPs to the filter map (map in kernel space) and the filterCache. // If any of the IP cannot be added to the filter map, // no entries will be added to the cache. - // Note: An error returned doesn't gurantee that no IPs + // Note: An error returned doesn't guarantee that no IPs // were added to the filter map. Caller should retry adding // all the IPs again. AddIPs([]net.IP, Requestor, RequestMetadata) error // DeleteIPs deletes the given IPs from the filter map (map in kernel space) and the filterCache. // If any of the IP cannot be deleted from the filter map, // no entries will be deleted from the cache. - // Note: An error returned doesn't gurantee that no IPs + // Note: An error returned doesn't guarantee that no IPs // were deleted from the filter map. Caller should retry deleting // all the IPs again. DeleteIPs([]net.IP, Requestor, RequestMetadata) error // HasIP returns true if the given IP is in the filterCache. HasIP(net.IP) bool // Reset the cache and the filter map. - // Note: An error returned doesn't gurantee that no IPs + // Note: An error returned doesn't guarantee that no IPs // were deleted from the filter map. Caller should retry Reset // again. Reset() error diff --git a/pkg/managers/pluginmanager/pluginmanager.go b/pkg/managers/pluginmanager/pluginmanager.go index fcfc0feea8..079bd7f14b 100644 --- a/pkg/managers/pluginmanager/pluginmanager.go +++ b/pkg/managers/pluginmanager/pluginmanager.go @@ -8,6 +8,7 @@ import ( "sync" "time" + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" kcfg "github.com/microsoft/retina/pkg/config" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/managers/watchermanager" @@ -15,7 +16,6 @@ import ( "github.com/microsoft/retina/pkg/plugin/api" "github.com/microsoft/retina/pkg/plugin/registry" "github.com/microsoft/retina/pkg/telemetry" - v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "github.com/pkg/errors" "go.uber.org/zap" "golang.org/x/sync/errgroup" diff --git a/pkg/managers/pluginmanager/pluginmanager_test.go b/pkg/managers/pluginmanager/pluginmanager_test.go index e414a20e10..82ecfedf54 100644 --- a/pkg/managers/pluginmanager/pluginmanager_test.go +++ b/pkg/managers/pluginmanager/pluginmanager_test.go @@ -229,13 +229,13 @@ func TestPluginInit(t *testing.T) { wantErr bool }{ { - name: "Plugin init successs Pod Level Disabled", + name: "Plugin init successes Pod Level Disabled", cfg: cfgPodLevelDisabled, pluginName: "mockplugin", wantErr: false, }, { - name: "Plugin init successs Pod Level Enabled", + name: "Plugin init successes Pod Level Enabled", cfg: cfgPodLevelEnabled, pluginName: "mockplugin", wantErr: false, @@ -268,14 +268,14 @@ func TestPluginStartWithoutInit(t *testing.T) { initPlugin bool }{ { - name: "Plugin start successs Pod Level Disabled", + name: "Plugin start successes Pod Level Disabled", cfg: cfgPodLevelDisabled, pluginName: "mockplugin", wantErr: true, initPlugin: false, }, { - name: "Plugin start successs Pod Level Enabled", + name: "Plugin start successes Pod Level Enabled", cfg: cfgPodLevelEnabled, pluginName: "mockplugin", wantErr: false, @@ -315,7 +315,7 @@ func TestPluginStop(t *testing.T) { startPlugin bool }{ { - name: "Plugin stop successs Pod Level Disabled", + name: "Plugin stop successes Pod Level Disabled", cfg: cfgPodLevelDisabled, pluginName: "mockplugin", wantStartErr: false, @@ -342,7 +342,7 @@ func TestPluginStop(t *testing.T) { startPlugin: true, }, { - name: "Plugin stop successs Pod Level Enabled", + name: "Plugin stop successes Pod Level Enabled", cfg: cfgPodLevelEnabled, pluginName: "mockplugin", wantStartErr: false, diff --git a/pkg/managers/watchermanager/watchermanager_test.go b/pkg/managers/watchermanager/watchermanager_test.go index 1b45ae186d..8d907c3db3 100644 --- a/pkg/managers/watchermanager/watchermanager_test.go +++ b/pkg/managers/watchermanager/watchermanager_test.go @@ -7,9 +7,9 @@ import ( "errors" "testing" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/log" mock "github.com/microsoft/retina/pkg/managers/watchermanager/mocks" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) diff --git a/pkg/metrics/types.go b/pkg/metrics/types.go index 8e8ce5e6e6..5e4de07f92 100644 --- a/pkg/metrics/types.go +++ b/pkg/metrics/types.go @@ -3,8 +3,8 @@ package metrics import ( - "github.com/microsoft/retina/pkg/log" "github.com/cilium/cilium/api/v1/flow" + "github.com/microsoft/retina/pkg/log" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/dns.go b/pkg/module/metrics/dns.go index 00b2d2467a..731371e109 100644 --- a/pkg/module/metrics/dns.go +++ b/pkg/module/metrics/dns.go @@ -7,13 +7,12 @@ import ( "fmt" "strings" + v1 "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - "github.com/cilium/cilium/api/v1/flow" - v1 "github.com/cilium/cilium/api/v1/flow" "go.uber.org/zap" ) @@ -83,7 +82,7 @@ func (d *DNSMetrics) getLabels() []string { return labels } -func (d *DNSMetrics) values(flow *flow.Flow) []string { +func (d *DNSMetrics) values(flow *v1.Flow) []string { flowDns, dnsType, numResponses := utils.GetDns(flow) if flowDns == nil { return nil diff --git a/pkg/module/metrics/dns_test.go b/pkg/module/metrics/dns_test.go index e8b010c8ef..5c9b85e026 100644 --- a/pkg/module/metrics/dns_test.go +++ b/pkg/module/metrics/dns_test.go @@ -7,14 +7,13 @@ import ( "reflect" "testing" - "github.com/microsoft/retina/pkg/log" - "github.com/microsoft/retina/pkg/metrics" "github.com/cilium/cilium/api/v1/flow" "github.com/golang/mock/gomock" + "github.com/microsoft/retina/pkg/log" + "github.com/microsoft/retina/pkg/metrics" + "github.com/microsoft/retina/pkg/utils" "github.com/prometheus/client_golang/prometheus" "gotest.tools/v3/assert" - - "github.com/microsoft/retina/pkg/utils" ) func TestGetLabels(t *testing.T) { diff --git a/pkg/module/metrics/drops.go b/pkg/module/metrics/drops.go index 52f929dd59..935b3b406f 100644 --- a/pkg/module/metrics/drops.go +++ b/pkg/module/metrics/drops.go @@ -6,12 +6,12 @@ package metrics import ( "strings" + v1 "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - v1 "github.com/cilium/cilium/api/v1/flow" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/drops_test.go b/pkg/module/metrics/drops_test.go index 94d9f9ff3f..985b648a68 100644 --- a/pkg/module/metrics/drops_test.go +++ b/pkg/module/metrics/drops_test.go @@ -7,11 +7,11 @@ package metrics import ( "testing" + "github.com/cilium/cilium/api/v1/flow" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" - "github.com/cilium/cilium/api/v1/flow" - "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "go.uber.org/zap" diff --git a/pkg/module/metrics/forward.go b/pkg/module/metrics/forward.go index f9e3d2a7cc..e16710172a 100644 --- a/pkg/module/metrics/forward.go +++ b/pkg/module/metrics/forward.go @@ -6,12 +6,12 @@ package metrics import ( "strings" + v1 "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - v1 "github.com/cilium/cilium/api/v1/flow" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/forward_test.go b/pkg/module/metrics/forward_test.go index 0ec12df49f..f1bcdc99ac 100644 --- a/pkg/module/metrics/forward_test.go +++ b/pkg/module/metrics/forward_test.go @@ -7,11 +7,11 @@ package metrics import ( "testing" + "github.com/cilium/cilium/api/v1/flow" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" - "github.com/cilium/cilium/api/v1/flow" - "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "go.uber.org/zap" diff --git a/pkg/module/metrics/latency_test.go b/pkg/module/metrics/latency_test.go index d0bf3c8bdd..4f355ec00c 100644 --- a/pkg/module/metrics/latency_test.go +++ b/pkg/module/metrics/latency_test.go @@ -8,13 +8,13 @@ import ( "testing" "time" + "github.com/cilium/cilium/api/v1/flow" + "github.com/golang/mock/gomock" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - "github.com/cilium/cilium/api/v1/flow" - "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "gotest.tools/v3/assert" diff --git a/pkg/module/metrics/metrics_module.go b/pkg/module/metrics/metrics_module.go index 4724c8bbd4..9fbb7af423 100644 --- a/pkg/module/metrics/metrics_module.go +++ b/pkg/module/metrics/metrics_module.go @@ -9,6 +9,7 @@ import ( "sync" "time" + "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/crd/api/v1alpha1/validations" "github.com/microsoft/retina/pkg/common" @@ -21,7 +22,6 @@ import ( "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/pubsub" "github.com/microsoft/retina/pkg/utils" - "github.com/cilium/cilium/api/v1/flow" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/metrics_module_test.go b/pkg/module/metrics/metrics_module_test.go index 6896055f53..afef979504 100644 --- a/pkg/module/metrics/metrics_module_test.go +++ b/pkg/module/metrics/metrics_module_test.go @@ -8,6 +8,8 @@ import ( "sync" "testing" + "github.com/cilium/cilium/pkg/hubble/container" + "github.com/golang/mock/gomock" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/common" kcfg "github.com/microsoft/retina/pkg/config" @@ -16,8 +18,6 @@ import ( "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/managers/filtermanager" "github.com/microsoft/retina/pkg/pubsub" - "github.com/cilium/cilium/pkg/hubble/container" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/tcpflags.go b/pkg/module/metrics/tcpflags.go index fc4ca5243c..af19db37a6 100644 --- a/pkg/module/metrics/tcpflags.go +++ b/pkg/module/metrics/tcpflags.go @@ -6,12 +6,12 @@ package metrics import ( "strings" + v1 "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - v1 "github.com/cilium/cilium/api/v1/flow" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/tcpflags_test.go b/pkg/module/metrics/tcpflags_test.go index 5ee1f85507..e30d6117cb 100644 --- a/pkg/module/metrics/tcpflags_test.go +++ b/pkg/module/metrics/tcpflags_test.go @@ -7,11 +7,11 @@ package metrics import ( "testing" + "github.com/cilium/cilium/api/v1/flow" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" - "github.com/cilium/cilium/api/v1/flow" - "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "go.uber.org/zap" diff --git a/pkg/module/metrics/tcpretrans.go b/pkg/module/metrics/tcpretrans.go index efdcd5ec54..a463476b4b 100644 --- a/pkg/module/metrics/tcpretrans.go +++ b/pkg/module/metrics/tcpretrans.go @@ -6,12 +6,12 @@ package metrics import ( "strings" + v1 "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" metricsinit "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - v1 "github.com/cilium/cilium/api/v1/flow" "go.uber.org/zap" ) diff --git a/pkg/module/metrics/types.go b/pkg/module/metrics/types.go index 5c669b9330..70383571b4 100644 --- a/pkg/module/metrics/types.go +++ b/pkg/module/metrics/types.go @@ -7,10 +7,10 @@ import ( "net" "strings" + "github.com/cilium/cilium/api/v1/flow" api "github.com/microsoft/retina/crd/api/v1alpha1" "github.com/microsoft/retina/pkg/common" "github.com/microsoft/retina/pkg/utils" - "github.com/cilium/cilium/api/v1/flow" ) const ( @@ -324,7 +324,7 @@ func DefaultCtxOptions() []string { // ignoring service option as we have not added right logic around it // TODO add service specific enrichment and logic, #610 // serviceCtxOption, - // Port adds a ton of extra dimention to metrics + // Port adds a ton of extra dimension to metrics // so not adding it as a default option // portCtxOption, } diff --git a/pkg/plugin/dns/dns_linux_test.go b/pkg/plugin/dns/dns_linux_test.go index 93a2d89158..748cfd7acf 100644 --- a/pkg/plugin/dns/dns_linux_test.go +++ b/pkg/plugin/dns/dns_linux_test.go @@ -11,6 +11,10 @@ import ( "testing" "time" + "github.com/cilium/cilium/api/v1/flow" + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" + "github.com/golang/mock/gomock" + "github.com/inspektor-gadget/inspektor-gadget/pkg/gadgets/trace/dns/types" "github.com/microsoft/retina/pkg/config" "github.com/microsoft/retina/pkg/controllers/cache" "github.com/microsoft/retina/pkg/enricher" @@ -19,10 +23,6 @@ import ( "github.com/microsoft/retina/pkg/plugin/common/mocks" "github.com/microsoft/retina/pkg/pubsub" "github.com/microsoft/retina/pkg/utils" - "github.com/cilium/cilium/api/v1/flow" - v1 "github.com/cilium/cilium/pkg/hubble/api/v1" - "github.com/golang/mock/gomock" - "github.com/inspektor-gadget/inspektor-gadget/pkg/gadgets/trace/dns/types" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "gotest.tools/v3/assert" diff --git a/pkg/plugin/dns/types_linux.go b/pkg/plugin/dns/types_linux.go index e2303bc9b1..48cf0d11b6 100644 --- a/pkg/plugin/dns/types_linux.go +++ b/pkg/plugin/dns/types_linux.go @@ -3,13 +3,13 @@ package dns import ( + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" kcfg "github.com/microsoft/retina/pkg/config" "github.com/microsoft/retina/pkg/enricher" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/plugin/api" "github.com/microsoft/retina/pkg/plugin/common" - v1 "github.com/cilium/cilium/pkg/hubble/api/v1" ) const ( diff --git a/pkg/plugin/dropreason/dropreason_linux_test.go b/pkg/plugin/dropreason/dropreason_linux_test.go index ee2713678e..2b728f1513 100644 --- a/pkg/plugin/dropreason/dropreason_linux_test.go +++ b/pkg/plugin/dropreason/dropreason_linux_test.go @@ -13,14 +13,13 @@ import ( "testing" "time" + "github.com/cilium/ebpf/perf" + "github.com/golang/mock/gomock" kcfg "github.com/microsoft/retina/pkg/config" - "github.com/microsoft/retina/pkg/enricher" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" mocks "github.com/microsoft/retina/pkg/plugin/dropreason/mocks" - "github.com/cilium/ebpf/perf" - "github.com/golang/mock/gomock" dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" diff --git a/pkg/plugin/filter/filter_map_linux_test.go b/pkg/plugin/filter/filter_map_linux_test.go index 2404d0c0df..d2eecc30cf 100644 --- a/pkg/plugin/filter/filter_map_linux_test.go +++ b/pkg/plugin/filter/filter_map_linux_test.go @@ -8,9 +8,9 @@ import ( "net" "testing" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/plugin/filter/mocks" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) diff --git a/pkg/plugin/linuxutil/ethtool_stats_linux_test.go b/pkg/plugin/linuxutil/ethtool_stats_linux_test.go index b91cae69c6..177bbc5363 100644 --- a/pkg/plugin/linuxutil/ethtool_stats_linux_test.go +++ b/pkg/plugin/linuxutil/ethtool_stats_linux_test.go @@ -3,9 +3,9 @@ package linuxutil import ( "testing" + gomock "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" - gomock "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" ) diff --git a/pkg/plugin/linuxutil/netstat_stats_linux.go b/pkg/plugin/linuxutil/netstat_stats_linux.go index f9c20c8e19..3e3d64e3d8 100644 --- a/pkg/plugin/linuxutil/netstat_stats_linux.go +++ b/pkg/plugin/linuxutil/netstat_stats_linux.go @@ -8,10 +8,10 @@ import ( "strconv" "strings" + "github.com/cakturk/go-netstat/netstat" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/utils" - "github.com/cakturk/go-netstat/netstat" "go.uber.org/zap" ) diff --git a/pkg/plugin/linuxutil/netstat_stats_linux_test.go b/pkg/plugin/linuxutil/netstat_stats_linux_test.go index 782b2033ba..84ba8b9d4b 100644 --- a/pkg/plugin/linuxutil/netstat_stats_linux_test.go +++ b/pkg/plugin/linuxutil/netstat_stats_linux_test.go @@ -7,9 +7,9 @@ import ( "net" "testing" - "github.com/microsoft/retina/pkg/log" "github.com/cakturk/go-netstat/netstat" gomock "github.com/golang/mock/gomock" + "github.com/microsoft/retina/pkg/log" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" ) diff --git a/pkg/plugin/linuxutil/types_linux.go b/pkg/plugin/linuxutil/types_linux.go index f50d0a0a8e..d8f6273aef 100644 --- a/pkg/plugin/linuxutil/types_linux.go +++ b/pkg/plugin/linuxutil/types_linux.go @@ -3,11 +3,10 @@ package linuxutil import ( + "github.com/cakturk/go-netstat/netstat" kcfg "github.com/microsoft/retina/pkg/config" - "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/plugin/api" - "github.com/cakturk/go-netstat/netstat" ) const ( diff --git a/pkg/plugin/mockplugin/mockplugin.go b/pkg/plugin/mockplugin/mockplugin.go index f4bc3de7f3..ec06725dbe 100644 --- a/pkg/plugin/mockplugin/mockplugin.go +++ b/pkg/plugin/mockplugin/mockplugin.go @@ -6,11 +6,10 @@ import ( "context" "fmt" + hubblev1 "github.com/cilium/cilium/pkg/hubble/api/v1" kcfg "github.com/microsoft/retina/pkg/config" - "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/plugin/api" - hubblev1 "github.com/cilium/cilium/pkg/hubble/api/v1" ) const ( diff --git a/pkg/plugin/packetforward/packetforward_linux.go b/pkg/plugin/packetforward/packetforward_linux.go index 668fbd16cd..9e8914c23b 100644 --- a/pkg/plugin/packetforward/packetforward_linux.go +++ b/pkg/plugin/packetforward/packetforward_linux.go @@ -97,7 +97,7 @@ func (p *packetForward) Name() string { } func (p *packetForward) Generate(ctx context.Context) error { - // Use this funtion to parse p and generate header files under cprog. + // Use this function to parse p and generate header files under cprog. // Example: https://github.com/anubhabMajumdar/Retina/blob/c4bc06e7f922124f92536ffb5312bada5c2dfe99/pkg/plugin/custom/packetforward/packetforward.go#L77 p.l.Info("Packet forwarding metric header generated") return nil diff --git a/pkg/plugin/packetforward/packetforward_linux_test.go b/pkg/plugin/packetforward/packetforward_linux_test.go index 8d4f141a43..7dcdfd2ff3 100644 --- a/pkg/plugin/packetforward/packetforward_linux_test.go +++ b/pkg/plugin/packetforward/packetforward_linux_test.go @@ -16,10 +16,10 @@ import ( kcfg "github.com/microsoft/retina/pkg/config" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" mocks "github.com/microsoft/retina/pkg/plugin/packetforward/mocks" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) diff --git a/pkg/plugin/packetparser/_cprog/dynamic.h b/pkg/plugin/packetparser/_cprog/dynamic.h deleted file mode 100644 index 80abbd931f..0000000000 --- a/pkg/plugin/packetparser/_cprog/dynamic.h +++ /dev/null @@ -1,2 +0,0 @@ -// Place holder header file that will be replaced by the actual header file during runtime -// DO NOT DELETE diff --git a/pkg/plugin/packetparser/packetparser_linux_test.go b/pkg/plugin/packetparser/packetparser_linux_test.go index 8d00171384..3e73ebed00 100644 --- a/pkg/plugin/packetparser/packetparser_linux_test.go +++ b/pkg/plugin/packetparser/packetparser_linux_test.go @@ -15,19 +15,18 @@ import ( "testing" "time" + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/perf" + "github.com/florianl/go-tc" + "github.com/golang/mock/gomock" kcfg "github.com/microsoft/retina/pkg/config" - "github.com/prometheus/client_golang/prometheus" - "github.com/microsoft/retina/pkg/enricher" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/plugin/packetparser/mocks" "github.com/microsoft/retina/pkg/watchers/endpoint" - v1 "github.com/cilium/cilium/pkg/hubble/api/v1" - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/perf" - "github.com/florianl/go-tc" - "github.com/golang/mock/gomock" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/vishvananda/netlink" diff --git a/pkg/plugin/packetparser/types_linux.go b/pkg/plugin/packetparser/types_linux.go index 8295d48ea0..8acdee84c4 100644 --- a/pkg/plugin/packetparser/types_linux.go +++ b/pkg/plugin/packetparser/types_linux.go @@ -8,13 +8,13 @@ import ( kcfg "github.com/microsoft/retina/pkg/config" - "github.com/microsoft/retina/pkg/enricher" - "github.com/microsoft/retina/pkg/log" - "github.com/microsoft/retina/pkg/plugin/api" v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "github.com/cilium/ebpf" "github.com/cilium/ebpf/perf" tc "github.com/florianl/go-tc" + "github.com/microsoft/retina/pkg/enricher" + "github.com/microsoft/retina/pkg/log" + "github.com/microsoft/retina/pkg/plugin/api" "github.com/vishvananda/netlink" ) diff --git a/pkg/plugin/tcpretrans/types_linux.go b/pkg/plugin/tcpretrans/types_linux.go index 3d1d2dd61c..caeb38e1e3 100644 --- a/pkg/plugin/tcpretrans/types_linux.go +++ b/pkg/plugin/tcpretrans/types_linux.go @@ -3,12 +3,12 @@ package tcpretrans import ( + gadgetcontext "github.com/inspektor-gadget/inspektor-gadget/pkg/gadget-context" + "github.com/inspektor-gadget/inspektor-gadget/pkg/gadgets/trace/tcpretrans/tracer" kcfg "github.com/microsoft/retina/pkg/config" "github.com/microsoft/retina/pkg/enricher" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/plugin/api" - gadgetcontext "github.com/inspektor-gadget/inspektor-gadget/pkg/gadget-context" - "github.com/inspektor-gadget/inspektor-gadget/pkg/gadgets/trace/tcpretrans/tracer" ) const ( diff --git a/pkg/pubsub/pubsub.go b/pkg/pubsub/pubsub.go index 70ddc4d862..8b966b43bd 100644 --- a/pkg/pubsub/pubsub.go +++ b/pkg/pubsub/pubsub.go @@ -6,8 +6,8 @@ import ( "fmt" "sync" - "github.com/microsoft/retina/pkg/log" "github.com/google/uuid" + "github.com/microsoft/retina/pkg/log" "go.uber.org/zap" ) diff --git a/pkg/server/server.go b/pkg/server/server.go index fc8dffdb1a..d61e322eaa 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -8,10 +8,10 @@ import ( "net/http/pprof" "time" - "github.com/microsoft/retina/pkg/exporter" - "github.com/microsoft/retina/pkg/log" "github.com/go-chi/chi/middleware" "github.com/go-chi/chi/v5" + "github.com/microsoft/retina/pkg/exporter" + "github.com/microsoft/retina/pkg/log" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" "go.uber.org/zap" diff --git a/pkg/telemetry/telemetry_test.go b/pkg/telemetry/telemetry_test.go index bebf960c23..f94779d05c 100644 --- a/pkg/telemetry/telemetry_test.go +++ b/pkg/telemetry/telemetry_test.go @@ -88,7 +88,7 @@ func TestHeartbeat(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tr := &TelemetryClient{ - RWMutex: sync.RWMutex{}, //nolint:copylocks + RWMutex: sync.RWMutex{}, properties: tt.fields.properties, } tr.heartbeat(tt.args.ctx) diff --git a/pkg/utils/utils_linux_test.go b/pkg/utils/utils_linux_test.go index 7143f91b65..e36af00098 100644 --- a/pkg/utils/utils_linux_test.go +++ b/pkg/utils/utils_linux_test.go @@ -7,8 +7,8 @@ import ( "net" "testing" - "github.com/microsoft/retina/pkg/log" "github.com/cilium/cilium/api/v1/flow" + "github.com/microsoft/retina/pkg/log" "github.com/stretchr/testify/assert" ) diff --git a/pkg/watchers/apiserver/apiserver_test.go b/pkg/watchers/apiserver/apiserver_test.go index bcd041eb69..9721e03b68 100644 --- a/pkg/watchers/apiserver/apiserver_test.go +++ b/pkg/watchers/apiserver/apiserver_test.go @@ -12,10 +12,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" "github.com/microsoft/retina/pkg/log" filtermanagermocks "github.com/microsoft/retina/pkg/managers/filtermanager" "github.com/microsoft/retina/pkg/watchers/apiserver/mocks" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) diff --git a/test/enricher/main.go b/test/enricher/main.go index 2a4c8bd435..acb700be85 100644 --- a/test/enricher/main.go +++ b/test/enricher/main.go @@ -7,12 +7,12 @@ package main import ( "context" + "github.com/cilium/cilium/api/v1/flow" + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "github.com/microsoft/retina/pkg/controllers/cache" "github.com/microsoft/retina/pkg/enricher" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/pubsub" - "github.com/cilium/cilium/api/v1/flow" - v1 "github.com/cilium/cilium/pkg/hubble/api/v1" "go.uber.org/zap" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/test/integration/plugins/dns/dns_suite_test.go b/test/integration/plugins/dns/dns_suite_test.go index 5b9d2d419b..1918106438 100644 --- a/test/integration/plugins/dns/dns_suite_test.go +++ b/test/integration/plugins/dns/dns_suite_test.go @@ -124,7 +124,7 @@ func testDnsMetrics(testMode string, requestLabels, responseLabels common.Metric return } l.Info("Node chosen", zap.String("node", node.Name)) - // Use the node choosen to deploy server/client. + // Use the node chosen to deploy server/client. n := common.NewModelNode(node) err = k.InitializeClusterFromModel(common.NewModelNamespace(namespace, diff --git a/test/integration/plugins/dropreason/dropreason_suite_test.go b/test/integration/plugins/dropreason/dropreason_suite_test.go index 238a61ba41..b6512e3d7d 100644 --- a/test/integration/plugins/dropreason/dropreason_suite_test.go +++ b/test/integration/plugins/dropreason/dropreason_suite_test.go @@ -127,7 +127,7 @@ func testLinuxPacketDrop(testMode, os, arch string, countLabels, bytesLabels com return } l.Info("Node chosen", zap.String("node", node.Name)) - // Use the node choosen to deploy server/client. + // Use the node chosen to deploy server/client. n := common.NewModelNode(node) err = k.InitializeClusterFromModel(common.NewModelNamespace(namespace, diff --git a/test/integration/plugins/forward/forward_suite_test.go b/test/integration/plugins/forward/forward_suite_test.go index a69ccbc8a8..6e9ca8bd96 100644 --- a/test/integration/plugins/forward/forward_suite_test.go +++ b/test/integration/plugins/forward/forward_suite_test.go @@ -244,7 +244,7 @@ func testLinuxPacketForward(testMode string, ingressCountLabels, ingressByteLabe l.Info("Metrics count", zap.String("node", node.Name), zap.String("dir", dir), zap.Uint64("baseline", baselineCount), zap.Uint64("spike", spikeCount)) Expect(spikeCount).Should(BeNumerically(">", baselineCount)) - // For node level, the probes do not significanly increase the bytes sent or received. + // For node level, the probes do not significantly increase the bytes sent or received. // Hence, we are not checking for difference between baseline and spike. baselineBytes := metrics[node.Name][dir][1][1] spikeBytes := metrics[node.Name][dir][2][1]