For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Architecture

This document describes the architecture of the Monitoring Extension.

The Monitoring Extension is built on three layers: an Exporter Custom Resource that declares the pipeline, a Crossplane composition that materializes stock Kubernetes resources from the CR, and a stock Telegraf pod that runs the data path.

Exporter

Exporter is a namespace-scoped Crossplane Composite Resource (XR) that serves as the operator-facing API. Each CR represents one independent export pipeline. All composed resources — the ConfigMap, the Helm Release, and the Telegraf pod — are created in the same namespace as the Exporter CR.

The CR schema has three top-level sections:

  • spec.deployment — optional image and resource overrides for the Telegraf pod. When omitted, the composition uses its built-in defaults.
  • spec.source — PromQL endpoint, authentication, polling parameters, and the list of metrics to export.
  • spec.sink — discriminated union selecting the output type. Exactly one sink type must be specified. Currently only elastic is supported.

Crossplane Composition

The composition processes each Exporter CR through a pipeline:

  1. render-providerconfigs (function-go-templating) — Creates namespace-scoped ProviderConfigs for the Kubernetes and Helm providers, scoped to the same namespace as the Exporter CR.

  2. render-telegraf-toml (function-go-templating) — Renders the full Telegraf TOML configuration from the XR fields using an inline Go template. The output is a kubernetes.m.crossplane.io/v1alpha1 Object that materializes as a ConfigMap named <name>-telegraf-conf in the same namespace.

  3. observe-registry-secret + pull-registry-secret (function-go-templating + function-extra-resources) — Mirrors the cennso-pull-secret as a read-only Object and fetches it into context. The next step uses it to conditionally switch the Telegraf image pull to the private OCI registry.

  4. render-helm-release (function-go-templating) — Creates a helm.m.crossplane.io/v1beta1 Release that installs the official Telegraf chart. The composition wires the XR namespace, the step-2 ConfigMap as a mounted volume, the image override, and the OAuth2 Secret name as an envFromSecret reference.

  5. sequence-creation (function-sequencer) — Enforces creation order: ProviderConfigs → ConfigMap Object → Helm Release. The Helm Release is withheld from the desired state until the ConfigMap Object is Ready, preventing the Telegraf pod from starting before its configuration volume exists. On deletion, resources are removed in reverse order.

  6. auto-ready (function-auto-ready) — Propagates the readiness of all composed resources to the Exporter XR. The XR reports Ready=True only when every composed resource (ProviderConfigs, ConfigMap Object, Helm Release) is Ready.

Telegraf Pod

The Telegraf pod is configured entirely by the rendered ConfigMap. It uses the following plugins:

The OAuth2 credentials Secret is projected as environment variables (client_id, client_secret, token_endpoint, api_endpoint) onto the Telegraf container. The rendered TOML reads them using Telegraf's built-in variable substitution (${client_id}, and so on). The api_endpoint variable holds the Elasticsearch HTTP URL.