Skip to content

Implement container provisioner gRPC client#50

Open
yulmwu wants to merge 3 commits intomainfrom
feat/grpc-client
Open

Implement container provisioner gRPC client#50
yulmwu wants to merge 3 commits intomainfrom
feat/grpc-client

Conversation

@yulmwu
Copy link
Copy Markdown
Member

@yulmwu yulmwu commented Mar 31, 2026

For details about the Container Provisioner gRPC server, refer to the PR below:

In this PR, a client has been implemented based on the gRPC proto, and environment variables have been added to allow toggling between HTTP and gRPC communication. The added environment variables are as follows:

STACKS_PROVISIONER_USE_GRPC=false
STACKS_PROVISIONER_GRPC_ADDR=localhost:9090
# STACKS_PROVISIONER_API_KEY is shared.

The Proto IDL is also managed using Buf Schema Registry (BSR).

make buf-install
buf registry login

make buf-generate

Existing stubs are located under internal/gen/stack/v1.

@yulmwu yulmwu self-assigned this Mar 31, 2026
@yulmwu yulmwu added enhancement New feature or request feature labels Mar 31, 2026
@yulmwu
Copy link
Copy Markdown
Member Author

yulmwu commented Mar 31, 2026

This PR does not meet the test coverage target (>= 70%).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements a gRPC-based client for the Container Provisioner and adds configuration switches to select between the existing HTTP client and the new gRPC client at runtime.

Changes:

  • Add internal/stack gRPC client implementation and generated protobuf stubs under internal/gen/stack/v1.
  • Extend stack configuration/env to support STACKS_PROVISIONER_USE_GRPC and STACKS_PROVISIONER_GRPC_ADDR, and wire selection logic in the server entrypoint.
  • Add Buf/BSR generation tooling (Makefile + buf.gen.yaml) and update examples/docs.

Reviewed changes

Copilot reviewed 11 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Documents new env vars and Buf/BSR workflow (currently has a formatting issue inside the env code block).
Makefile Adds targets for buf install/lint/generate plus basic Go fmt/vet/test/build.
internal/stack/grpc_client.go New gRPC client implementation for StackService (timeout and transport security need follow-ups).
internal/http/integration/testenv_test.go Minor formatting alignment in test config literals.
internal/http/integration/admin_test.go Minor formatting alignment in test config literals.
internal/http/handlers/testenv_test.go Minor formatting alignment in test config literals.
internal/gen/stack/v1/stack.pb.go Generated protobuf messages/enums for StackService API.
internal/gen/stack/v1/stack_grpc.pb.go Generated gRPC client/server interfaces and handlers for StackService.
internal/config/config.go Adds stack gRPC address/enable flags; validates base URL vs gRPC addr based on mode; includes in log formatting.
go.mod Adds grpc/protobuf dependencies and updates indirect deps accordingly.
go.sum Updates dependency checksums due to grpc/protobuf/buf-related dependency graph changes.
codecov.yaml Excludes new gRPC client file from coverage (consistent with existing HTTP client exclusion).
cmd/server/main.go Selects HTTP vs gRPC provisioner client based on config and initializes the chosen implementation.
buf.lock Adds Buf lockfile metadata.
buf.gen.yaml Configures Buf code generation plugins/paths for Go and Go gRPC.
.env.example Adds the new stack gRPC toggle/address environment variables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants