Skip to content

Commit

Permalink
Use the upstream Hubble packages
Browse files Browse the repository at this point in the history
Hubble APIs have been very stable, so let's use the upstream version
instead of maintaining our own copy.

Signed-off-by: Michi Mutsuzaki <[email protected]>
  • Loading branch information
michi-covalent committed Jun 6, 2024
1 parent bc38bac commit 0a1e20c
Show file tree
Hide file tree
Showing 75 changed files with 1,031 additions and 15,411 deletions.
4 changes: 2 additions & 2 deletions cmd/tetra/getevents/io_reader_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"io"
"os"

hubbleV1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
"github.com/cilium/tetragon/pkg/fieldfilters"
"github.com/cilium/tetragon/pkg/filters"
hubbleV1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
"google.golang.org/grpc"
"google.golang.org/protobuf/encoding/protojson"
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ require (
github.com/deckarep/golang-set/v2 v2.6.0
github.com/fatih/color v1.17.0
github.com/go-openapi/strfmt v0.23.0
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.6.0
github.com/google/gops v0.3.28
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -108,7 +106,9 @@ require (
github.com/go-openapi/validate v0.22.3 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/arguments_regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"regexp"

hubbleV1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
hubbleV1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

func filterByArgumentsRegex(argumentsPatterns []string) (hubbleFilters.FilterFunc, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/arguments_regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/binary_regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"regexp"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

func filterByBinaryRegex(binaryPatterns []string) (hubbleFilters.FilterFunc, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/binary_regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/caps.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"strings"

hubbleV1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
hubbleV1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
"github.com/cilium/tetragon/pkg/option"
mapset "github.com/deckarep/golang-set/v2"
"google.golang.org/protobuf/reflect/protoreflect"
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/caps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/eventType.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package filters
import (
"context"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
"google.golang.org/protobuf/reflect/protoreflect"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"io"
"strings"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
"github.com/cilium/tetragon/api/v1/tetragon/codegen/helpers"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

// ParseFilterList parses a list of process filters in JSON format into protobuf messages.
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/cilium/tetragon/pkg/option"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"path"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
shell "github.com/kballard/go-shellquote"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/types/known/wrapperspb"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"context"
"fmt"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
k8sLabels "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/labels"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

// FilterByLabelSelectors returns a FilterFunc. The FilterFunc returns true if and only if any of the
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package filters
import (
"context"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

func filterByNamespace(namespaces []string) hubbleFilters.FilterFunc {
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/pid.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package filters
import (
"context"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

func filterByPid(pids []uint32) hubbleFilters.FilterFunc {
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/pidSet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package filters
import (
"context"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
"github.com/cilium/tetragon/pkg/logger"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

// We could use an LRU here but we really don't want to evict old entries and risk failing
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/pod_regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"regexp"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

func filterByPodRegex(podPatterns []string) (hubbleFilters.FilterFunc, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/pod_regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package filters
import (
"context"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
hubbleFilters "github.com/cilium/cilium/pkg/hubble/filters"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
hubbleFilters "github.com/cilium/tetragon/pkg/oldhubble/filters"
)

// filterByPolicyName returns a FilterFunc. The FilterFunc returns true if and only if any of the
Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"context"
"testing"

v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/eventmetrics/eventmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package eventmetrics

import (
v1 "github.com/cilium/cilium/pkg/hubble/api/v1"
"github.com/cilium/tetragon/api/v1/tetragon"
"github.com/cilium/tetragon/api/v1/tetragon/codegen/helpers"
"github.com/cilium/tetragon/pkg/api/processapi"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/cilium/tetragon/pkg/metrics/consts"
"github.com/cilium/tetragon/pkg/metrics/errormetrics"
"github.com/cilium/tetragon/pkg/metrics/syscallmetrics"
v1 "github.com/cilium/tetragon/pkg/oldhubble/api/v1"
"github.com/cilium/tetragon/pkg/option"
"github.com/cilium/tetragon/pkg/reader/exec"
"github.com/cilium/tetragon/pkg/tracingpolicy"
Expand Down
3 changes: 0 additions & 3 deletions pkg/oldhubble/api/v1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
package v1

const (
// ObserverServiceName is the name of the observer service for the grpc health check
ObserverServiceName = "hubble.server.Observer"

// K8sNamespaceTag is the label tag which denotes the namespace.
K8sNamespaceTag = "k8s:io.kubernetes.pod.namespace"
)
44 changes: 0 additions & 44 deletions pkg/oldhubble/api/v1/flow.go

This file was deleted.

18 changes: 0 additions & 18 deletions pkg/oldhubble/api/v1/http.go

This file was deleted.

Loading

0 comments on commit 0a1e20c

Please sign in to comment.