Skip to content

proxy: migrate the sibling Envoy workspace to bzlmod — envoy#42890 removed WORKSPACE and 6 of the 10 macros proxy/WORKSPACE loads; blocks the v1.40.0 bump (#695) #697

Closed

Description

@bpalermo

Summary

envoyproxy/envoy#42890 ("bazel: Switch to bzlmod", merged 2026-09-04, after our v1.39.0 pin) makes Envoy bzlmod-only. On Envoy main today:

  • WORKSPACE is gone (404), MODULE.bazel is 16 KB, .bazelrc flipped to --enable_bzlmod --noenable_workspace --@envoy//bazel:enable_bzlmod=True with --registry=https://raw.githubusercontent.com/envoyproxy/bazel-registry/<sha> (Envoy's private registry, .envoy-suffixed module versions; envoy_api is its own module 1.40.0-dev).
  • Six of the ten macro files proxy/WORKSPACE loads no longer exist: bazel/repositories.bzl, api_binding.bzl, api_repositories.bzl, repositories_extra.bzl, dependency_imports.bzl, dependency_imports_extra.bzl. bazel/extension_config/ (the envoy_build_config local_repository seam our proxy/bazel/extension_config/ mirrors) is gone too.
  • envoy_build_config is now produced by a module extension (bazel/extensions.bzl → envoy_build_config_ext → default_envoy_build_config(name = "envoy_build_config")), alongside envoy_repo_extension, envoy_toolchains_extension, envoy_module_graph_extension, wasm_cargo.
  • Envoy stays on Bazel 8.7.0 (same as proxy/.bazelversion), so this is not a Bazel-version problem — it is a WORKSPACE-removal problem. Bazel 9 (which the main aether repo already uses) removes WORKSPACE outright, so the migration is inevitable either way.
  • The canonical downstream, envoyproxy/envoy-filter-example, has not migrated (still WORKSPACE, last touched 2025-04). There is no template to copy.

Consequence

The Envoy v1.40.0 bump (#695) cannot be a pin change. proxy/ (a WORKSPACE-only sibling workspace: common --noenable_bzlmod --enable_workspace in envoy.bazelrc, envoy_repository() http_archive of the Envoy source, then ten @envoy//bazel:*.bzl WORKSPACE macros) must be migrated to bzlmod first. Until that lands, the proxy image is frozen at v1.39.0, and with it the aether_stats hot-restart tag workaround (envoy#45674, #695).

Migration shape (spike, then real PR)

  1. proxy/MODULE.bazel: module(name = "aether_proxy"); bazel_dep(name = "envoy", version = "1.40.0") with an archive_override (or git_override) to the release tarball — Envoy is not in the BCR; check whether envoyproxy/bazel-registry publishes an envoy module itself, else override. Mirror Envoy's --registry= pin in proxy/envoy.bazelrc (the .envoy-suffixed protobuf/rules_rust/boringssl versions only resolve there), flip the bzlmod flags exactly as 42890's .bazelrc diff does, and generate MODULE.bazel.lock.
  2. The extension list: replace local_repository(name = "envoy_build_config", path = "bazel/extension_config") with the bzlmod mechanism for overriding an extension-generated repo from the root module — override_repo(envoy_build_config_ext, envoy_build_config = "aether_envoy_build_config") (Bazel ≥ 7.2) pointing at a repo rule that emits our extensions_build_config.bzl (EXTENSIONS + //source/extensions/filters/http/aether_stats:config, CONTRIB_EXTENSION_PACKAGE_VISIBILITY). Verify with bazel mod show_repo that @envoy_build_config resolves to ours, not Envoy's default.
  3. use_extension("@envoy//bazel:extensions.bzl", ...) + use_repo for envoy_repo, clang_platform, envoy_mod_graph as Envoy's own MODULE.bazel does (lines ~415–425), and the @envoy_toolshed sysroot/sanitizer extensions if the RBE/arm64 build needs them.
  4. Re-check what proxy/bazel/repositories.bzl still needs to provide (container-structure-test, rules_oci become bazel_deps), proxy/bazel/get_workspace_status, and the --build-id=sha1 linkopt (fix(build): derive the GNU build-ID from binary content so every released binary is unique (#653) #654) survive.
  5. Gate: the existing --mode validate test, //integration:symtab_test (test(proxy): guard the shipped Envoy's symbol table, correct the "stripped" docs #656), the aether_stats envoy_cc_tests, tag_extraction_test, and an arm64 image build via proxy-release — then proxy: bump Envoy to v1.40.0 to pick up envoy#45674 (hot-restart stat tags) and retire the aether_stats stats_tags regex workaround; envoy#45975 already in v1.39.0, leave envoy#45976 unset #695.

Do the spike against a pinned post-42890 main commit (e.g. the 42890 merge 69bc1cf…) so the bzlmod shape is proven before v1.40.0 ships (~mid-October); the bump then really is a pin change. Expect days, not hours: the .envoy registry pins, the envoy_build_config override, and RBE toolchain resolution are each a likely snag, and nothing downstream has done this yet.

Related: #695 (blocked on this), proposal 010 (custom proxy workspace — the sibling-workspace decision stands; source-build-in-root was rejected), proposal 011 (prefix_symbols static module), #656.

Activity

  1. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Companion PR: envoyproxy/envoy#47217 "bazel: Remove WORKSPACE" (merged 2026-09-04 22:12Z, 100 files) is the change that actually deletes the WORKSPACE-era surface — WORKSPACE, bazel/api_binding.bzl, bazel/api_repositories.bzl, bazel/dependency_imports.bzl, bazel/dependency_imports_extra.bzl, bazel/extension_configs.bzl, api/bazel/{repositories,repository_locations,external_deps,envoy_http_archive}.bzl, and every bazel/external/*.BUILD + patch that WORKSPACE-mode http_archives referenced. envoy#42890 flipped the switch; #47217 removed the floor. Both post-date the v1.39.0 pin and both ship in v1.40.0, so the migration described above is the only path — there is no WORKSPACE compatibility shim to lean on.

  2. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    There IS a downstream template now — envoyproxy/examples/filter-cc, published 2026-09-04

    The Envoy docs sandbox https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/filter-cc ("build a native C++ HTTP filter and statically link it into the Envoy binary using bzlmod") lives in github.com/envoyproxy/examples/filter-cc (the sandboxes moved out of the main repo; examples/ is a 404 on Envoy main). Added by examples#1394 on 2026-09-04 — the same day as envoy#42890/#47217 — and it is exactly the shape proxy/ is. This replaces the "no template, expect days" assessment above.

    What it settles

    1. Envoy is a registry module, no archive_override needed. MODULE.bazel:
      bazel_dep(name = "envoy",     version = "1.40.0-dev.20260903.6609c01.envoy")
      bazel_dep(name = "envoy_api", version = "1.40.0-dev.20260903.16b0d47.envoy")
      
      from --registry=https://raw.githubusercontent.com/envoyproxy/bazel-registry/<commit> (plus --registry=https://bcr.bazel.build/). The registry currently publishes one version, the rolling dev snapshot (modules/envoy/1.40.0-dev.20260904.13144fb.envoy at registry HEAD); presumably 1.40.0.envoy appears at release. Pin the registry commit AND the module version together.
    2. The extension list is a tiny local module + override_repo, exactly as guessed:
      build_config = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
      build_config(name = "filter_cc_envoy_build_config", path = "bazel/build_config")
      envoy_build_config_ext = use_extension("@envoy//bazel:extensions.bzl", "envoy_build_config_ext")
      override_repo(envoy_build_config_ext, envoy_build_config = "filter_cc_envoy_build_config")
      
      with bazel/build_config/{MODULE.bazel (module(name="envoy_build_config")), BUILD (exports_files), extensions_build_config.bzl}. Their extensions_build_config.bzl loads Envoy's default and filters it (EXTENSIONS = {… if "wasm" not in name}) and re-exports CONTRIB_EXTENSION_PACKAGE_VISIBILITY, EXTENSION_CONFIG_VISIBILITY, EXTENSION_PACKAGE_VISIBILITY, LEGACY_ALWAYSLINK — so our 654-line proxy/bazel/extension_config/extensions_build_config.bzl collapses to "load default, drop what we drop, add nothing" (the aether_stats filter is a dep of the binary, not an entry in that dict — same as filter-cc's :http_filter_config).
    3. .bazelrc to mirror: --enable_bzlmod --noenable_workspace --@envoy//bazel:enable_bzlmod=True, the two registries, --config=clang (libc++ + lld via toolchains_llvm 1.9.0.envoy as a dev_dependency, --host_platform=@clang_platform from envoy_toolchains_extension), the @quiche//:*_impl_lib overrides, --@proxy-wasm-cpp-host//bazel:engine=disabled, protobuf prefer_prebuilt_protoc, C++20. Bazel 8.7.0 (same as ours).
    4. BUILD shape is what we already have: envoy_cc_binary(name="envoy", repository="@envoy", deps=[":<filter_config>", "@envoy//source/exe:envoy_main_entry_lib"]), envoy_cc_test(... "@envoy//test/integration:http_integration_lib").

    Revised plan for proxy/

    • proxy/MODULE.bazel from the template; bazel_deps for rules_oci and container-structure-test (both on the BCR) replace proxy/bazel/repositories.bzl; delete WORKSPACE; bazel/extension_config/ → bazel/build_config/ in the template's shape.
    • proxy/envoy.bazelrc → the template's .bazelrc plus ours: keep --linkopt=-Wl,--build-id=sha1 (fix(build): derive the GNU build-ID from binary content so every released binary is unique (#653) #654), --workspace_status_command=bash bazel/get_workspace_status, and whatever RBE/arm64 platform config we carry (check --platforms for arm64 — the template only shows @clang_platform for the host).
    • Keep //integration:symtab_test (test(proxy): guard the shipped Envoy's symbol table, correct the "stripped" docs #656), the --mode validate test, and the aether_stats envoy_cc_tests + tag_extraction_test as the gate; proxy-release builds the image.
    • Effort: hours to a day, not days, with arm64/RBE toolchain resolution the remaining unknown.

    One decision this creates

    The registry's only version is a main dev snapshot post-42890/#47217, which also contains envoy#45674 (hot-restart stat tags) and #45976. So the migration spike would, if deployed, put an Envoy main snapshot in production — with the stat-tag fix ~6 weeks before v1.40.0. Whether that is acceptable (vs. migrating now but keeping v1.39.0 in production until 1.40.0.envoy exists in the registry) is a policy call; noting it on #695.

  3. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Decision (2026-09-05, maintainer): migrate proxy/ to bzlmod now, following envoyproxy/examples/filter-cc, and land on Envoy's rolling main dev snapshot from the envoyproxy bazel-registry (1.40.0-dev.<date>.<sha>.envoy) in production until the next stable release publishes a 1.40.0.envoy module — at which point the pin moves to that. Consequences accepted: the proxy runs an Envoy main snapshot for ~6 weeks; envoy#45674 (hot-restart stat tags) and #45976 arrive with it, so #695's regex-workaround removal becomes a follow-up as soon as a proxy roll on talos confirms tag survival. Plan in progress; one PR in proxy/ with the full gate (#656 symtab test, --mode validate, aether_stats tests, container-structure-test, both arches) before proxy-release.

  4. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Deployed and validated on talos-main — helm rev197, chart 0.92.2, 2026-09-05 19:06Z

    First bzlmod-built proxy (sha256:9e401334…, Envoy 1.40.0-dev.20260904.13144fb.envoy, LLVM 22, wasm/dynamic-modules/hickory trimmed) is in production on all five nodes.

    Cross-version hot restart v1.39.0 → 1.40-dev, live-predecessor handoff on every node: liveness 0 / 6,294; authoritative mesh-DNS 0 / 6,297; forwarded path 2 timeouts / 6,297, both inside w02's handoff (26.79s, the slowest; others 18.1–20.4s). No alert fired; MeshDNSWatcherInactive/EnvoyControlPlaneDisconnected reached pending only (one-scrape watch_active dip during the chart-wide roll). 0 restarts, taints [].

    Build provenance: digest confirmed on all pods; extension trim confirmed from the running config (wasm 0, dynamic_modules 0, hickory 0; controls lua 2, aether_stats 1); envoy_server_version changed 0x4212e1 → 0x51ba12 — that stat carries the aether build commit from bazel/get_workspace_status (previous value = 4212e13, the last proxy-release commit; new value = 51ba129, the #705 merge), so it is the intended build. Symbols: the 19:17Z debuginfo sync uploaded the new Envoy build ID 80542d6b… (126 MB, executable-full) plus the five Go binaries; Pyroscope needs its warm-up before the next profile.

    Data path on the new Envoy/BoringSSL: ssl_fail_verify_san absent (control-tested), foreign identity WARN 0, aether_requests_total 24/24 series fully labelled (the stats_tags regexes are still in place — retirement is the next PR), Envoy heap flat-to-lower per node vs the v1.39.0 generation.

    Not yet proven on this build: #638 under churn (only ~10 idle minutes so far; it has only ever fired under TRIPLE-style rolls) and sustained load. A soak on this build is the next real test.

    Follow-ups tracked: #695 step 4 (regex retirement, PR in flight), re-pin to 1.40.0.envoy when published, root @envoy_binary_linux_* bump for --mode validate, #703 (Actions PR permission) so bump-chart stops needing a hand-opened PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions