forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: manifest based edge default documentation.
This PR replaces envoyproxy#11058, taking a slightly different approach. We utilize field options to annotate fields that should be set for untrusted environments with [configure_for_untrusted_downstream, configure_for_untrusted_downstream]. Defaults are provided out-of-band, in a manifest files in docs/edge_defaults_manifest.yaml. Protodoc glues the manifest and options together when generating field documentation, providing an additional notice for sensitive fields. This PR depends on envoyproxy#11108 first merging to provide the pip3 build infrastructure. Risk level: Low (docs only). Testing: Inspection of generated docs. Signed-off-by: Harvey Tuch <htuch@google.com>
- Loading branch information
Showing
27 changed files
with
219 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
licenses(["notice"]) # Apache 2 | ||
|
||
exports_files(["edge_defaults_manifest.yaml"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
envoy.config.bootstrap.v3.Bootstrap.overload_manager: | ||
refresh_interval: 0.25s | ||
resource_monitors: | ||
- name: "envoy.resource_monitors.fixed_heap" | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.config.resource_monitor.fixed_heap.v2alpha.FixedHeapConfig | ||
# TODO: Tune for your system. | ||
max_heap_size_bytes: 2147483648 # 2 GiB | ||
actions: | ||
- name: "envoy.overload_actions.shrink_heap" | ||
triggers: | ||
- name: "envoy.resource_monitors.fixed_heap" | ||
threshold: | ||
value: 0.95 | ||
- name: "envoy.overload_actions.stop_accepting_requests" | ||
triggers: | ||
- name: "envoy.resource_monitors.fixed_heap" | ||
threshold: | ||
value: 0.98 | ||
|
||
envoy.config.listener.v3.Listener.per_connection_buffer_limit_bytes: 32768 # 32 KiB |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 5 additions & 1 deletion
6
generated_api_shadow/envoy/config/bootstrap/v3/bootstrap.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 5 additions & 1 deletion
6
generated_api_shadow/envoy/config/bootstrap/v4alpha/bootstrap.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 3 additions & 1 deletion
4
generated_api_shadow/envoy/config/listener/v4alpha/listener.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
licenses(["notice"]) # Apache 2 | ||
|
||
load("@config_validation//:requirements.bzl", "requirement") | ||
load("@config_validation_pip3//:requirements.bzl", "requirement") | ||
|
||
py_binary( | ||
name = "validate_yaml_fragment", | ||
srcs = ["validate_yaml_fragment.py"], | ||
name = "validate_fragment", | ||
srcs = ["validate_fragment.py"], | ||
data = ["//tools/type_whisperer:all_protos_with_ext_pb_text.pb_text"], | ||
visibility = ["//visibility:public"], | ||
deps = [requirement("PyYAML")], | ||
deps = [ | ||
requirement("PyYAML"), | ||
"@bazel_tools//tools/python/runfiles", | ||
"@com_google_protobuf//:protobuf_python", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Validate a YAML fragment against an Envoy API proto3 type. | ||
# | ||
# Example usage: | ||
# | ||
# bazel run //tools/config_validation:validate_fragment -- \ | ||
# envoy.config.bootstrap.v3.Bootstrap $PWD/configs/google_com_proxy.v2.yaml | ||
|
||
import json | ||
import pathlib | ||
import sys | ||
|
||
import yaml | ||
|
||
from google.protobuf import descriptor_pb2 | ||
from google.protobuf import descriptor_pool | ||
from google.protobuf import json_format | ||
from google.protobuf import message_factory | ||
from google.protobuf import text_format | ||
|
||
from bazel_tools.tools.python.runfiles import runfiles | ||
|
||
|
||
def ValidateFragment(type_name, fragment): | ||
"""Validate a dictionary representing a JSON/YAML fragment against an Envoy API proto3 type. | ||
Throws Protobuf errors on parsing exceptions, successful validations produce | ||
no result. | ||
Args: | ||
type_name: a string providing the type name, e.g. | ||
envoy.config.bootstrap.v3.Bootstrap. | ||
fragment: a dictionary representing the parsed JSON/YAML configuration | ||
fragment. | ||
""" | ||
json_fragment = json.dumps(fragment) | ||
|
||
r = runfiles.Create() | ||
all_protos_pb_text_path = r.Rlocation( | ||
'envoy/tools/type_whisperer/all_protos_with_ext_pb_text.pb_text') | ||
file_desc_set = descriptor_pb2.FileDescriptorSet() | ||
text_format.Parse(pathlib.Path(all_protos_pb_text_path).read_text(), | ||
file_desc_set, | ||
allow_unknown_extension=True) | ||
|
||
pool = descriptor_pool.DescriptorPool() | ||
for f in file_desc_set.file: | ||
pool.Add(f) | ||
desc = pool.FindMessageTypeByName(type_name) | ||
msg = message_factory.MessageFactory(pool=pool).GetPrototype(desc)() | ||
json_format.Parse(json_fragment, msg, descriptor_pool=pool) | ||
|
||
|
||
if __name__ == '__main__': | ||
type_name, yaml_path = sys.argv[1:] | ||
ValidateFragment(type_name, yaml.load(pathlib.Path(yaml_path).read_text(), | ||
Loader=yaml.FullLoader)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.