Skip to content

Validation of OpenTelemetry plugin's "config.resource_attributes" field is too strict #10654

@seh

Description

@seh

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

3.2.2

Current Behavior

Following the documentation for the OpenTelemetry plugin, writing a KongPlugin manifest to be translated by the Kong ingress controller (version 2.9.2), I attempted to set a few attributes in the "config.resource_attributes" field, which is of type "map," per the schema. If any of the attribute names include a period—such as "service.name," or "k8s.namespace.name" per the OpenTelemetry semantic conventions—then the ingress controller's validating Webhook rejects the manifest as follows:

admission webhook “validations.kong.konghq.com” denied the request: plugin failed schema validation: schema violation (config.resource_attributes: expected a string)

This comes from a manifest like the following:

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: opentelemetry-to-collector
  namespace: &ns some-app
plugin: opentelemetry
config: 
  endpoint: http://opentelemetry-collector.some-ns.svc.cluster.local:4318/v1/traces
  resource_attributes:
    k8s.namespace.name: *ns

I tried a few variations, placing the "k8s.namespace.name" mapping key name within double quotation marks, and inserting a backslash before the periods, but neither changed the outcome.

If I remove the periods and use, say, "k8snamespacename" as the resource attribute name, Kong's validation procedure accepts the manifest, and the ingress controller programs the proxies accordingly.

Expected Behavior

Kong's validation procedure should admit just about any string here for the attribute name, as the OpenTelemetry specification is still vague on the syntactic constraints for such names.

Steps To Reproduce

  1. (Optionally) Enable the OpenTelemetery plugin within Kong's configuration.
  2. Within Kubernetes, enable Kong's validating admission Webhook via a ValidatingWebhookConfiguration.
  3. Attempt to create a KongPlugin object by applying a manifest like the one shown earlier, via kubectl apply --filename <name> --dry-run=server or kubectl apply --filename <name> --server-side=true.
  4. Observe that the validating Webhook rejects the manifest due to the "config.resource_attributes" mapping entry.

Anything else?

I first mentioned this problem in the "kong" channel of the "Kubernetes" Slack workspace.

This plugin entered Kong's code base in #8826 by @mayocream.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions