Skip to content

Commit d86cc3a

Browse files
jglogandcantah
andcommitted
Upgrade vminitd API to use grpc-swift-2. (#578)
- No real notable API changes. The largest change code-wise is in Vminitd. The connection loop is set up immediately in the new API by calling runConnections() on the client, and this blocks until either the task it's running on is cancelled or beginGracefulShutdown is called. Because of this, either we'd have to modify our API to have VirtualMachineAgent implementations call some run() method, or we just put runConnections in an internal task on Vminitd. This change uses the latter approach as it's simpler. - Updated dependencies to pick up latest protobuf and grpc-swift-2 fixes. - ClientBootstrap.withConnectedSocket(fd).wait() registers the vsock fd with epoll/kqueue immediately. vminitd sends its HTTP/2 SETTINGS frame right away upon accepting the connection, so those bytes can arrive on the fd — and be read by NIO — before the gRPC pipeline is installed. With a bare pipeline, NIO has nowhere to send the bytes and discards them. - Buffer until ClientConnectionHandler is in the pipeline so it can process the SETTINGS frame and fire .ready, then schedule delivery of the buffered data with assumeIsolatedUnsafeUnchecked().execute. - To help produce more accurate merged logs, defines a `StderrLogHandler` in the vminitd Application.swift that writes timestamps to the boot log with millisecond precision and format identical to that of the log files created using the `--log-root` arg on `container`. - Updates hawkeye to latest version (v6.5.1). --------- Co-authored-by: Danny Canter <danny_canter@apple.com>
1 parent 57f623d commit d86cc3a

15 files changed

Lines changed: 6786 additions & 3453 deletions

Package.resolved

Lines changed: 37 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,19 @@ let package = Package(
3636
.executable(name: "cctl", targets: ["cctl"]),
3737
],
3838
dependencies: [
39-
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
40-
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
39+
.package(url: "https://github.com/apple/swift-log.git", from: "1.10.1"),
40+
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.7.0"),
4141
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.4"),
4242
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0"),
43-
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.26.0"),
44-
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.29.0"),
43+
.package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.3.0"),
44+
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.4.4"),
45+
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.2.0"),
46+
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.36.0"),
4547
.package(url: "https://github.com/apple/swift-nio.git", from: "2.80.0"),
48+
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.36.0"),
4649
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.20.1"),
47-
.package(url: "https://github.com/apple/swift-system.git", from: "1.4.0"),
50+
.package(url: "https://github.com/apple/swift-system.git", from: "1.6.4"),
4851
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
49-
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.36.0"),
5052
.package(url: "https://github.com/facebook/zstd.git", exact: "1.5.7"),
5153
],
5254
targets: [
@@ -57,8 +59,10 @@ let package = Package(
5759
name: "Containerization",
5860
dependencies: [
5961
.product(name: "Logging", package: "swift-log"),
60-
.product(name: "GRPC", package: "grpc-swift"),
6162
.product(name: "SystemPackage", package: "swift-system"),
63+
.product(name: "GRPCCore", package: "grpc-swift-2"),
64+
.product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"),
65+
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
6266
.product(name: "_NIOFileSystem", package: "swift-nio"),
6367
"ContainerizationArchive",
6468
"ContainerizationOCI",

Protobuf.Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ $(PROTOC):
3333
.PHONY: protoc-gen-swift
3434
protoc-gen-swift:
3535
@$(SWIFT) build --product protoc-gen-swift
36-
@$(SWIFT) build --product protoc-gen-grpc-swift
36+
@$(SWIFT) build --product protoc-gen-grpc-swift-2
3737

3838
.PHONY: protos
3939
protos: $(PROTOC) protoc-gen-swift
4040
@echo Generating protocol buffers source code...
4141
@$(PROTOC) Sources/Containerization/SandboxContext/SandboxContext.proto \
42-
--plugin=protoc-gen-grpc-swift=$(BUILD_BIN_DIR)/protoc-gen-grpc-swift \
42+
--plugin=protoc-gen-grpc-swift=$(BUILD_BIN_DIR)/protoc-gen-grpc-swift-2 \
4343
--plugin=protoc-gen-swift=$(BUILD_BIN_DIR)/protoc-gen-swift \
4444
--proto_path=Sources/Containerization/SandboxContext \
4545
--grpc-swift_out="Sources/Containerization/SandboxContext" \

0 commit comments

Comments
 (0)