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

tetragon: use latest cilium module (v1.13.1) #882

Merged
merged 6 commits into from Apr 5, 2023

Conversation

kkourt
Copy link
Contributor

@kkourt kkourt commented Apr 4, 2023

The original intention was just to upgrade the cilium version we use.

First, align_checker broke so I updated our bpf code based on cilium/cilium@142182c. Next, there was an issue of having the Flow registered twice in the grpc handlers: from cilium and from the oldhubbleapi, so I removed the second. Next I synced the modules so we would use github.com/cilium/controller-tools@v0.6.2 and github.com/cilium/ebpf@v0.9.4-0.20221026141156-bcf6c12e189d everywhere. See pathces for the rest.

After 21c49af ("pkg/cilium: move old hubble code in tetragon repo"), we can now update the cilium package we use to 1.13.1.

There was still one change needed due to cilium/cilium@97f3b48.

diff --git a/pkg/oldhubble/cilium/endpoint.go b/pkg/oldhubble/cilium/endpoint.go
index 13b07e38c..443b16cca 100644
--- a/pkg/oldhubble/cilium/endpoint.go
+++ b/pkg/oldhubble/cilium/endpoint.go
@@ -97,7 +97,7 @@ func (s *State) consumeEndpointEvents() {
 			// sets the time when the endpoint was deleted. If not found, stores
 			// a new endpoint in the cache, as well with the time when the
 			// endpoint was deleted.
-			edn := monitorAPI.EndpointDeleteNotification{}
+			edn := monitorAPI.EndpointNotification{}
 			err := json.Unmarshal([]byte(an.Text), &edn)
 			if err != nil {
 				s.log.WithField("EndpointDeleteNotification", an.Text).Error("Unable to unmarshal EndpointDeleteNotification")
diff --git a/pkg/oldhubble/parser/endpoint/endpoint.go b/pkg/oldhubble/parser/endpoint/endpoint.go
index 1fe6d7ed7..c74f539be 100644
--- a/pkg/oldhubble/parser/endpoint/endpoint.go
+++ b/pkg/oldhubble/parser/endpoint/endpoint.go
@@ -70,7 +70,7 @@ func ParseEndpointFromModel(modelEP *models.Endpoint) *v1.Endpoint {

 // ParseEndpointFromEndpointDeleteNotification returns an endpoint parsed from
 // the EndpointDeleteNotification.
-func ParseEndpointFromEndpointDeleteNotification(edn monitorAPI.EndpointDeleteNotification) *v1.Endpoint {
+func ParseEndpointFromEndpointDeleteNotification(edn monitorAPI.EndpointNotification) *v1.Endpoint {
 	return &v1.Endpoint{
 		ID:           edn.ID,
 		PodName:      edn.PodName,

Fixes: #571

@kkourt kkourt requested a review from a team as a code owner April 4, 2023 13:09
@kkourt kkourt requested a review from kevsecurity April 4, 2023 13:09
@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/lint-codeql.yml:analyze. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@kkourt kkourt requested a review from willfindlay as a code owner April 4, 2023 13:25
@kkourt kkourt marked this pull request as draft April 4, 2023 13:36
After 21c49af ("pkg/cilium: move old
hubble code in tetragon repo"), we can now the cilium package we use to
1.13.1.

There was still one change needed due to
cilium/cilium@97f3b48.

```
diff --git a/pkg/oldhubble/cilium/endpoint.go b/pkg/oldhubble/cilium/endpoint.go
index 13b07e38c..443b16cca 100644
--- a/pkg/oldhubble/cilium/endpoint.go
+++ b/pkg/oldhubble/cilium/endpoint.go
@@ -97,7 +97,7 @@ func (s *State) consumeEndpointEvents() {
 			// sets the time when the endpoint was deleted. If not found, stores
 			// a new endpoint in the cache, as well with the time when the
 			// endpoint was deleted.
-			edn := monitorAPI.EndpointDeleteNotification{}
+			edn := monitorAPI.EndpointNotification{}
 			err := json.Unmarshal([]byte(an.Text), &edn)
 			if err != nil {
 				s.log.WithField("EndpointDeleteNotification", an.Text).Error("Unable to unmarshal EndpointDeleteNotification")
diff --git a/pkg/oldhubble/parser/endpoint/endpoint.go b/pkg/oldhubble/parser/endpoint/endpoint.go
index 1fe6d7ed7..c74f539be 100644
--- a/pkg/oldhubble/parser/endpoint/endpoint.go
+++ b/pkg/oldhubble/parser/endpoint/endpoint.go
@@ -70,7 +70,7 @@ func ParseEndpointFromModel(modelEP *models.Endpoint) *v1.Endpoint {

 // ParseEndpointFromEndpointDeleteNotification returns an endpoint parsed from
 // the EndpointDeleteNotification.
-func ParseEndpointFromEndpointDeleteNotification(edn monitorAPI.EndpointDeleteNotification) *v1.Endpoint {
+func ParseEndpointFromEndpointDeleteNotification(edn monitorAPI.EndpointNotification) *v1.Endpoint {
 	return &v1.Endpoint{
 		ID:           edn.ID,
 		PodName:      edn.PodName,

```

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
@kkourt kkourt force-pushed the pr/kkourt/update-cilium-1.13.1 branch 4 times, most recently from 620f9ae to c9cdf33 Compare April 4, 2023 16:06
Blindly copying: cilium/cilium@142182c

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
Replace "github.com/cilium/tetragon/pkg/oldhubbleapi/v1/flow"
with "github.com/cilium/cilium/api/v1/flow", and deal with the breakage.
Also, remove pkg/oldhubbleapi which is not needed.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
sync dependencies across modules. Also, remove "-compat 1.8" from all
go mod tidy commands.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
golangci reported:
 tests/e2e/helpers/exec.go:49:9 staticcheck  SA1019: exec.Stream is
 deprecated: use StreamWithContext instead to avoid possible resource
 leaks. See kubernetes/kubernetes#103177 for
 details.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
@kkourt kkourt force-pushed the pr/kkourt/update-cilium-1.13.1 branch from c9cdf33 to 83e70d0 Compare April 4, 2023 16:14
@kkourt kkourt marked this pull request as ready for review April 4, 2023 16:47
@kkourt kkourt merged commit 87112ef into main Apr 5, 2023
18 checks passed
@kkourt kkourt deleted the pr/kkourt/update-cilium-1.13.1 branch April 5, 2023 08:54
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.

go.mod: update to a new cilium package version
3 participants