Skip to content

bootstrap fields for user_agent overwritten internally #16471

Closed

Description

@justincely

Title: user_agent_name and user_agent_version are overwritten if supplied via bootstrap configs.

Description:
The documentation for the bootstrap config indicates that these fields should be free-form strings. I would expect to be able to override them if I chose, but they always revert back to the envoy build version. Probably a niche group that would want to set these, but I do expect to be able to do so from the docs and the behavior of every other field i've encountered so far.

I can get around this a bit by using the metadata field to provide my agent overrides, but seems like the docs should be updated or the behavior changed in order to avoid confusion.

Repro steps:

  1. run envoy with a bootstrap config that specifies node.user_agent_name and node.user_agent_version.
  2. get the config dump from the admin endpoint and verify the output node information has been changed.

e.g. a bootstrap node of

node:
  id: "test"
  cluster: "test-cluster"
  user_agent_name: "test-justin-agent"
  user_agent_version: "33"

gives the following from the config dump

{
  "id": "test",
  "cluster": "test-cluster",
  "hidden_envoy_deprecated_build_version": "93753017cb8c64ba92536b755ddf756df377c6c3/1.19.0-dev/Clean/RELEASE/BoringSSL",
  "user_agent_name": "envoy",
  "user_agent_build_version": {
    "version": {
      "major_number": 1,
      "minor_number": 19
    },

Config:

static_resources:
  listeners:
  - name: main
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 8000
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: ingress_http
          codec_type: AUTO
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains:
              - "*"
              routes:
              - match:
                  prefix: "/"
                route:
                  cluster: web_service
          http_filters:
          - name: envoy.filters.http.router
            typed_config: {}

  clusters:
  - name: web_service
    connect_timeout: 0.25s
    type: STRICT_DNS # static
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: web_service
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: web_service
                port_value: 80

node:
  id: "test"
  cluster: "test-cluster"
  user_agent_name: "test-justin-agent"
  user_agent_version: "33"

admin:
  access_log_path: "/dev/null"
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 8001

Activity

  1. added
    triage
    on May 12, 2021
  2. antoniovicente commented on May 12, 2021

    @antoniovicente
    Contributor

    cc @stevenzzzz @yanavlasov

    stevenzzzz mentioned this to me earlier today. It would be ideal to have Envoy preserve the provided node config fields or proto. The current behavior should be the default, but it should be possible to override it.

    stevenzzzz/justincely: Would either of you be interested in making the relevant change?

  3. added
    help wanted
    and removed
    triage
    on May 12, 2021
  4. antoniovicente commented on May 12, 2021

    @antoniovicente
    Contributor
  5. justincely commented on May 13, 2021

    @justincely
    ContributorAuthor

    I'd love to tackle it if you don't mind a first time contributor taking this one. I've been wanting a way to contribute and this issue seems fairly well suited to a beginner

  6. antoniovicente commented on May 13, 2021

    @antoniovicente
    Contributor

    Please allow some time for @htuch to comment on this issue. Apparently there is a metadata field in the Node proto that may be better suited to carry information about the xds client. It may be worth documenting that these fields can't be set currently and possibly consider rejecting bootstrap config if they are set.

  7. htuch commented on May 13, 2021

    @htuch
    Member

    My thinking here is that it doesn't hurt to allow this to be overiddable, but if you override, you are almost definitely doing something very hacky that can best be done via other mechanisms.

    One of the roles of user agent name/version is to allow control planes to do be able to do per-client xDS fixups in the event of needing to deal with buggy behavior on a particular client. This should never be done in normal usage but is an escape hatch.

    Semantically, if you want to essentially apply key:value labels to a particular Envoy instance and surface this to the xDS server, this is what Node metadata is for.

    I agree docs should be updated if we don't make this overridable.

  8. justincely commented on May 13, 2021

    @justincely
    ContributorAuthor

    I agree that the reason is to allow the control plane to do special handling, but I was thinking more in terms of handling config to different groups of clients. E.g. if the control plane wants to send valid config to a few versions of connected envoy clients, it needs to read the version info and the agent name. Now the reason the agent_name was coming in for my scenario is for custom compilations of envoy. So I want to be able to hand off different configurations to pure envoy, but also to custom builds. Some handling of this can be done with the node extensions, but having the agent change as well can be useful to track.

    I guess at this point i'm a little torn whether I think the agent info should be overridden or not. A metadata key:value label could be just added for custom builds, but at the same time if someone does a custom build or anything I feel it's not pure "envoy" anymore.

    But I can be happy either way TBH; if the docs are updated or if the fields are changeable.

  9. justincely commented on May 13, 2021

    @justincely
    ContributorAuthor

    I quickly spiked out the change to let user_agent_name be set from the bootstrap config. It'll take a little bit more to get the versions done, since they're slightly more than simple strings. But i'll wait for the final decision before doing anything more.

  10. antoniovicente commented on May 13, 2021

    @antoniovicente
    Contributor

    I don't know how well the example below may apply to your use case, but I'm wondering about the preferred standard way to communicate the following information.

    Let's say I'm distributing an Envoy as part of a system like Istio and I want to communicate that the xds client is Envoy with version X and it happens to be the build coming from Istio at version Y.

    It makes sense for user agent to be "envoy" and user agent version to come from the standard envoy source
    Info on it being from the istio package may be something that we plumb through config in either a capabilities field, distribution/package field or an opaque token field in the Node proto, or a well known metadata name

  11. htuch commented on May 14, 2021

    @htuch
    Member

    Right. I think there is significant value in having standardized user agent name/version in general to support independent contorl planes that need to sometimes condition on specific cases, e.g. Envoy version bug at 1.17.2 or something.

    The anti-pattern I think is getting into the situation where user agent name is a string with special parsing semantics (i.e. what happens in browser user agents).

    That said, we can share this guidance but still allow folks who really, really want to set their own user agent name to do so; maybe they have a pure in-house Envoy/xDS usage and it's the right thing there. I would worry if this became a common pattern outside these cases.

  12. justincely commented on May 17, 2021

    @justincely
    ContributorAuthor

    Cool, so we're good to allow setting the following via bootstrap config?

    • user_agent_name
    • user_agent_version
    • user_agent_build_version

    Just making crystal clear. If so, I'd be happy to take on this issue

  13. htuch commented on May 18, 2021

    @htuch
    Member

    I'm not going to oppose adding this, but I think it's important we document clearly if overrides are allowed that they are probably never the right thing. Use if you fully understand your environment. If interoperating with things like Google's Traffic Director, it would be a mistake to use this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions