Skip to content

Commit 1050690

Browse files
authored
Version v1.2.0
- Add the -i option for the sudo command when running on the kubernetes host - Bump dependencies
2 parents 1d1bd4f + 52e7372 commit 1050690

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Release history
22

3+
## v1.2.0
4+
5+
- Bump dependencies
6+
- Add the `-i` option for the `sudo` command when running on the kubernetes host
7+
8+
## v1.1.5
9+
10+
- Bump dependencies
11+
12+
## v1.1.4
13+
14+
- Bump dependencies
15+
316
## v1.1.3
417

518
- Bump dependencies

internal/containerinfo/containerinfo.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import (
1111
)
1212

1313
const containerdShellCmd = `"if command -v nerdctl >/dev/null 2>&1; then
14-
exec nerdctl inspect %[1]s --format {{.State.Pid}}
15-
fi
16-
exec crictl inspect --output go-template --template={{.info.pid}} %[1]s"`
14+
exec nerdctl inspect %[1]s --format {{.State.Pid}};
15+
else
16+
exec crictl inspect --output go-template --template={{.info.pid}} %[1]s;
17+
fi"`
1718

1819
type ContainerInfo struct {
1920
NodeName string
@@ -100,6 +101,7 @@ func GetPidDiscoverCommand(containerInfo *ContainerInfo) ([]string, error) {
100101
case "docker":
101102
return []string{
102103
"sudo",
104+
"-i",
103105
"docker",
104106
"inspect",
105107
containerInfo.ContainerID,
@@ -110,6 +112,7 @@ func GetPidDiscoverCommand(containerInfo *ContainerInfo) ([]string, error) {
110112
case "containerd":
111113
return []string{
112114
"sudo",
115+
"-i",
113116
"sh",
114117
"-c",
115118
fmt.Sprintf(containerdShellCmd, containerInfo.ContainerID),
@@ -118,6 +121,7 @@ func GetPidDiscoverCommand(containerInfo *ContainerInfo) ([]string, error) {
118121
case "cri-o":
119122
return []string{
120123
"sudo",
124+
"-i",
121125
"crictl",
122126
"inspect",
123127
"--output",

0 commit comments

Comments
 (0)