Skip to content

Allow http route and cluster metadata to contain typed metadata in Any in addition to Struct format #13986

Closed

Description

@efimki

Title: Allow route and cluster metadata to contain typed metadata in Any in addition to Struct format

Description:
Currently http route and cluster xds elements can have a metadata attached, which is nice. Unfortunately it is currently serialized using key-value format, for example:

            filter_metadata {
              key: "foo"
              value {
                fields {
                  key: "bar"
                  value {
                    string_value: "baz"
                  }
                }
                fields {
                  key: "field2"
                  value {
                    string_value: "val2"
                  }
                }

It is inefficient from the point of view of serialization / deserialization, as well as visual representation.

It would be useful to be able to serialize metadata in 'Any' format like this:

              typed_per_filter_config {
                key: "com.example.foo"
                value {
                  [type.example.com/foo] {
                    bar: "baz"
                    field2: "val2"
                  }
                }
              }

Activity

  1. added
    enhancement
    triage
    on Nov 11, 2020
  2. stevenzzzz commented on Nov 11, 2020

    @stevenzzzz
    Contributor

    to be exact, we want to make Metadata support protobuf.Any and possibly sunset use of Struct, in route and cluster metadata.

  3. added and removed
    enhancement
    triage
    on Nov 13, 2020
  4. mattklein123 commented on Nov 13, 2020

    @mattklein123
    Member

    I think this is reasonable. In the past we have done this by allowing a struct to be contained within an Any. cc @envoyproxy/api-shepherds

  5. htuch commented on Nov 15, 2020

    @htuch
    Member

    Yes, Struct-in-Any is the flexible arrangement here, and the ask makes sense, but I'd like to better understand what is proposed. For Envoy extensions, it makes sense to have Any as the baseline as the extensions necessarily have the proto descriptors linked in for configuration. How would we provide descriptors to Envoy in this use case? Would there be some explicit mechanism for supply descriptors? Would we expect that any extensions that consume the metadata have the descriptors available at link time?

    We should also be cognizant of any JSON-implied interop with things like Wasm and where a dynamic JSON structure is expected in filters like RBAC (CC @PiotrSikora @kyessenov). This depends on how far we want to go with making Metadata Any, but I think we killed moving dynamic metadata to typed filter state in #4100.

  6. efimki commented on Nov 17, 2020

    @efimki
    MemberAuthor

    @htuch thanks for the great questions.
    I'm not really sure about a proper way to implement this, so will appreciate any guidance.

    Here are some ideas:

    How would we provide descriptors to Envoy in this use case?
    Would there be some explicit mechanism for supply descriptors?

    Can they be derived from RouteSpecificFilterConfig and registered similarly?

    Would we expect that any extensions that consume the metadata have the descriptors available at link time?

    Yes, I think that would make sense.

  7. stevenzzzz commented on Nov 17, 2020

    @stevenzzzz
    Contributor

    I would proposed to put an Any alongside the Struct, and reusing the existing typedMetadata trick for structured config data stored in Route/Cluster metadata.

    With Any we saved the deserialization from struct to protobuf, but we need some factories to validate the protobuf is correct during config loading, plus users could add more semantics to the data structure returned from the factory.

  8. htuch commented on Nov 17, 2020

    @htuch
    Member

    SG. I think the descriptors just need to be linked in somehow, but they don't need to be registered, protobuf takes care of static initialization of all linked descriptors.

  9. github-actions commented on Dec 18, 2020

    @github-actions

    This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

  10. added
    stale
    on Dec 18, 2020
  11. stevenzzzz commented on Dec 20, 2020

    @stevenzzzz
    Contributor

    /nostale
    nostale

  12. stevenzzzz commented on Dec 20, 2020

    @stevenzzzz
    Contributor

    @htuch could you mark this as nonstale, we want this to show on our radar.

  13. removed
    stale
    on Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions