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

K8s env vars #1279

Merged
merged 15 commits into from
Oct 29, 2024
2 changes: 1 addition & 1 deletion pkg/internal/discover/watcher_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (wk *watcherKubeEnricher) ID() string { return "unique-watcher-kube-enriche
// handling in the enrich main loop
func (wk *watcherKubeEnricher) On(event *informer.Event) {
// ignoring updates on non-pod resources
if event == nil || event.Resource == nil || event.Resource.Pod == nil {
if event == nil || event.GetResource() == nil || event.GetResource().GetPod() == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: event.GetResource().GetPod() will do the job, as internally these methods check wether the receiver is nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK, I misunderstood what you meant as conflict. I'll revert.

return
}
switch event.Type {
Expand Down
3 changes: 0 additions & 3 deletions pkg/internal/kube/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"strings"
"sync"

"github.com/grafana/beyla-k8s-cache/pkg/informer"
"github.com/grafana/beyla-k8s-cache/pkg/meta"

"github.com/grafana/beyla/pkg/export/attributes"
"github.com/grafana/beyla/pkg/internal/helpers/container"
"github.com/grafana/beyla/pkg/kubecache/informer"
Expand Down Expand Up @@ -177,7 +174,7 @@

info, ok := s.containerIDs[c.Id]
if ok {
delete(s.containerIDs, c.Id)

Check warning on line 177 in pkg/internal/kube/store.go

View check run for this annotation

Codecov / codecov/patch

pkg/internal/kube/store.go#L177

Added line #L177 was not covered by tests
delete(s.namespaces, info.PIDNamespace)
}
}
Expand Down Expand Up @@ -304,8 +301,8 @@
}

if serviceName, ok := s.nameFromResourceAttrs(serviceNameKey, c); ok {
return serviceName, isValidServiceName(serviceName)
}

Check warning on line 305 in pkg/internal/kube/store.go

View check run for this annotation

Codecov / codecov/patch

pkg/internal/kube/store.go#L304-L305

Added lines #L304 - L305 were not covered by tests
}
}
return "", false
Expand Down
4 changes: 2 additions & 2 deletions pkg/internal/kube/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/grafana/beyla-k8s-cache/pkg/informer"
"github.com/grafana/beyla-k8s-cache/pkg/meta"
"github.com/grafana/beyla/pkg/kubecache/informer"
"github.com/grafana/beyla/pkg/kubecache/meta"
)

func TestContainerInfo(t *testing.T) {
Expand Down
Loading