Merge pull request #38101 from CaoShuFeng/haripin_nsenter

Automatic merge from submit-queue (batch tested with PRs 38101, 41431, 39606, 41569, 41509)

[hairpin] fix argument of nsenter

**Release note**:

```release-note
None
```

We should use:
	nsenter --net=netnsPath -- -F some_command
instend of:
	nsenter -n netnsPath -- -F some_command
Because "nsenter -n netnsPath" get an error output:
	# nsenter -n /proc/67197/ns/net ip addr
	nsenter: neither filename nor target pid supplied for ns/net

If we really want use -n, we need to use -n in such format:
	# sudo nsenter -n/proc/67197/ns/net ip addr
This commit is contained in:
Kubernetes Submit Queue
2017-02-16 15:49:10 -08:00
committed by GitHub

View File

@@ -50,7 +50,7 @@ func SetUpContainerPath(netnsPath string, containerInterfaceName string) error {
if netnsPath[0] != '/' {
return fmt.Errorf("netnsPath path '%s' was invalid", netnsPath)
}
nsenterArgs := []string{"-n", netnsPath}
nsenterArgs := []string{"--net=" + netnsPath}
return setUpContainerInternal(containerInterfaceName, netnsPath, nsenterArgs)
}