Skip to content

Extra Resource Collection#

The telemetry component can be configured to dynamically query an additional Kubernetes resource and evaluate a Common Expression Language (CEL) script against it. This allows the telemetry collector to extract specific fields from the cluster state and append them to the outbound telemetry payload.

Helm Configuration#

This feature is controlled via two new keys under the telemetry block (see more: Configuring Telemetry):

  • telemetry.extraResource: The name of the Kubernetes resource to query (e.g., licenses). It accepts standard resource identifiers (plural, singular, or shortname).
  • telemetry.extraCEL: The CEL expression used to parse the retrieved objects. The script must return a map of key-value pairs (e.g., {"key": "value"}), which are then merged directly into the final telemetry event properties.

Example

telemetry:
  mode: online
  extraResource: foobar
  extraCEL: "items.filter(i, i.metadata.name == 'foo').size() > 0 ? {'found': true} : {}"

Defaults#

By default, this feature is configured to extract the Subject ID from the most recently issued, non-expired k0rdent Enterprise License.

  • Target Resource: licenses
  • CEL Expression:
items.filter(i, !has(i.status.expired) || !i.status.expired).size() > 0 ? {"client_id": items.filter(c, !has(c.status.expired) || !c.status.expired).filter(c, items.filter(o, !has(o.status.expired) || !o.status.expired).all(o, c.status.issuedAt >= o.status.issuedAt))[0].status.subject} : {}

Important Caveats#

When modifying or utilizing this feature, observe the following constraints:

  1. Online Mode Only: Extra resource collection is only executed when telemetry.mode is set to online. It is completely ignored in local or disabled modes.
  2. items Variable Requirement: Under the hood, the collector performs a List API call against the specified resource. Because the input is always a list of unstructured objects, the CEL expression must reference the data using the items variable.
  3. GroupVersion Restriction: The discovery client restricts the resource lookup for this feature specifically to the k0rdent Enterprise GroupVersion (k0rdent.mirantis.com/v1beta1). Standard Kubernetes resources or other third-party CRDs are not supported by this target.