Skip to content

Commit

Permalink
Generate proto files for XDS filter configs (#159)
Browse files Browse the repository at this point in the history
* Generate proto files for XDS filter configs

Also include debug filter proto config

Co-authored-by: Mark Mandel <markmandel@google.com>
  • Loading branch information
iffyio and markmandel authored Dec 15, 2020
1 parent 03350f8 commit 3653b1e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
// we need for XDS GRPC communication.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let proto_files = vec![
"proto/data-plane-api/envoy/config/accesslog/v3/accesslog.proto",
"proto/data-plane-api/envoy/config/cluster/v3/cluster.proto",
"proto/data-plane-api/envoy/config/listener/v3/listener.proto",
"proto/data-plane-api/envoy/config/route/v3/route.proto",
"proto/data-plane-api/envoy/service/cluster/v3/cds.proto",
"proto/data-plane-api/envoy/service/discovery/v3/ads.proto",
"proto/data-plane-api/envoy/service/discovery/v3/discovery.proto",
"proto/data-plane-api/envoy/type/metadata/v3/metadata.proto",
"proto/data-plane-api/envoy/type/tracing/v3/custom_tag.proto",
"proto/udpa/udpa/core/v1/resource_name.proto",
"proto/quilkin/extensions/filters/debug/v1alpha1/debug.proto",
]
.iter()
.map(|name| std::env::current_dir().unwrap().join(name))
Expand All @@ -33,6 +39,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/udpa",
"proto/googleapis",
"proto/protoc-gen-validate",
"proto/quilkin",
]
.iter()
.map(|i| std::env::current_dir().unwrap().join(i))
Expand Down
10 changes: 10 additions & 0 deletions proto/quilkin/extensions/filters/debug/v1alpha1/debug.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package quilkin.extensions.filters.debug.v1alpha1;

import "google/protobuf/wrappers.proto";

message Debug {
google.protobuf.StringValue id = 1;
}

15 changes: 15 additions & 0 deletions src/extensions/filters/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ use crate::extensions::filter_registry::{
};
use crate::extensions::Filter;

/// Protobuf config for this filter.
mod quilkin {
pub(crate) mod extensions {
pub(crate) mod filters {
pub(crate) mod debug {
pub(crate) mod v1alpha1 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("quilkin.extensions.filters.debug.v1alpha1");
}
}
}
}
}

/// Debug logs all incoming and outgoing packets
///
/// # Configuration
Expand Down
35 changes: 35 additions & 0 deletions src/xds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,34 @@ mod envoy {
tonic::include_proto!("envoy.r#type.matcher.v3");
}
}
pub mod metadata {
pub mod v3 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("envoy.r#type.metadata.v3");
}
}
pub mod tracing {
pub mod v3 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("envoy.r#type.tracing.v3");
}
}
pub mod v3 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("envoy.r#type.v3");
}
}
pub mod config {
pub mod accesslog {
pub mod v3 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("envoy.config.accesslog.v3");
}
}
pub mod cluster {
pub mod v3 {
#![cfg(not(doctest))]
Expand All @@ -62,6 +83,20 @@ mod envoy {
tonic::include_proto!("envoy.config.endpoint.v3");
}
}
pub mod listener {
pub mod v3 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("envoy.config.listener.v3");
}
}
pub mod route {
pub mod v3 {
#![cfg(not(doctest))]
#![doc(hidden)]
tonic::include_proto!("envoy.config.route.v3");
}
}
}
pub mod service {
pub mod discovery {
Expand Down

0 comments on commit 3653b1e

Please sign in to comment.