From d42e12efffae8de88f19bd4f355249f1bf3e70b4 Mon Sep 17 00:00:00 2001 From: Fernando Cainelli Date: Sun, 23 Jun 2024 20:17:46 -0300 Subject: [PATCH 1/2] add: router check tool Signed-off-by: Fernando Cainelli --- .github/.workflows/build.yml | 37 ++++++++++++++++++++++++++++++++++++ BUILD | 16 ++++++++++++++++ WORKSPACE | 2 ++ external/router_check.patch | 14 ++++++++++++++ router-check-tool/Dockerfile | 15 +++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 .github/.workflows/build.yml create mode 100644 external/router_check.patch create mode 100644 router-check-tool/Dockerfile diff --git a/.github/.workflows/build.yml b/.github/.workflows/build.yml new file mode 100644 index 00000000000..7a942fe7456 --- /dev/null +++ b/.github/.workflows/build.yml @@ -0,0 +1,37 @@ +name: build +on: + push: {} # TODO: fix before merge + pull_request: {} +concurrency: ${{ github.ref }} +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: [gyg-gha-runner-16x64] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} # TODO: use a GYG registry + password: ${{ secrets.DOCKERHUB_TOKEN }} # TODO: use a GYG registry + + - name: Build and push + uses: docker/build-push-action@v6 + with: + pull: true + file: tools/router-check-tool/Dockerfile + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ startsWith(github.ref_name, 'release-') && github.event_name == 'push'}} + tags: cainelli/router_check_tool:${{ github.ref_name }} diff --git a/BUILD b/BUILD index afec159fdba..7dea78a96a7 100644 --- a/BUILD +++ b/BUILD @@ -1,6 +1,7 @@ load( "@envoy//bazel:envoy_build_system.bzl", "envoy_cc_binary", + "envoy_cc_test_binary", ) # Copyright 2016 Istio Authors. All Rights Reserved. @@ -54,3 +55,18 @@ pkg_tar( package_dir = "/usr/local/bin/", tags = ["manual"], ) + +envoy_cc_test_binary( + name = "router_check_tool", + repository = "@envoy", + srcs = [ + "@envoy//test/tools/router_check:router_check.cc", + ], + deps = ISTIO_EXTENSIONS + [ + "@envoy//test/tools/router_check:router_check_main_lib", + "@envoy//source/extensions/retry/host/previous_hosts:config", + "@envoy//source/extensions/retry/host/omit_canary_hosts:config", + "@envoy//source/extensions/retry/host/omit_host_metadata:config", + "@envoy//source/extensions/filters/http/fault:config", + ], +) diff --git a/WORKSPACE b/WORKSPACE index 130a8c12ef5..c98b1772667 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -38,6 +38,8 @@ http_archive( sha256 = ENVOY_SHA256, strip_prefix = ENVOY_REPO + "-" + ENVOY_SHA, url = "https://github.com/" + ENVOY_ORG + "/" + ENVOY_REPO + "/archive/" + ENVOY_SHA + ".tar.gz", + patches = ["router_check.patch"], + patch_args = ["-p1"], ) load("@envoy//bazel:api_binding.bzl", "envoy_api_binding") diff --git a/external/router_check.patch b/external/router_check.patch new file mode 100644 index 00000000000..5fa9f89c5f9 --- /dev/null +++ b/external/router_check.patch @@ -0,0 +1,14 @@ +diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc +index 410caf6cc0..84c9670d77 100644 +--- a/test/tools/router_check/router.cc ++++ b/test/tools/router_check/router.cc +@@ -137,6 +137,9 @@ RouterCheckTool RouterCheckTool::create(const std::string& router_config_file, + assignRuntimeFraction(route_config); + auto factory_context = + std::make_unique>(); ++ ++ Runtime::maybeSetDeprecatedInts("re2.max_program_size.error_level", 32768); // istio-proxy default ++ + auto config = *Router::ConfigImpl::create(route_config, *factory_context, + ProtobufMessage::getNullValidationVisitor(), false); + if (!disable_deprecation_check) { diff --git a/router-check-tool/Dockerfile b/router-check-tool/Dockerfile new file mode 100644 index 00000000000..39c519ff0cc --- /dev/null +++ b/router-check-tool/Dockerfile @@ -0,0 +1,15 @@ +FROM gcr.io/istio-testing/build-tools-proxy:master-latest as builder + +WORKDIR /work/ + +COPY . /work/ + +RUN bazel build //:router_check_tool + +FROM ubuntu + +COPY --from=builder /work/bazel-bin/router_check_tool /usr/local/bin/ + +USER nobody:nogroup + +ENTRYPOINT [ "/usr/local/bin/router_check_tool"] From 94516c9ea6505942790f2c0879ed00770700a820 Mon Sep 17 00:00:00 2001 From: Fernando Cainelli Date: Sun, 23 Jun 2024 20:28:09 -0300 Subject: [PATCH 2/2] remove wrong file Signed-off-by: Fernando Cainelli --- .github/.workflows/build.yml | 37 ------------------------------------ 1 file changed, 37 deletions(-) delete mode 100644 .github/.workflows/build.yml diff --git a/.github/.workflows/build.yml b/.github/.workflows/build.yml deleted file mode 100644 index 7a942fe7456..00000000000 --- a/.github/.workflows/build.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: build -on: - push: {} # TODO: fix before merge - pull_request: {} -concurrency: ${{ github.ref }} -permissions: - contents: read - id-token: write - -jobs: - build: - runs-on: [gyg-gha-runner-16x64] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} # TODO: use a GYG registry - password: ${{ secrets.DOCKERHUB_TOKEN }} # TODO: use a GYG registry - - - name: Build and push - uses: docker/build-push-action@v6 - with: - pull: true - file: tools/router-check-tool/Dockerfile - context: . - platforms: linux/amd64,linux/arm64 - push: ${{ startsWith(github.ref_name, 'release-') && github.event_name == 'push'}} - tags: cainelli/router_check_tool:${{ github.ref_name }}