Skip to content

Commit

Permalink
[fallback] Finalize test-control-plane naming. (#118)
Browse files Browse the repository at this point in the history
As discussed offline, for now this is built manually. I renamed all
references to "test-control-plane" as long term we expect to use this
server for other test cases.
  • Loading branch information
eugeneo authored Aug 9, 2024
1 parent 8edbdb7 commit 6c7830a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ venv-*/
out/
protos/**/*_pb2*
# Generated Go files
docker/go-control-plane/grpc/interop/grpc_testing/xdsconfig/*.pb.go
docker/test-control-plane/grpc/interop/grpc_testing/xdsconfig/*.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ RUN cp ./proto/bin/protoc ${BASE}/bin/
RUN cp -R ./proto/include/* ${BASE}/include/

# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY docker/go-control-plane/go.mod docker/go-control-plane/go.sum ./
COPY docker/test-control-plane/go.mod docker/test-control-plane/go.sum ./
RUN go mod download && go mod verify

COPY protos ./protos
COPY docker/test-control-plane .
# Make sure files generated on machine are not picked up
RUN rm -r grpc
RUN protoc -I=. --go_out=. protos/grpc/testing/xdsconfig/*.proto --go-grpc_out=.
COPY docker/go-control-plane .
RUN go build -v -tags osusergo,netgo -o /usr/local/bin/fallback-control-plane .

RUN go build -v -tags osusergo,netgo -o /usr/local/bin/test-control-plane .

# Second stage of the build which copies over only the client binary and skips
# the Go compiler and gRPC repo from the earlier stage. This significantly
# reduces the docker image size.
FROM alpine
COPY --from=build /usr/local/bin/fallback-control-plane /usr/local/bin
COPY --from=build /usr/local/bin/test-control-plane /usr/local/bin

ENTRYPOINT ["fallback-control-plane"]
ENTRYPOINT ["test-control-plane"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ depends on `protos/grpc/testing/xdsconfig`, the build needs to be ran from
the root of `grpc/psm-interop` checkout.

```
docker build . -f docker/go-control-plane/Dockerfile
docker build . -f docker/test-control-plane/Dockerfile \
-t us-docker.pkg.dev/grpc-testing/psm-interop/test-control-plane:latest
```
Currently the server build is not automated so it has to be pushed manually:
```
docker push us-docker.pkg.dev/grpc-testing/psm-interop/test-control-plane:latest
```

## Local development

Run the following command from this repository to generate code from the .proto
files:
```
protoc -I=. --go_out=docker/go-control-plane \
protoc -I=. --go_out=docker/test-control-plane \
protos/grpc/testing/xdsconfig/*.proto \
--go-grpc_out=docker/go-control-plane/
--go-grpc_out=docker/test-control-plane/
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/grpc/psm-interop/docker/go-control-plane
module github.com/grpc/psm-interop/docker/test-control-plane

go 1.22

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"

xdsconfigpb "github.com/grpc/psm-interop/docker/go-control-plane/grpc/interop/grpc_testing/xdsconfig"

v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
xdsconfigpb "github.com/grpc/psm-interop/docker/test-control-plane/grpc/interop/grpc_testing/xdsconfig"

"github.com/envoyproxy/go-control-plane/pkg/cache/types"
"github.com/envoyproxy/go-control-plane/pkg/cache/v3"
Expand Down
4 changes: 2 additions & 2 deletions go.work
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
go 1.20
go 1.22

use ./docker/go-control-plane
use ./docker/test-control-plane
2 changes: 1 addition & 1 deletion tests/fallback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

_CONTROL_PLANE_IMAGE = flags.DEFINE_string(
"control_plane_image",
"us-docker.pkg.dev/eostroukhov-xds-interop/docker/control-plane",
"us-docker.pkg.dev/grpc-testing/psm-interop/test-control-plane:latest",
"Control plane (xDS config) server image",
)
_HOST_NAME = flags.DEFINE_string(
Expand Down

0 comments on commit 6c7830a

Please sign in to comment.