#5946·flux2

Custom Event Metadata from Object

Author: matheuscscpCreated Jun 17, 2026Updated Aug 26, 2026
Labelsenhancementarea/notificationarea/api

xref: https://github.com/controlplaneio-fluxcd/flux-operator/pull/852#issuecomment-4638598592

This is an evolution of RFC-0008.

We could introduce two special annotations prefixed by the event.toolkit.fluxcd.io API group:

  • metadataTemplate: A Go template that must result in a JSON object that can be successfully parsed to map[string]string. The template context is the Flux object through the symbol obj (like ResourceSet inputs).
  • metadataExpression: A CEL expression similar to the above. Must result either in a map[string]string, or a map[string]any where all the underlying values are string. The expression context is the Flux object through the symbol obj.

Example of CEL expression generating the map {tag0: value, digest0: value, tag1: value, digest1: value, ...} in a ResourceSetInputProvider:

yaml
apiVersion: fluxcd.controlplane.io/v1
kind: ResourceSetInputProvider
metadata:
  name: podinfo
  namespace: flux-system
  annotations:
    event.toolkit.fluxcd.io/deploymentID: e076e315-5a48-41c3-81c8-8d8bdee7d74d # RFC 0008
    event.toolkit.fluxcd.io/metadataExpression: |
      lists.range(obj.status.exportedInputs.size())
        .map(n,
          {
            "tag" + string(n): obj.status.exportedInputs[n].tag,
            "digest" + string(n): obj.status.exportedInputs[n].digest
          }
        ).reduce(acc, m, acc.merge(m), {})
status:
  exportedInputs:
    - tag: ...
      digest: ...
    - tag: ...
      digest: ...