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

Add a /config endpoint #396

Merged
merged 6 commits into from
Sep 20, 2021
Merged

Add a /config endpoint #396

merged 6 commits into from
Sep 20, 2021

Conversation

iffyio
Copy link
Collaborator

@iffyio iffyio commented Sep 14, 2021

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

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
@iffyio
Copy link
Collaborator Author

iffyio commented Sep 14, 2021

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"
        }
      }
    ]
  }
}

@iffyio
Copy link
Collaborator Author

iffyio commented Sep 14, 2021

Also this has a bunch of conflicts with #395 in the custom filter doc at least, I'll resolve them after that's merged

Copy link
Collaborator

@XAMPPRocky XAMPPRocky left a 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.

docs/src/admin.md Outdated Show resolved Hide resolved
src/filters/factory.rs Outdated Show resolved Hide resolved
src/config/config_type.rs Outdated Show resolved Hide resolved
src/config/config_type.rs Outdated Show resolved Hide resolved
src/filters/factory.rs Outdated Show resolved Hide resolved
src/filters/chain.rs Outdated Show resolved Hide resolved
Comment on lines +53 to +56
Dynamic: prost::Message + Default,
Static: serde::Serialize
+ for<'de> serde::Deserialize<'de>
+ TryFrom<Dynamic, Error = ConvertProtoConfigError>,
Copy link
Collaborator

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;
}

Copy link
Member

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! 👍🏻

src/filters/factory.rs Outdated Show resolved Hide resolved
src/proxy/admin.rs Outdated Show resolved Hide resolved
@markmandel
Copy link
Member

markmandel commented Sep 15, 2021

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)

@iffyio
Copy link
Collaborator Author

iffyio commented Sep 15, 2021

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

@iffyio iffyio changed the title Add a /config_dump endpoint Add a /config endpoint Sep 15, 2021
@markmandel markmandel added this to the 0.2.0 milestone Sep 15, 2021
@markmandel
Copy link
Member

Added to the milestone!

Copy link
Member

@markmandel markmandel left a 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 🥳

Comment on lines +53 to +56
Dynamic: prost::Message + Default,
Static: serde::Serialize
+ for<'de> serde::Deserialize<'de>
+ TryFrom<Dynamic, Error = ConvertProtoConfigError>,
Copy link
Member

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.
Copy link
Member

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. 👍🏻

@iffyio iffyio merged commit ae0c424 into main Sep 20, 2021
@iffyio iffyio deleted the iu/config-dump branch September 20, 2021 16:44
@markmandel markmandel added area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/feature New feature or request area/operations Installation, updating, metrics etc labels Sep 21, 2021
@markmandel markmandel mentioned this pull request Sep 22, 2021
@markmandel markmandel added the kind/breaking Changes to functionality, API, etc. label Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/operations Installation, updating, metrics etc area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc cla: yes kind/breaking Changes to functionality, API, etc. kind/feature New feature or request size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add admin endpoints to introspect proxy config
3 participants