-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add a /config endpoint #396
Conversation
That returns a JSON of the current config the proxy is running with This includes a breaking change, as the FilterFactory to now needs to return the config in addition to the filter it created. Resolves #394
example output {
"clusters": [
{
"name": "default-quilkin-cluster",
"endpoints": [
{
"address": "127.0.0.1:4321",
"metadata": {
"quilkin.dev": {
"tokens": [
"AA=="
]
}
}
}
]
}
],
"filterchain": {
"filters": [
{
"name": "quilkin.extensions.filters.capture_bytes.v1alpha1.CaptureBytes",
"config": {
"metadataKey": "quilkin.dev/captured_bytes",
"remove": true,
"size": 1,
"strategy": "SUFFIX"
}
},
{
"name": "quilkin.extensions.filters.token_router.v1alpha1.TokenRouter",
"config": {
"metadataKey": "quilkin.dev/captured_bytes"
}
}
]
}
} |
Also this has a bunch of conflicts with #395 in the custom filter doc at least, I'll resolve them after that's merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, mostly just minor naming concerns, some code changes, and some potential improvements that can come later.
Dynamic: prost::Message + Default, | ||
Static: serde::Serialize | ||
+ for<'de> serde::Deserialize<'de> | ||
+ TryFrom<Dynamic, Error = ConvertProtoConfigError>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't have to be in this PR, but I would like to combine these two type parameters into single trait, so that we can enforce it as part of the type system. Then you also only need to provide a single parameter.
trait FilterConfig {
type Dynamic: prost::Message + Default;
type Static: serde::Serialize
+ for<'de> serde::Deserialize<'de>
+ TryFrom<Self::Dynamic, Error = ConvertProtoConfigError>;
}
// src/filters/debug.rs
impl FilterConfig for Config {
type Static = Self;
type Dynamic = ProtoDebug;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty, I like it! 👍🏻
Since #395 is about ready to be merged (I need to make a small change, and it's good to go) -- since this is a particularly useful feature, should we wait until it's merged and bundle it into the 0.2.0 release? (I'm leaning towards "yes", personally) |
yes please 🙏 also so we can avoid using a custom branch in our deployment internally until the next release |
Added to the milestone! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
If @XAMPPRocky is also happy, I'm very happy to have this merged 🥳
Dynamic: prost::Message + Default, | ||
Static: serde::Serialize | ||
+ for<'de> serde::Deserialize<'de> | ||
+ TryFrom<Dynamic, Error = ConvertProtoConfigError>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty, I like it! 👍🏻
@@ -206,14 +207,70 @@ First let's create the config for our static configuration: | |||
{{#include ../../../examples/quilkin-filter-example/src/main.rs:filter}} | |||
``` | |||
|
|||
###### 4. Finally, update `GreetFilterFactory` to extract the greeting from the passed in configuration and forward it onto the `Greet` Filter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this being back in - since it slowly introduces people to the config option, and then we can move into deserialize
, which is the more complex topic. 👍🏻
That returns a JSON of the current config the proxy is running with
This includes a breaking change, as the FilterFactory to now needs to return
the config in addition to the filter it created.
Resolves #394