Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2691 from olljanat/34795-npipe-mount-type
Support for Windows named pipes mounts
- Loading branch information
Showing
10 changed files
with
402 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package flagparser | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/docker/swarmkit/api" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
// parseNpipe only supports a very simple version of anonymous npipes for | ||
// testing the most basic of data flows. Replace with a --mount flag, similar | ||
// to what we have in docker service. | ||
func parseNpipe(flags *pflag.FlagSet, spec *api.ServiceSpec) error { | ||
if flags.Changed("npipe") { | ||
npipes, err := flags.GetStringSlice("npipe") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
container := spec.Task.GetContainer() | ||
|
||
for _, npipe := range npipes { | ||
parts := strings.SplitN(npipe, ":", 2) | ||
if len(parts) != 2 { | ||
return fmt.Errorf("npipe format %q not supported", npipe) | ||
} | ||
container.Mounts = append(container.Mounts, api.Mount{ | ||
Type: api.MountTypeNamedPipe, | ||
Source: parts[0], | ||
Target: parts[1], | ||
}) | ||
} | ||
} | ||
|
||
return nil | ||
} |
5 changes: 5 additions & 0 deletions
5
cmd/swarmd/defaults/defaults.go → cmd/swarmd/defaults/defaults_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
// +build !windows | ||
|
||
package defaults | ||
|
||
// ControlAPISocket is the default path where clients can contact the swarmd control API. | ||
var ControlAPISocket = "/var/run/swarmd.sock" | ||
|
||
// EngineAddr is Docker default socket file on Linux | ||
var EngineAddr = "unix:///var/run/docker.sock" | ||
|
||
// StateDir is the default path to the swarmd state directory | ||
var StateDir = "/var/lib/swarmd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// +build windows | ||
|
||
package defaults | ||
|
||
// ControlAPISocket is the default path where clients can contact the swarmd control API. | ||
var ControlAPISocket = "//./pipe/swarmd" | ||
|
||
// EngineAddr is Docker default named pipe on Windows | ||
var EngineAddr = "npipe:////./pipe/docker_engine" | ||
|
||
// StateDir is the default path to the swarmd state directory | ||
var StateDir = `C:\ProgramData\swarmd` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters