-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Unix domain sockets in IoT Edge on Windows (#518)
Changes to Edge Agent: - When Edge Agent builds the Docker "createOptions" string to send to iotedged, the bind-mount specification on Windows needs to point to the _parent directory_ for each socket file, not to the files themselves. On Windows, Docker can't bind-mount a Unix domain socket file. Changes to edgelet: - Change the default management and workload URIs (YAML config) for Windows to specify Unix domain sockets instead of HTTP endpoints. - Deserialize the management and workload URIs into file paths on Windows by parsing them with the `file://` scheme instead of `unix://`. This is because the `url` crate does lots of special handling of Windows paths for the `file://` scheme, but doesn't do it for "non-special" schemes like `unix://` (per the URL spec). - Depend on `mio-uds-windows`, `tokio-uds-windows`, and `hyperlocal-windows` crates on Windows. These are adaptations of `mio-uds`, `tokio-uds`, and `hyperlocal` respectively. - Where appropriate, remove the `#[cfg(unix)]` attribute from Unix domain socket-specific features that expected a Unix-only implementation, and add it in places where we still need to differentiate on platform. Notable examples: - In `edgelet-http::unix::listener(path)`, only use umask to reset socket file permissions on Unix platforms. - On Unix platforms check for existence of the Unix domain socket file with `file.exists()`. On Windows, use `fs::symlink_metadata()` instead because it works on reparse points (Unix domain sockets in Windows are reparse points). - Implement `UnixStreamExt::pid(&self)` for Windows - A test that previously used `UnixStream::pair()` to do its setup doesn't work on Windows because Winsock2 doesn't implement BSD's `pair` function. So create an ugly workaround for the test on Windows. - Use TempDir more pervasively in tests that create a socket file. In a Unix-only world we got away with simpler solutions that don't work if you can't rely on the existence of `/tmp`. - Move the test helper routine `run_uds_server` out of a linux-specific source file and into the parent `mod.rs`. - When the Edge Agent container is created in Windows, bind-mount the parent directory for each socket file rather than the file itself, just as Edge Agent does for other modules. In the Windows installer script: - Create the parent directory for each socket file, and give Modify rights to a well-known group (`NT AUTHORITY\Authenticated Users`) that will exist in any container so that non-privileged modules can access it. Since we give the rights to the parent folder, we don't need to recreate the permissions every time iotedged restarts, like we do for Unix platforms. (_Note: this part of the script is disabled for now, until we have everything in place to fully support UDS in IoT Edge on Windows, specifically RS5-based module images and the ability to use process-isolated containers on non-Server Windows._)
- Loading branch information
1 parent
c71ef72
commit b1ee469
Showing
23 changed files
with
478 additions
and
174 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Oops, something went wrong.