Repository navigation
Conversation
…ules The grpc-netty-* modules each shipped their own GrpcManagedChannelFactory and ManagedChannelWrapper in io.spiffe.workloadapi.internal, the same package core uses, and core picked whichever came first on the classpath. That split package breaks consumers on the Java module path. Move ManagedChannelWrapper into core with a plain close hook, add a GrpcChannelProvider interface, and have each grpc-netty module register its provider in its own package through META-INF/services. Core loads it with ServiceLoader and picks the one supporting the current OS and arch, falling back to the first one found so TCP addresses keep working. Core no longer needs a grpc-netty module on its compile classpath. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #108
The
grpc-netty-*modules each shipped their ownGrpcManagedChannelFactoryandManagedChannelWrapperinio.spiffe.workloadapi.internal, the same package core uses, and core just got whichever copy came first on the classpath. That split package is what breaks consumers on the module path.ManagedChannelWrappernow lives in core and takes a plain close hook instead of a NettyEventLoopGroup, since the Linux module uses shaded Netty and the macOS ones don't. Core has a smallGrpcChannelProviderinterface, each module implements it in its own package (internal.linux,internal.macos,internal.macos.aarch64) and registers it inMETA-INF/services, andGrpcManagedChannelFactoryloads it withServiceLoader. It picks the provider that supports the current OS and arch, and falls back to the first one found, so a TCP address still works with whatever module you have and a Unix socket on the wrong platform fails the same way it does today. If a provider can't be loaded and nothing else is found, that error is the cause of the "no provider" exception.DefaultWorkloadApiClientis unchanged, and core only needs agrpc-nettymodule at test time now.Tests cover provider selection, the fallback, load errors and the close hook in core, plus a test per module that its provider is registered and builds a TCP channel. I ran the Build workflow on my fork, linux and macOS on 17, 21 and 25, all green.
Notes
Everything that moved is under
internal, which japicmp already skips, so nothing public changes. The modules onlycompileOnlycore, so their published POMs stay the same. Mixing a new core with an oldgrpc-netty-*jar won't work, but the README and the BOM already say those versions have to match.