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

cmd/deploy log level in ig-k8s pod #2312

Merged
merged 19 commits into from
Jan 10, 2024

Conversation

ghinks
Copy link
Contributor

@ghinks ghinks commented Dec 19, 2023

Provide a way to set log level in ig-k8s pod issue 1869

Add a new command line option to ig-k8s to set the log level via --daemon-log-level. This is useful for debugging issues in the field. The new command will set the environment variable GADGET_TRACER_MANAGER_LOG_LEVEL in the ig-k8s pod. The default value will be info.

  • Changes were made to the daemonset chart to add the new command line option and to set the environment variable in the pod.
  • Changes were made to the gadget container to set the log level based on the environment variable.
  • The log level is set in entrypoint.go, gadgettracermanager/main.go and cleanup.go.

How to use

To set the GADGET_TRACER_MANAGER_LOG_LEVEL to trace, run the following command:

 ./kubectl-gadget deploy --daemon-log-level=trace

The log level can be set to any of the following values from the logrus package:

  • trace
  • debug
  • info
  • warn
  • error
  • fatal
  • panic

To validate this PR on a local image I used minikube.

  • build the images locally make gadget-container ( required as daemonset chart is updated with new env var )
  • add the image to the local k8s cluster, in my case minikube via "minikube cache add ghcr.io/inspektor-gadget/inspektor-gadget:ghinks/cmd-deploy-log-level"
  • make kubectl-gadget
  • deploy via './kubectl-gadget deploy --daemon-log-level=trace --image-pull-policy=Never'
  • the deployment was validated via 'k describe pod -n "gadget" $mypod'
  • undeploy via 'kubectl-gadget undeploy'

Testing on minikube required a local image as minikube would try to pull the image from the registry. The image was built locally and added to the minikube cache.

export MY_CONTAINER="ghcr.io/inspektor-gadget/inspektor-gadget:ghinks-cmd-deploy-log-level"
minikube cache delete $MY_CONTAINER && minikube image rm $MY_CONTAINER && minikube cache add $MY_CONTAINER

To view the logs from the pod:

export MY_POD=`kubectl get pods -o jsonpath='{.items[*].metadata.name}' -n gadget`
k logs -n gadget $MY_POD -f

Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

Thank you for opening a PR! This is a good idea!
So far, you only set the environment variable, now you need to use the value to actually set the log level.
I have some initial comments, but it looks good so far.

Best regards.

charts/Makefile Outdated Show resolved Hide resolved
cmd/kubectl-gadget/deploy.go Outdated Show resolved Hide resolved
charts/Makefile Outdated Show resolved Hide resolved
@ghinks ghinks force-pushed the ghinks/cmd-deploy-log-level branch 2 times, most recently from d47821e to 44c4705 Compare December 24, 2023 02:04
Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

Thank you for polishing it! I took a look at it and have some suggestions.

Best regards.

gadget-container/entrypoint/entrypoint.go Outdated Show resolved Hide resolved
pkg/resources/manifests/deploy.yaml Outdated Show resolved Hide resolved
@ghinks ghinks force-pushed the ghinks/cmd-deploy-log-level branch 2 times, most recently from 5d3ad47 to e4d7b60 Compare December 28, 2023 16:54
Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

Thank you for the new commits! I have some comments on them.

Best regards.

cmd/kubectl-gadget/deploy.go Outdated Show resolved Hide resolved
Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

I tested your contribution and it looks fine:

$ ./kubectl-gadget deploy --image-pull-policy=Never --daemon-log-level warning
INFO[0000] Experimental features enabled                
Creating Namespace/gadget...
Creating ServiceAccount/gadget...
Creating ClusterRole/gadget-cluster-role...
Creating ClusterRoleBinding/gadget-cluster-role-binding...
Creating Role/gadget-role...
Creating RoleBinding/gadget-role-binding...
Creating DaemonSet/gadget...
Creating CustomResourceDefinition/traces.gadget.kinvolk.io...
Waiting for gadget pod(s) to be ready...
0/1 gadget pod(s) ready
1/1 gadget pod(s) ready
Retrieving Gadget Catalog...
Inspektor Gadget successfully deployed
$ ../kubectl get pod -n gadget          (remotes/ghinks/ghinks/cmd-deploy-log-level) %
NAME           READY   STATUS    RESTARTS   AGE
gadget-bnp89   1/1     Running   0          7s
$ ../kubectl logs -n gadget gadget-bnp89
time="2024-01-03T14:36:47Z" level=warning msg="failed to get cgroups info of container 0fa989494188d2b3fc4520b7c52579417fbcd54fab79768c5ab0c0446b303c15 from /proc/9419/cgroup: cgroup path not found in /proc/PID/cgroup"
time="2024-01-03T14:36:47Z" level=error msg="cgroup enricher: failed to get cgroup paths on container 0fa989494188d2b3fc4520b7c52579417fbcd54fab79768c5ab0c0446b303c15: cgroup path not found in /proc/PID/cgroup"
time="2024-01-03T14:36:47Z" level=warning msg="failed to get cgroups info of container 0fa989494188d2b3fc4520b7c52579417fbcd54fab79768c5ab0c0446b303c15 from /proc/9419/cgroup: cgroup path not found in /proc/PID/cgroup"

I have some comments but nothing critical.
Also, I would like to get @flyth opinion as we have other loggers and I would like to understand how we can articulate this contribution with them.

I will enable the CI to run for your contribution.
You can also undraft this PR as I think we are near the truth.

Best regards.

EDIT: It seems you have to handle the conflict for go.mod to enable the CI.
Moreover, I do not think you actually need this replace.

Comment on lines 99 to 105
strLevels := make([]string, len(log.AllLevels))
for i, level := range log.AllLevels {
strLevels[i] = level.String()
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we use copy() here?

gadget-container/entrypoint/entrypoint.go Outdated Show resolved Hide resolved
gadget-container/entrypoint/entrypoint.go Show resolved Hide resolved
Comment on lines 492 to 499
case "GADGET_TRACER_MANAGER_LOG_LEVEL":
gadgetContainer.Env[i].Value = daemonLogLevel
Copy link
Member

Choose a reason for hiding this comment

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

Before assigning here, I think we should test that the values belongs to strLevels.
You can take a look at slices.Contains().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes , agreed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

slice contains check

check added.

@eiffel-fl eiffel-fl marked this pull request as ready for review January 3, 2024 14:40
@flyth
Copy link
Member

flyth commented Jan 4, 2024

First of all: Great contribution, thanks!

Also, I would like to get @flyth opinion as we have other loggers and I would like to understand how we can articulate this contribution with them.

I think this'll fit in nicely with what we have.

To give some context:
We differentiate between the global logger and loggers that are tied to a gadget run:

  • The global one is using plain logrus right now, so exactly what this PR targets.
  • The other loggers are created whenever a gadget is run and the output is sent over the network to the client(s) - the log level can already be set individually when starting a gadget using the verbose flag. Those loggers use the same API as logrus to be able to use them as a drop-in replacement in the code, but they aren't affected by this PR.

Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Thank you for the last commit!
I will test it again but in the meanwhile I will run the CI!

Comment on lines 101 to 103
strLevels = make([]string, len(log.AllLevels))
for _, level := range log.AllLevels {
strLevels = append(strLevels, level.String())
Copy link
Member

Choose a reason for hiding this comment

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

It is not possible to use copy() here?
Something like this:

Suggested change
strLevels = make([]string, len(log.AllLevels))
for _, level := range log.AllLevels {
strLevels = append(strLevels, level.String())
strLevels = make([]string, len(log.AllLevels))
copy(strLevels, log.AllLevels)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logrus all levels is an int and has to have a conversion to a String type so a loop is required. But I'm happy to be corrected. Although I had lots of c/c++ experience the reason I'm doing this work is partially to improve my go.

Copy link
Member

Choose a reason for hiding this comment

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

I tested it yesterday and I also got this issue.
And indeed, this does not make real sense to copy() int to a string buffer!

Copy link
Contributor Author

@ghinks ghinks Jan 5, 2024

Choose a reason for hiding this comment

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

thank you, I'm looking at the squash/rebase for the commit now.

Copy link
Member

Choose a reason for hiding this comment

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

You are welcome!
Can you please just run again make lint?
For the rebase I think something like this may help you:

$ git rebase -i HEAD~16
# An editor open, replace almost all, except the first, pick by 's'. Close the editor once OK.
# The editor open again to let you write the commit message.

In the meanwhile, I will test it again but everything should be OK.

cmd/kubectl-gadget/deploy.go Outdated Show resolved Hide resolved
charts/Makefile Outdated Show resolved Hide resolved
@eiffel-fl
Copy link
Member

The other loggers are created whenever a gadget is run and the output is sent over the network to the client(s) - the log level can already be set individually when starting a gadget using the verbose flag. Those loggers use the same API as logrus to be able to use them as a drop-in replacement in the code, but they aren't affected by this PR.

With --verbose, we print all the log levels.
So, I was wondering if we can add the same idea, i.e. setting log level, for each gadget.
Of course, if we decide to go, we will do it in another PR.

@@ -19,7 +19,9 @@ import (
_ "embed"
"encoding/json"
"fmt"
log "github.com/sirupsen/logrus"
Copy link
Member

Choose a reason for hiding this comment

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

Just run make lint to have this import set at the correct place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do, sorry still testing cleanup

Copy link
Member

Choose a reason for hiding this comment

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

No worries, this is not the end of the world to push a non-linted code!

Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

I tested it and got this strange behavior:

Error: invalid log level "foobar", valid levels are: , , , , , , , panic, fatal, error, warning, info, debug, trace

The following patch solves this, otherwise we would double the slice size while keeping empty string at the beginning:

diff --git a/cmd/kubectl-gadget/deploy.go b/cmd/kubectl-gadget/deploy.go
index e618caaa..fdd5123f 100644
--- a/cmd/kubectl-gadget/deploy.go
+++ b/cmd/kubectl-gadget/deploy.go
@@ -100,8 +100,8 @@ var supportedHooks = []string{"auto", "crio", "podinformer", "nri", "fanotify",
 func init() {
        commonutils.AddRuntimesSocketPathFlags(deployCmd, &runtimesConfig)
        strLevels = make([]string, len(log.AllLevels))
-       for _, level := range log.AllLevels {
-               strLevels = append(strLevels, level.String())
+       for i, level := range log.AllLevels {
+               strLevels[i] = level.String()
        }
        deployCmd.PersistentFlags().StringVarP(
                &image,

Regarding using copy(), this is easier to say than to actually do as golang will complain regarding types.

Otherwise, the remaining works perfectly:

$ ./kubectl-gadget deploy --image-pull-policy=Never --daemon-log-level warning
...
$ ../kubectl logs -n gadget gadget-h5z28
time="2024-01-04T13:56:53Z" level=warning msg="failed to get cgroups info of container 361433f5cc92af30518cc77575babd563cdad649493cc1379e01d47c02b284dc from /proc/14171/cgroup: cgroup path not found in /proc/PID/cgroup"
time="2024-01-04T13:56:53Z" level=error msg="cgroup enricher: failed to get cgroup paths on container 361433f5cc92af30518cc77575babd563cdad649493cc1379e01d47c02b284dc: cgroup path not found in /proc/PID/cgroup"
time="2024-01-04T13:56:53Z" level=warning msg="failed to get cgroups info of container 361433f5cc92af30518cc77575babd563cdad649493cc1379e01d47c02b284dc from /proc/14171/cgroup: cgroup path not found in /proc/PID/cgroup

The CI is OK, except a little lint issue.
Also, can you please rebase your history to only have one commit and detailing what this commit do in the commit message?

@ghinks ghinks changed the title cmd/deploy log level in ig-k8s pod ( draft ) cmd/deploy log level in ig-k8s pod Jan 4, 2024
Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

Thank you!
I tested it and everything is fine:

$ ./kubectl-gadget deploy --image-pull-policy=Never --daemon-log-level foobar 
Creating Namespace/gadget...
Creating ServiceAccount/gadget...
Creating ClusterRole/gadget-cluster-role...
Creating ClusterRoleBinding/gadget-cluster-role-binding...
Creating Role/gadget-role...
Creating RoleBinding/gadget-role-binding...
Error: invalid log level "foobar", valid levels are: panic, fatal, error, warning, info, debug, trace
$ ./kubectl-gadget deploy --image-pull-policy=Never --daemon-log-level warning
...
$ ../kubectl logs -n gadget gadget-4l5wf
time="2024-01-05T12:31:35Z" level=warning msg="failed to get cgroups info of container 302ee8b43b673123555f69345c3d84abf694eb297313ed5c5e6ba3344c312625 from /proc/10599/cgroup: cgroup path not found in /proc/PID/cgroup"
time="2024-01-05T12:31:35Z" level=error msg="cgroup enricher: failed to get cgroup paths on container 302ee8b43b673123555f69345c3d84abf694eb297313ed5c5e6ba3344c312625: cgroup path not found in /proc/PID/cgroup"
time="2024-01-05T12:31:35Z" level=warning msg="failed to get cgroups info of container 302ee8b43b673123555f69345c3d84abf694eb297313ed5c5e6ba3344c312625 from /proc/10599/cgroup: cgroup path not found in /proc/PID/cgroup"

I will wait for you to push the rebased commit and make lint it and I will merge it.

Best regards.

@ghinks ghinks force-pushed the ghinks/cmd-deploy-log-level branch from 39f6eda to 5f5a76d Compare January 5, 2024 12:52
- makefile
- deploy.go

changes to pass log level

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- remove debug line

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
add a comment for sed on macos so that
folks understand that you need to give
an extra argument for a backup file or
empty string for none.

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
…tion\nfor sed in the chart version update for use\nof empty string for the interim edit in place\nfile. This will not leave any backup file

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- Change the daemonLogLevel to use a string
- add some logging into the entrypoint to test locally.

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
ghinks and others added 11 commits January 5, 2024 07:56
 - fix space in makefile after -i
- add default of info to the gadget values
- add missing daemonLogLevels, that was missed off before

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
…emon-log-level. This is useful for debugging issues in the field. The

new command will set the environment variable **GADGET_TRACER_MANAGER_LOG_LEVEL** in the ig-k8s pod.  The default value will be **info**.

Changes were made to the daemonset chart to add the new command line option and to set the environment variable in the pod.
Changes were made to the gadget container to set the log level based on the environment variable.
The log level is set in entrypoint.go, gadgettracermanager/main.go and cleanup.go.

To set the GADGET_TRACER_MANAGER_LOG_LEVEL to trace, run the following command:

```shell
 ./kubectl-gadget deploy --daemon-log-level=trace
 ```

The log level can be set to any of the following values from the logrus package:
- trace
- debug
- info
- warn
- error
- fatal
- panic

To validate this PR on a local image I used minikube.
- build the images locally **make gadget-container** ( required as daemonset chart is updated with new env var )
- add the image to the local k8s cluster, in my case minikube via "minikube cache add ghcr.io/inspektor-gadget/inspektor-gadget:ghinks/cmd-deploy-log-level"
- make kubectl-gadget
- deploy via './kubectl-gadget deploy --daemon-log-level=trace --image-pull-policy=Never'
- the deployment was validated via 'k describe pod -n "gadget" $mypod'
- undeploy via 'kubectl-gadget  undeploy'

Testing on minikube required a local image as minikube would try to pull the image from the registry.  The image was built locally and added to the minikube cache.
```shell
export MY_CONTAINER="ghcr.io/inspektor-gadget/inspektor-gadget:ghinks-cmd-deploy-log-level"
minikube cache delete $MY_CONTAINER && minikube image rm $MY_CONTAINER && minikube cache add $MY_CONTAINER
```
To view the logs from the pod:

```shell
export MY_POD=`kubectl get pods -o jsonpath='{.items[*].metadata.name}' -n gadget`
k logs -n gadget $MY_POD -f
```

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- add help on levels to the deploy command
- add check on the tracermanager for invalid logrus log level

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- add default log level message

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
…vel.go

Co-authored-by: eiffel-fl <laniel_francis@privacyrequired.com>
Signed-off-by: Glenn <ghinks@yahoo.com>
Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
update error format to use ErrorF

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
…emon-log-level. This is useful for debugging issues in the field. The

new command will set the environment variable **GADGET_TRACER_MANAGER_LOG_LEVEL** in the ig-k8s pod.  The default value will be **info**.

Changes were made to the daemonset chart to add the new command line option and to set the environment variable in the pod.
Changes were made to the gadget container to set the log level based on the environment variable.
The log level is set in entrypoint.go, gadgettracermanager/main.go and cleanup.go.

To set the GADGET_TRACER_MANAGER_LOG_LEVEL to trace, run the following command:

```shell
 ./kubectl-gadget deploy --daemon-log-level=trace
 ```

The log level can be set to any of the following values from the logrus package:
- trace
- debug
- info
- warn
- error
- fatal
- panic

To validate this PR on a local image I used minikube.
- build the images locally **make gadget-container** ( required as daemonset chart is updated with new env var )
- add the image to the local k8s cluster, in my case minikube via "minikube cache add ghcr.io/inspektor-gadget/inspektor-gadget:ghinks/cmd-deploy-log-level"
- make kubectl-gadget
- deploy via './kubectl-gadget deploy --daemon-log-level=trace --image-pull-policy=Never'
- the deployment was validated via 'k describe pod -n "gadget" $mypod'
- undeploy via 'kubectl-gadget  undeploy'

Testing on minikube required a local image as minikube would try to pull the image from the registry.  The image was built locally and added to the minikube cache.
```shell
export MY_CONTAINER="ghcr.io/inspektor-gadget/inspektor-gadget:ghinks-cmd-deploy-log-level"
minikube cache delete $MY_CONTAINER && minikube image rm $MY_CONTAINER && minikube cache add $MY_CONTAINER
```
To view the logs from the pod:

```shell
export MY_POD=`kubectl get pods -o jsonpath='{.items[*].metadata.name}' -n gadget`
k logs -n gadget $MY_POD -f
```

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- added trace level to clean up
- ran make lint which resulted in a import order changes

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- add an if clause for osx builds for the chart build

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
- use assign rather than append in str levels

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
Co-authored-by: eiffel-fl <laniel_francis@privacyrequired.com>
Signed-off-by: Glenn <ghinks@yahoo.com>
Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
@ghinks ghinks force-pushed the ghinks/cmd-deploy-log-level branch from 5f5a76d to 4830632 Compare January 5, 2024 12:56
charts/Makefile Outdated Show resolved Hide resolved
- use sed based on the result of sed --version output

Signed-off-by: Glenn Hinks <ghinks@yahoo.com>
Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

I have some minor comments regarding sed handlings.
Regarding the rebase, if it is easier for you, we can handle it at merge, what do you think?

Best regards.

charts/Makefile Outdated Show resolved Hide resolved
charts/Makefile Outdated

.DEFAULT_GOAL := help

clean:
rm -rf $(BUILD_DIR)

build: clean
# the --version option is only found in the GNU version of sed:
ifeq ($(shell sed --version >/dev/null 2>&1 ; echo $$?),0)
@echo Using GNU sed
Copy link
Member

Choose a reason for hiding this comment

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

This message will be printed twice.
You can just drop this if.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I appear to have pushed up more than I intended and am removing that if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have pushed again. Sincere thanks for taking the time to help me on this.

- remove duplicated if statements in makefile

Signed-off-by: ghinks <ghinks@yahoo.com>
@eiffel-fl
Copy link
Member

The CI explodes due to GitHub issues.
I nonetheless tested locally make lint and it modified the code this way:

diff --git a/gadget-container/cleanup/cleanup.go b/gadget-container/cleanup/cleanup.go
index 36fa8f93..8c52feeb 100644
--- a/gadget-container/cleanup/cleanup.go
+++ b/gadget-container/cleanup/cleanup.go
@@ -16,10 +16,11 @@ package main
 
 import (
        "encoding/json"
-       "github.com/inspektor-gadget/inspektor-gadget/pkg/utils/gadgettracermanagerloglevel"
        "os"
        "path/filepath"
 
+       "github.com/inspektor-gadget/inspektor-gadget/pkg/utils/gadgettracermanagerloglevel"
+
        nriv1 "github.com/containerd/nri/types/v1"
        log "github.com/sirupsen/logrus"
 
diff --git a/gadget-container/entrypoint/entrypoint.go b/gadget-container/entrypoint/entrypoint.go
index 35bb1f36..2a808f38 100644
--- a/gadget-container/entrypoint/entrypoint.go
+++ b/gadget-container/entrypoint/entrypoint.go
@@ -19,18 +19,19 @@ import (
        "encoding/json"
        "errors"
        "fmt"
-       nriv1 "github.com/containerd/nri/types/v1"
-       "github.com/inspektor-gadget/inspektor-gadget/pkg/oci"
-       "github.com/inspektor-gadget/inspektor-gadget/pkg/utils/gadgettracermanagerloglevel"
-       "github.com/inspektor-gadget/inspektor-gadget/pkg/utils/host"
-       log "github.com/sirupsen/logrus"
-       "golang.org/x/sys/unix"
        "io/fs"
        "os"
        "path/filepath"
        "regexp"
        "strings"
        "syscall"
+
+       nriv1 "github.com/containerd/nri/types/v1"
+       "github.com/inspektor-gadget/inspektor-gadget/pkg/oci"
+       "github.com/inspektor-gadget/inspektor-gadget/pkg/utils/gadgettracermanagerloglevel"
+       "github.com/inspektor-gadget/inspektor-gadget/pkg/utils/host"
+       log "github.com/sirupsen/logrus"
+       "golang.org/x/sys/unix"
 )
 
 const gadgetPullSecretPath = "/var/run/secrets/gadget/pull-secret/config.json"

Can you please run make lint and push another commit?

- run linter for import issues

Signed-off-by: ghinks <ghinks@yahoo.com>
Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Thank you for the latest commit and for dealing with all my feedback!
This is a good contribution and it is really welcomed :D!
I tested it again and it works perfectly:

$ kubectl logs -n gadget gadget-lzjsc   (remotes/ghinks/ghinks/cmd-deploy-log-level) %
time="2024-01-10T08:58:56Z" level=warning msg="failed to get cgroups info of container 015ef15f9bc38f91a54bef96bf3104c4fae39bef21597f9223890c2bde9dbbcd from /proc/5276/cgroup: cgroup path not found in /proc/PID/cgroup"
time="2024-01-10T08:58:56Z" level=error msg="cgroup enricher: failed to get cgroup paths on container 015ef15f9bc38f91a54bef96bf3104c4fae39bef21597f9223890c2bde9dbbcd: cgroup path not found in /proc/PID/cgroup"
time="2024-01-10T08:58:56Z" level=warning msg="failed to get cgroups info of container 015ef15f9bc38f91a54bef96bf3104c4fae39bef21597f9223890c2bde9dbbcd from /proc/5276/cgroup: cgroup path not found in /proc/PID/cgroup"

I will squash and merge it!

@eiffel-fl eiffel-fl merged commit 3ddce30 into inspektor-gadget:main Jan 10, 2024
53 checks passed
@ghinks
Copy link
Contributor Author

ghinks commented Jan 10, 2024

Thank you for all the help @eiffel-fl. Having an open source booth at Kubecon did have a benefit for you folks.

@eiffel-fl
Copy link
Member

Thank you for all the help @eiffel-fl. Having an open source booth at Kubecon did have a benefit for you folks.

You are welcome and thank you for having the patience to handle all my comments!
I was not present at KubeCon, but my coworkers told me it was a great time there!
In any cases, if you plan to attend another conference and want to meet us, you can reach us on slack!

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.

None yet

4 participants