Skip to content
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

add gRPC client builtins #1450

Closed
srenatus opened this issue May 28, 2019 · 4 comments
Closed

add gRPC client builtins #1450

srenatus opened this issue May 28, 2019 · 4 comments

Comments

@srenatus
Copy link
Contributor

We've got builtins to query HTTP endpoints, and we're tracking an enhancement for LDAP querying in #938. What about gRPC? It's not HTTP-compatible enough to be comfortably queried using http.send.

Commonly, you'd generate your gRPC client code from the proto3 service definition. However, if you look at how grpcurl does it, cleverly using github.com/jhump/protoreflect to fetch the service's definition at runtime using the reflection API -- OPA could do the same, and make it available via an interface not too different from http.send.

It could look like grpc.send({method, host, message, metadata, output}) (metadata is just headers in grpc-land). The marshaling and unmarshaling of the input and output messages could be done via JSON, just like grpcurl does it.

output := grpc.send({"method": "chef.automate.domain.authz.v2.Policies/ListPolicies", "host": "your-grpc-server", "message": {}, "headers": {"X-Foo":"bar", "X-Opa": "rules"}})

Note that gRPC defaults to using TLS, so the recent improvements to http.send TLS support (#1067) would be relevant here, too.

Caveats

@tsandall
Copy link
Member

I agree this would be useful, I'm just hesitant about including dependencies for N different protocols. Labeling this as "design" so that we can track it and keep it in mind.

@jpeach
Copy link
Contributor

jpeach commented Feb 28, 2020

I'd also be able to make use of GRPC builtins.

One option might be to expose additional builtins as separate Go modules. Then a runtime that uses the core OPA engine can add them if it makes sense and the dependencies are not dragged into the main module. The obvious downside of this is the increased release management overhead :)

@srenatus
Copy link
Contributor Author

✨ maybe via #3631, one day. 🌠

@stale
Copy link

stale bot commented Nov 22, 2021

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.

@stale stale bot added the inactive label Nov 22, 2021
@srenatus srenatus closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants