Skip to content

Commit 9b6ef25

Browse files
committed
always use the last entry in the pidof command as that is the oldest
1 parent be8ea98 commit 9b6ef25

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/e2e/node/mount_propagation.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,13 @@ var _ = SIGDescribe("Mount propagation", func() {
191191
cmd = "pidof kubelet"
192192
kubeletPid, err := hostExec.IssueCommandWithResult(ctx, cmd, node)
193193
framework.ExpectNoError(err, "Checking kubelet pid")
194-
kubeletPid = strings.TrimSuffix(kubeletPid, "\n")
195-
gomega.Expect(strings.Count(kubeletPid, " ")).To(gomega.Equal(0), "kubelet should only have a single PID in the system (pidof returned %q)", kubeletPid)
196-
enterKubeletMountNS := fmt.Sprintf("nsenter -t %s -m", kubeletPid)
194+
framework.Logf("pidof kubelet returns %s", kubeletPid)
195+
// In rare cases in the CI, we are seeing two pids for kubelet.
196+
// We did some investigating and the last entry of this list is the one that we want
197+
// Higher pids are more likely to be created after the first one
198+
kubeletPids := strings.Split(strings.TrimSuffix(kubeletPid, "\n"), " ")
199+
enterKubeletMountNS := fmt.Sprintf("nsenter -t %s -m", kubeletPids[len(kubeletPids)-1])
200+
framework.Logf(enterKubeletMountNS)
197201

198202
// Check that the master and host mounts are propagated to the container runtime's mount namespace
199203
for _, mountName := range []string{"host", master.Name} {

0 commit comments

Comments
 (0)