-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Alternative to GRPC_XDS_BOOSTRAP env variable #7605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @ejona86 . I think this request makes sense. WDYT? |
A system property is probably the best way of doing this, if we were going to do it. We might want to consider the system property overriding the environment variable (such that we'd check the system property first), but it's not obvious to me which ordering is better. It is weird that this would be provided by the binary itself though. @erikjoh, how are you generating the bootstrap file? You have a java library that auto-detects the current environment and creates it? Normally it needs deployment-specific information... |
@ejona86 I have not implemented anything yet but the plan is to have an internal Java utility that can detect environment and generate the boostrap file accordingly (for example different xDS server and credentials for testing/local). By running this utility function in the service framework startup flow we will be able to solve bootstrapping GKE, GCE, IDE and local Docker all at once without the need of manual developer intervention. Also, by doing the bootstrapping in the service framework we can utilize existing service configuration in order to expose optional config overrides to the xDS bootstrapper. I agree that it is a bit "weird" but from a developers perspective we think a solution like this might be the most convenient to adopt (only a bump in service framework version and change of gRPC channel target will suffice for most use-cases). |
I guess it would be even nicer to be able to provide the bootstrap config directly to gRPC without the need of a temporary json file, but that's maybe stretching it a bit too far, since no other grpc implementation would have such a feature and it may require exposing some internals that might change later on. |
As for the priority, my spontaneous thought is that the env variable should have higher prio so that all existing gRPC proxyless documentation still would apply without edge cases. |
Env variable having precedence over Java system property sounds good to me. |
We should consider this. Istio uses PROXY_CONFIG env variable for bootstrap config without using a file. It is good to have an option that doesn't require a file to be mounted. |
So would it be okay if I made a PR to add the extra check for an "grpc.xds.bootstrap" property (naming based on what seems to be the standard format in java properties)? |
Sounds good to me |
They tend to be like package names, so |
Fixed by #7620 |
Goal
I’m looking into creating a utility function that can dynamically create and assign the xDS bootstrap.
This could be hooked into the application startup so that xDS can be configured across different environments (IDE, GCE, GKE) without the need of startup shell scripts etc.
While almost every programming language supports dynamically setting environment variables, Java does not.
Would it be possible to have an alternative way in java to provide the location of the bootstrap file?
Possible solution
One possible solution that doesn’t break the existing API and gRPC spec would be to also try reading e.g. a java system property (System.getProperty(“grpc.xds.bootstrap”);) at
grpc-java/xds/src/main/java/io/grpc/xds/Bootstrapper.java
Lines 57 to 61 in beb3232
In the case that the GRPC_XDS_BOOSTRAP environment variable isn’t found.
Maybe something as simple as:
Alternatives
Alternative solutions would most likely require larger changes to the existing classes in order to pass the config down.
The text was updated successfully, but these errors were encountered: