Merge pull request #7577 from dcantah/maintenance-cri-winns
This commit is contained in:
		| @@ -32,21 +32,6 @@ import ( | |||||||
| 	osinterface "github.com/containerd/containerd/pkg/os" | 	osinterface "github.com/containerd/containerd/pkg/os" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // WithWindowsNetworkNamespace sets windows network namespace for container. |  | ||||||
| // TODO(windows): Move this into container/containerd. |  | ||||||
| func WithWindowsNetworkNamespace(path string) oci.SpecOpts { |  | ||||||
| 	return func(ctx context.Context, client oci.Client, c *containers.Container, s *runtimespec.Spec) error { |  | ||||||
| 		if s.Windows == nil { |  | ||||||
| 			s.Windows = &runtimespec.Windows{} |  | ||||||
| 		} |  | ||||||
| 		if s.Windows.Network == nil { |  | ||||||
| 			s.Windows.Network = &runtimespec.WindowsNetwork{} |  | ||||||
| 		} |  | ||||||
| 		s.Windows.Network.NetworkNamespace = path |  | ||||||
| 		return nil |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // namedPipePath returns true if the given path is to a named pipe. | // namedPipePath returns true if the given path is to a named pipe. | ||||||
| func namedPipePath(p string) bool { | func namedPipePath(p string) bool { | ||||||
| 	return strings.HasPrefix(p, `\\.\pipe\`) | 	return strings.HasPrefix(p, `\\.\pipe\`) | ||||||
|   | |||||||
| @@ -85,7 +85,7 @@ func (c *criService) containerSpec( | |||||||
| 		// Clear the root location since hcsshim expects it. | 		// Clear the root location since hcsshim expects it. | ||||||
| 		// NOTE: readonly rootfs doesn't work on windows. | 		// NOTE: readonly rootfs doesn't work on windows. | ||||||
| 		customopts.WithoutRoot, | 		customopts.WithoutRoot, | ||||||
| 		customopts.WithWindowsNetworkNamespace(netNSPath), | 		oci.WithWindowsNetworkNamespace(netNSPath), | ||||||
| 		oci.WithHostname(sandboxConfig.GetHostname()), | 		oci.WithHostname(sandboxConfig.GetHostname()), | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -51,7 +51,7 @@ func (c *Controller) sandboxContainerSpec(id string, config *runtime.PodSandboxC | |||||||
| 		// Clear the root location since hcsshim expects it. | 		// Clear the root location since hcsshim expects it. | ||||||
| 		// NOTE: readonly rootfs doesn't work on windows. | 		// NOTE: readonly rootfs doesn't work on windows. | ||||||
| 		customopts.WithoutRoot, | 		customopts.WithoutRoot, | ||||||
| 		customopts.WithWindowsNetworkNamespace(nsPath), | 		oci.WithWindowsNetworkNamespace(nsPath), | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
| 	specOpts = append(specOpts, customopts.WithWindowsDefaultSandboxShares) | 	specOpts = append(specOpts, customopts.WithWindowsDefaultSandboxShares) | ||||||
|   | |||||||
| @@ -85,7 +85,7 @@ func (c *criService) containerSpec( | |||||||
| 		// Clear the root location since hcsshim expects it. | 		// Clear the root location since hcsshim expects it. | ||||||
| 		// NOTE: readonly rootfs doesn't work on windows. | 		// NOTE: readonly rootfs doesn't work on windows. | ||||||
| 		customopts.WithoutRoot, | 		customopts.WithoutRoot, | ||||||
| 		customopts.WithWindowsNetworkNamespace(netNSPath), | 		oci.WithWindowsNetworkNamespace(netNSPath), | ||||||
| 		oci.WithHostname(sandboxConfig.GetHostname()), | 		oci.WithHostname(sandboxConfig.GetHostname()), | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -51,7 +51,7 @@ func (c *criService) sandboxContainerSpec(id string, config *runtime.PodSandboxC | |||||||
| 		// Clear the root location since hcsshim expects it. | 		// Clear the root location since hcsshim expects it. | ||||||
| 		// NOTE: readonly rootfs doesn't work on windows. | 		// NOTE: readonly rootfs doesn't work on windows. | ||||||
| 		customopts.WithoutRoot, | 		customopts.WithoutRoot, | ||||||
| 		customopts.WithWindowsNetworkNamespace(nsPath), | 		oci.WithWindowsNetworkNamespace(nsPath), | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
| 	specOpts = append(specOpts, customopts.WithWindowsDefaultSandboxShares) | 	specOpts = append(specOpts, customopts.WithWindowsDefaultSandboxShares) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Maksym Pavlenko
					Maksym Pavlenko