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

Upstream envoyproxy/envoy-wasm. #12546

Merged
merged 2 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ build:libc++ --config=clang
build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
build:libc++ --action_env=LDFLAGS=-stdlib=libc++
build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a:-lm
build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a
build:libc++ --action_env=BAZEL_LINKOPTS=-lm:-pthread
build:libc++ --define force_libcpp=enabled

# Optimize build for binary size reduction.
Expand Down Expand Up @@ -191,6 +192,8 @@ build:remote --spawn_strategy=remote,sandboxed,local
build:remote --strategy=Javac=remote,sandboxed,local
build:remote --strategy=Closure=remote,sandboxed,local
build:remote --strategy=Genrule=remote,sandboxed,local
# rules_rust is not remote runnable (yet)
build:remote --strategy=Rustc=sandboxed,local
build:remote --remote_timeout=7200
build:remote --auth_enabled=true
build:remote --remote_download_toplevel
Expand Down
12 changes: 11 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,16 @@ extensions/filters/common/original_src @snowp @klarose
/*/extensions/filters/listener/http_inspector @yxue @PiotrSikora @lizan
# attribute context
/*/extensions/filters/common/expr @kyessenov @yangminzhu @lizan
# webassembly access logger extensions
/*/extensions/access_loggers/wasm @PiotrSikora @lizan
# webassembly bootstrap extensions
/*/extensions/bootstrap/wasm @PiotrSikora @lizan
# webassembly http extensions
/*/extensions/filters/http/wasm @PiotrSikora @lizan
# webassembly network extensions
/*/extensions/filters/network/wasm @PiotrSikora @lizan
# webassembly common extension
/*/extensions/common/wasm @jplevyak @PiotrSikora @lizan
/*/extensions/common/wasm @PiotrSikora @lizan
# common matcher
/*/extensions/common/matcher @mattklein123 @yangminzhu
# common crypto extension
Expand All @@ -107,6 +115,8 @@ extensions/filters/common/original_src @snowp @klarose
/*/extensions/stat_sinks/dog_statsd @taiki45 @jmarantz
/*/extensions/stat_sinks/hystrix @trabetti @jmarantz
/*/extensions/stat_sinks/metrics_service @ramaraochavali @jmarantz
# webassembly stat-sink extensions
/*/extensions/stat_sinks/wasm @PiotrSikora @lizan
/*/extensions/resource_monitors/injected_resource @eziskind @htuch
/*/extensions/resource_monitors/common @eziskind @htuch
/*/extensions/resource_monitors/fixed_heap @eziskind @htuch
Expand Down
1 change: 1 addition & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ proto_library(
"//envoy/extensions/network/socket_interface/v3:pkg",
"//envoy/extensions/retry/host/omit_host_metadata/v3:pkg",
"//envoy/extensions/retry/priority/previous_priorities/v3:pkg",
"//envoy/extensions/stat_sinks/wasm/v3:pkg",
"//envoy/extensions/transport_sockets/alts/v3:pkg",
"//envoy/extensions/transport_sockets/proxy_protocol/v3:pkg",
"//envoy/extensions/transport_sockets/quic/v3:pkg",
Expand Down
7 changes: 5 additions & 2 deletions api/envoy/extensions/access_loggers/wasm/v3/wasm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ option java_outer_classname = "WasmProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [[#not-implemented-hide:]
// [#protodoc-title: Wasm access log]
// [#extension: envoy.access_loggers.wasm]

// Custom configuration for an :ref:`AccessLog <envoy_api_msg_config.accesslog.v3.AccessLog>`
// that calls into a WASM VM.
// that calls into a WASM VM. Configures the built-in *envoy.access_loggers.wasm*
// AccessLog.
message WasmAccessLog {
envoy.extensions.wasm.v3.PluginConfig config = 1;
}
5 changes: 4 additions & 1 deletion api/envoy/extensions/filters/http/wasm/v3/wasm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ option java_outer_classname = "WasmProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [[#not-implemented-hide:]
// [#protodoc-title: Wasm]
// [#extension: envoy.filters.http.wasm]
// Wasm :ref:`configuration overview <config_http_filters_wasm>`.

message Wasm {
// General Plugin configuration.
envoy.extensions.wasm.v3.PluginConfig config = 1;
Expand Down
5 changes: 4 additions & 1 deletion api/envoy/extensions/filters/network/wasm/v3/wasm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ option java_outer_classname = "WasmProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [[#not-implemented-hide:]
// [#protodoc-title: Wasm]
// [#extension: envoy.filters.network.wasm]
// Wasm :ref:`configuration overview <config_network_filters_wasm>`.

message Wasm {
// General Plugin configuration.
envoy.extensions.wasm.v3.PluginConfig config = 1;
Expand Down
12 changes: 12 additions & 0 deletions api/envoy/extensions/stat_sinks/wasm/v3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/extensions/wasm/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
23 changes: 23 additions & 0 deletions api/envoy/extensions/stat_sinks/wasm/v3/wasm.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";

package envoy.extensions.stat_sinks.wasm.v3;

import "envoy/extensions/wasm/v3/wasm.proto";

import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.stat_sinks.wasm.v3";
option java_outer_classname = "WasmProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Wasm]
// Wasm :ref:`configuration overview <config_stat_sinks_wasm>`.
// [#extension: envoy.stat_sinks.wasm]

message Wasm {
// General Plugin configuration.
envoy.extensions.wasm.v3.PluginConfig config = 1;
}
10 changes: 4 additions & 6 deletions api/envoy/extensions/wasm/v3/wasm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Wasm]
// [#extension: envoy.bootstrap.wasm]

// [[#not-implemented-hide:]
// Configuration for a Wasm VM.
// [#next-free-field: 7]
message VmConfig {
Expand Down Expand Up @@ -51,7 +51,6 @@ message VmConfig {
bool nack_on_code_cache_miss = 6;
}

// [[#not-implemented-hide:]
// Base Configuration for Wasm Plugins e.g. filters and services.
// [#next-free-field: 6]
message PluginConfig {
Expand All @@ -66,9 +65,9 @@ message PluginConfig {
string root_id = 2;

// Configuration for finding or starting VM.
oneof vm_config {
VmConfig inline_vm_config = 3;
// In the future add referential VM configurations.
oneof vm {
VmConfig vm_config = 3;
// TODO: add referential VM configurations.
jplevyak marked this conversation as resolved.
Show resolved Hide resolved
}

// Filter/service configuration used to configure or reconfigure a plugin
Expand All @@ -86,7 +85,6 @@ message PluginConfig {
bool fail_open = 5;
}

// [[#not-implemented-hide:]
// WasmService is configured as a built-in *envoy.wasm_service* :ref:`WasmService
// <config_wasm_service>` This opaque configuration will be used to create a Wasm Service.
message WasmService {
Expand Down
1 change: 1 addition & 0 deletions api/versioning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ proto_library(
"//envoy/extensions/network/socket_interface/v3:pkg",
"//envoy/extensions/retry/host/omit_host_metadata/v3:pkg",
"//envoy/extensions/retry/priority/previous_priorities/v3:pkg",
"//envoy/extensions/stat_sinks/wasm/v3:pkg",
"//envoy/extensions/transport_sockets/alts/v3:pkg",
"//envoy/extensions/transport_sockets/proxy_protocol/v3:pkg",
"//envoy/extensions/transport_sockets/quic/v3:pkg",
Expand Down
21 changes: 21 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,27 @@ config_setting(
values = {"define": "quiche=enabled"},
)

# TODO: consider converting WAVM VM support to an extension (https://github.com/envoyproxy/envoy/issues/12574)
config_setting(
jplevyak marked this conversation as resolved.
Show resolved Hide resolved
name = "wasm_all",
values = {"define": "wasm=enabled"},
)

config_setting(
name = "wasm_wavm",
values = {"define": "wasm=wavm"},
)

config_setting(
name = "wasm_v8",
values = {"define": "wasm=v8"},
)

config_setting(
name = "wasm_none",
values = {"define": "wasm=disabled"},
)

# Alias pointing to the selected version of BoringSSL:
# - BoringSSL FIPS from @boringssl_fips//:ssl,
# - non-FIPS BoringSSL from @boringssl//:ssl.
Expand Down
113 changes: 113 additions & 0 deletions bazel/crates.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
"""
cargo-raze crate workspace functions

DO NOT EDIT! Replaced on runs of cargo-raze
"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

def _new_http_archive(name, **kwargs):
if not native.existing_rule(name):
http_archive(name = name, **kwargs)

def _new_git_repository(name, **kwargs):
if not native.existing_rule(name):
new_git_repository(name = name, **kwargs)

def raze_fetch_remote_crates():
_new_http_archive(
name = "raze__ahash__0_3_8",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ahash/ahash-0.3.8.crate",
type = "tar.gz",
strip_prefix = "ahash-0.3.8",
build_file = Label("//bazel/external/cargo/remote:ahash-0.3.8.BUILD"),
)

_new_http_archive(
name = "raze__autocfg__1_0_0",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/autocfg/autocfg-1.0.0.crate",
type = "tar.gz",
strip_prefix = "autocfg-1.0.0",
build_file = Label("//bazel/external/cargo/remote:autocfg-1.0.0.BUILD"),
)

_new_http_archive(
name = "raze__cfg_if__0_1_10",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/cfg-if/cfg-if-0.1.10.crate",
type = "tar.gz",
strip_prefix = "cfg-if-0.1.10",
build_file = Label("//bazel/external/cargo/remote:cfg-if-0.1.10.BUILD"),
)

_new_http_archive(
name = "raze__hashbrown__0_7_2",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.7.2.crate",
type = "tar.gz",
strip_prefix = "hashbrown-0.7.2",
build_file = Label("//bazel/external/cargo/remote:hashbrown-0.7.2.BUILD"),
)

_new_http_archive(
name = "raze__libc__0_2_74",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.74.crate",
type = "tar.gz",
strip_prefix = "libc-0.2.74",
build_file = Label("//bazel/external/cargo/remote:libc-0.2.74.BUILD"),
)

_new_http_archive(
name = "raze__log__0_4_11",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/log/log-0.4.11.crate",
type = "tar.gz",
strip_prefix = "log-0.4.11",
build_file = Label("//bazel/external/cargo/remote:log-0.4.11.BUILD"),
)

_new_http_archive(
name = "raze__memory_units__0_4_0",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/memory_units/memory_units-0.4.0.crate",
type = "tar.gz",
strip_prefix = "memory_units-0.4.0",
build_file = Label("//bazel/external/cargo/remote:memory_units-0.4.0.BUILD"),
)

_new_http_archive(
name = "raze__proxy_wasm__0_1_2",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/proxy-wasm/proxy-wasm-0.1.2.crate",
type = "tar.gz",
strip_prefix = "proxy-wasm-0.1.2",
build_file = Label("//bazel/external/cargo/remote:proxy-wasm-0.1.2.BUILD"),
)

_new_http_archive(
name = "raze__wee_alloc__0_4_5",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/wee_alloc/wee_alloc-0.4.5.crate",
type = "tar.gz",
strip_prefix = "wee_alloc-0.4.5",
build_file = Label("//bazel/external/cargo/remote:wee_alloc-0.4.5.BUILD"),
)

_new_http_archive(
name = "raze__winapi__0_3_9",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.3.9.crate",
type = "tar.gz",
strip_prefix = "winapi-0.3.9",
build_file = Label("//bazel/external/cargo/remote:winapi-0.3.9.BUILD"),
)

_new_http_archive(
name = "raze__winapi_i686_pc_windows_gnu__0_4_0",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-i686-pc-windows-gnu/winapi-i686-pc-windows-gnu-0.4.0.crate",
type = "tar.gz",
strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0",
build_file = Label("//bazel/external/cargo/remote:winapi-i686-pc-windows-gnu-0.4.0.BUILD"),
)

_new_http_archive(
name = "raze__winapi_x86_64_pc_windows_gnu__0_4_0",
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-x86_64-pc-windows-gnu/winapi-x86_64-pc-windows-gnu-0.4.0.crate",
type = "tar.gz",
strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0",
build_file = Label("//bazel/external/cargo/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD"),
)
6 changes: 5 additions & 1 deletion bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ load("@bazel_toolchains//rules/exec_properties:exec_properties.bzl", "create_rbe
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
load("@upb//bazel:repository_defs.bzl", upb_bazel_version_repository = "bazel_version_repository")
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
load("@config_validation_pip3//:requirements.bzl", config_validation_pip_install = "pip_install")
load("@configs_pip3//:requirements.bzl", configs_pip_install = "pip_install")
load("@headersplit_pip3//:requirements.bzl", headersplit_pip_install = "pip_install")
Expand All @@ -23,8 +25,10 @@ def envoy_dependency_imports(go_version = GO_VERSION):
rbe_toolchains_config()
gazelle_dependencies()
apple_rules_dependencies()
rust_repositories()
bazel_version(name = "bazel_version")
upb_bazel_version_repository(name = "upb_bazel_version")
antlr_dependencies(471)
antlr_dependencies(472)

custom_exec_properties(
name = "envoy_large_machine_exec_property",
Expand Down
8 changes: 8 additions & 0 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ load(
_envoy_select_google_grpc = "envoy_select_google_grpc",
_envoy_select_hot_restart = "envoy_select_hot_restart",
_envoy_select_new_codecs_in_integration_tests = "envoy_select_new_codecs_in_integration_tests",
_envoy_select_wasm = "envoy_select_wasm",
_envoy_select_wasm_all_v8_wavm_none = "envoy_select_wasm_all_v8_wavm_none",
_envoy_select_wasm_v8 = "envoy_select_wasm_v8",
_envoy_select_wasm_wavm = "envoy_select_wasm_wavm",
)
load(
":envoy_test.bzl",
Expand Down Expand Up @@ -176,6 +180,10 @@ def envoy_google_grpc_external_deps():
envoy_select_boringssl = _envoy_select_boringssl
envoy_select_google_grpc = _envoy_select_google_grpc
envoy_select_hot_restart = _envoy_select_hot_restart
envoy_select_wasm = _envoy_select_wasm
envoy_select_wasm_all_v8_wavm_none = _envoy_select_wasm_all_v8_wavm_none
envoy_select_wasm_wavm = _envoy_select_wasm_wavm
envoy_select_wasm_v8 = _envoy_select_wasm_v8
envoy_select_new_codecs_in_integration_tests = _envoy_select_new_codecs_in_integration_tests

# Binary wrappers (from envoy_binary.bzl)
Expand Down
30 changes: 30 additions & 0 deletions bazel/envoy_select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,36 @@ def envoy_select_hot_restart(xs, repository = ""):
"//conditions:default": xs,
})

# Selects the given values depending on the WASM runtimes enabled in the current build.
def envoy_select_wasm(xs):
return select({
"@envoy//bazel:wasm_none": [],
"//conditions:default": xs,
})

def envoy_select_wasm_v8(xs):
return select({
"@envoy//bazel:wasm_wavm": [],
"@envoy//bazel:wasm_none": [],
"//conditions:default": xs,
})

def envoy_select_wasm_wavm(xs):
return select({
"@envoy//bazel:wasm_all": xs,
"@envoy//bazel:wasm_wavm": xs,
"//conditions:default": [],
})

def envoy_select_wasm_all_v8_wavm_none(xs1, xs2, xs3, xs4):
return select({
"@envoy//bazel:wasm_all": xs1,
"@envoy//bazel:wasm_v8": xs2,
"@envoy//bazel:wasm_wavm": xs3,
"@envoy//bazel:wasm_none": xs4,
"//conditions:default": xs2,
})

# Select the given values if use legacy codecs in test is on in the current build.
def envoy_select_new_codecs_in_integration_tests(xs, repository = ""):
return select({
Expand Down
Loading