Skip to content

Commit

Permalink
mobile: starting the repo merge with the assertion filter (#23761)
Browse files Browse the repository at this point in the history
This PR sets up the directory structure, visibility rules, codeowners, adds E-M C++ tests to Envoy CI, and moves one extension over as a proof of concept.

Risk Level: low
Testing: ported test to Envoy CI. did not turn up platform CI yet
Release Notes: inline
Part of #23758

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed Nov 2, 2022
1 parent 158a28b commit f5b42d7
Show file tree
Hide file tree
Showing 17 changed files with 1,029 additions and 10 deletions.
7 changes: 7 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ package_group(
"//examples/...",
],
)

package_group(
name = "mobile_library",
packages = [
"//mobile/...",
],
)
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ extensions/filters/http/oauth2 @derekargueta @snowp
/*/extensions/path/uri_template_lib @alyssawilk @yanjunxiang-google
/*/extensions/path/uri_template_lib/proto @alyssawilk @yanjunxiang-google

# mobile
/mobile/ @jpsim @Augustyniak @RyanTheOptimist @alyssawilk @abeyad

# Contrib
/contrib/exe/ @mattklein123 @lizan
/contrib/client_ssl_auth/ @UNOWNED @UNOWNED
Expand Down
19 changes: 13 additions & 6 deletions OWNERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ routing PRs, questions, etc. to the right place.
* xDS APIs, configuration and control plane.
* Alyssa Wilk ([alyssawilk](https://github.com/alyssawilk)) (alyssar@google.com)
* HTTP, flow control, cluster manager, load balancing, and core networking (listeners,
connections, etc.).
connections, etc.), Envoy Mobile.
* Stephan Zuercher ([zuercher](https://github.com/zuercher)) (zuercher@gmail.com)
* Load balancing, upstream clusters and cluster manager, logging, complex HTTP routing
(metadata, etc.), and macOS build.
Expand All @@ -29,7 +29,7 @@ routing PRs, questions, etc. to the right place.
* Ryan Northey ([phlax](https://github.com/phlax)) (ryan@synca.io)
* Docs, tooling, CI, containers and sandbox examples
* Ryan Hamilton ([RyanTheOptimist](https://github.com/ryantheoptimist)) (rch@google.com)
* HTTP/3, upstream connection management.
* HTTP/3, upstream connection management, Envoy Mobile.

# Maintainers

Expand All @@ -50,6 +50,17 @@ routing PRs, questions, etc. to the right place.
* Kuat Yessenov ([kyessenov](https://github.com/kyessenov)) (kuat@google.com)
* Listeners, RBAC, CEL, matching, Istio.

# Envoy mobile maintainers

The following Envoy maintainers have final say over any changes only affecting /mobile

* JP Simard ([jpsim](https://github.com/jpsim)) (jp@lyft.com)
* iOS (swift/objective-c) platform bindings.
* Rafal Augustyniak ([Augustyniak](https://github.com/Augustyniak)) (raugustyniak@lyft.com)
* iOS (swift/objective-c) platform bindings.
* Ali Beyad ([abeyad](https://github.com/abeyad)) (abeyad@google.com)
* xDS, C++ integration tests.

# Senior extension maintainers

The following extension maintainers have final say over the extensions mentioned below. Once they
Expand All @@ -60,10 +71,6 @@ without further review.
* Wasm
* Raúl Gutiérrez Segalés ([rgs1](https://github.com/rgs1)) (rgs@pinterest.com)
* Thrift
* Ryan Hamilton ([RyanTheOptimist](https://github.com/ryantheoptimist)) (rch@google.com)
* HTTP/3
* Baiping Wang ([wbpcode](https://github.com/wbpcode)) (wbphub@live.com)
* Dubbo

# Envoy security team

Expand Down
3 changes: 3 additions & 0 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def envoy_extension_package(enabled_default = True, default_visibility = EXTENSI
flag_values = {":enabled": "True"},
)

def envoy_mobile_package():
envoy_extension_package()

def envoy_contrib_package():
envoy_extension_package(default_visibility = CONTRIB_EXTENSION_PACKAGE_VISIBILITY)

Expand Down
3 changes: 3 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@ new_features:
- area: udp_proxy
change: |
added support for :ref:`proxy_access_log <envoy_v3_api_field_extensions.filters.udp.udp_proxy.v3.UdpProxyConfig.proxy_access_log>`.
- area: mobile
change: |
started merging the Envoy mobile library into the main Envoy repo.
deprecated:
2 changes: 1 addition & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ else
elif [[ "${CI_TARGET}" == "bazel.msan" ]]; then
COVERAGE_TEST_TARGETS=("${COVERAGE_TEST_TARGETS[@]}" "-//test/extensions/...")
fi
TEST_TARGETS=("${COVERAGE_TEST_TARGETS[@]}" "@com_github_google_quiche//:ci_tests")
TEST_TARGETS=("${COVERAGE_TEST_TARGETS[@]}" "@com_github_google_quiche//:ci_tests" "//mobile/test/...")
fi

if [[ "$CI_TARGET" == "bazel.release" ]]; then
Expand Down
7 changes: 6 additions & 1 deletion ci/run_clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ function exclude_wasm_examples() {
grep -v examples/wasm
}

# Exclude envoy mobile.
function exclude_envoy_mobile() {
grep -v mobile/library | grep -v mobile/test
}

function filter_excludes() {
exclude_check_format_testdata | exclude_win32_impl | exclude_macos_impl | exclude_third_party | exclude_wasm_emscripten | exclude_wasm_sdk | exclude_wasm_host | exclude_wasm_test_data | exclude_wasm_examples
exclude_envoy_mobile | exclude_check_format_testdata | exclude_win32_impl | exclude_macos_impl | exclude_third_party | exclude_wasm_emscripten | exclude_wasm_sdk | exclude_wasm_host | exclude_wasm_test_data | exclude_wasm_examples
}

function run_clang_tidy() {
Expand Down
44 changes: 44 additions & 0 deletions mobile/library/common/extensions/filters/http/assertion/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_library",
"envoy_mobile_package",
"envoy_proto_library",
)

licenses(["notice"]) # Apache 2

envoy_mobile_package()

envoy_proto_library(
name = "filter",
srcs = ["filter.proto"],
deps = [
"@envoy_api//envoy/config/common/matcher/v3:pkg",
],
)

envoy_cc_library(
name = "assertion_filter_lib",
srcs = ["filter.cc"],
hdrs = ["filter.h"],
repository = "@envoy",
deps = [
"filter_cc_proto",
"//envoy/http:codes_interface",
"//envoy/http:filter_interface",
"//source/common/http:header_map_lib",
"//source/extensions/common/matcher:matcher_lib",
"//source/extensions/filters/http/common:pass_through_filter_lib",
],
)

envoy_cc_library(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
repository = "@envoy",
deps = [
":assertion_filter_lib",
"//source/extensions/filters/http/common:factory_base_lib",
],
)
29 changes: 29 additions & 0 deletions mobile/library/common/extensions/filters/http/assertion/config.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "mobile/library/common/extensions/filters/http/assertion/config.h"

#include "mobile/library/common/extensions/filters/http/assertion/filter.h"

namespace Envoy {
namespace Extensions {
namespace HttpFilters {
namespace Assertion {

Http::FilterFactoryCb AssertionFilterFactory::createFilterFactoryFromProtoTyped(
const envoymobile::extensions::filters::http::assertion::Assertion& proto_config,
const std::string&, Server::Configuration::FactoryContext&) {

AssertionFilterConfigSharedPtr filter_config =
std::make_shared<AssertionFilterConfig>(proto_config);
return [filter_config](Http::FilterChainFactoryCallbacks& callbacks) -> void {
callbacks.addStreamFilter(std::make_shared<AssertionFilter>(filter_config));
};
}

/**
* Static registration for the Assertion filter. @see NamedHttpFilterConfigFactory.
*/
REGISTER_FACTORY(AssertionFilterFactory, Server::Configuration::NamedHttpFilterConfigFactory);

} // namespace Assertion
} // namespace HttpFilters
} // namespace Extensions
} // namespace Envoy
34 changes: 34 additions & 0 deletions mobile/library/common/extensions/filters/http/assertion/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <string>

#include "source/extensions/filters/http/common/factory_base.h"

#include "mobile/library/common/extensions/filters/http/assertion/filter.pb.h"
#include "mobile/library/common/extensions/filters/http/assertion/filter.pb.validate.h"

namespace Envoy {
namespace Extensions {
namespace HttpFilters {
namespace Assertion {

/**
* Config registration for the assertion filter. @see NamedHttpFilterConfigFactory.
*/
class AssertionFilterFactory
: public Common::FactoryBase<envoymobile::extensions::filters::http::assertion::Assertion> {
public:
AssertionFilterFactory() : FactoryBase("assertion") {}

private:
::Envoy::Http::FilterFactoryCb createFilterFactoryFromProtoTyped(
const envoymobile::extensions::filters::http::assertion::Assertion& config,
const std::string& stats_prefix, Server::Configuration::FactoryContext& context) override;
};

DECLARE_FACTORY(AssertionFilterFactory);

} // namespace Assertion
} // namespace HttpFilters
} // namespace Extensions
} // namespace Envoy
Loading

0 comments on commit f5b42d7

Please sign in to comment.