Skip to content

Template_enricher can't pick up labels from kubernetes resources #1866

@Meeki1

Description

@Meeki1

My playbook:

name: CrashLoopBackOffAlerts
  triggers:
    - on_pod_crash_loop:
        rate_limit: 0
        labels_selector: team=support
  actions: 
    - report_crash_loop: {},
    - template_enricher:
        template: 'Alert for ${owner}'
  sinks: ['robusta-alerts-stage']

Pod yaml:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    [pod-reloader.deckhouse.io/auto](http://pod-reloader.deckhouse.io/auto): "true"
  labels:
    app: sprt-uploads
    owner: U02M6EA5YQ1
    stack: node
    team: cjs
  name: sprt-uploads-8469b55658-7lmgg
  namespace: stage
  containers:
    image: xxx
  imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 3
      httpGet:
        path: /live
        port: 8080
        scheme: HTTP
      periodSeconds: 10
      successThreshold: 1
      timeoutSeconds: 1
    name: sprt-uploads
    readinessProbe:
      failureThreshold: 3
      httpGet:
        path: /ready
        port: 8080
        scheme: HTTP
      periodSeconds: 10
      successThreshold: 1
      timeoutSeconds: 1
    resources:
      limits:
        memory: 5Mi
      requests:
        cpu: 10m
        memory: 5Mi
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  imagePullSecrets:
  - name: registrysecret
  status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2025-07-11T12:07:08Z"
    status: "True"
    type: PodReadyToStartContainers
  - lastProbeTime: null
    lastTransitionTime: "2025-07-11T12:07:07Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2025-07-11T12:07:07Z"
    message: 'containers with unready status: [sprt-uploads]'
    reason: ContainersNotReady
    status: "False"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2025-07-11T12:07:07Z"
    message: 'containers with unready status: [sprt-uploads]'
    reason: ContainersNotReady
    status: "False"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2025-07-11T12:07:07Z"
    status: "True"
    type: PodScheduled

Logs:
2025-07-11 13:09:17.871 WARNING cannot convert block of type <class 'robusta.core.reporting.blocks.EmptyFileBlock'> to slack format block: hidden=False html_class=None metadata={'is_empty': True, 'remarks': 'Logs unavailable for container: sprt-uploads'} filename='sprt-uploads-8469b55658-7lmgg.log'

To reproduce:
Trigger playbook and you will get "missing":

Crashing pod sprt-uploads-8469b55658-7lmgg in namespace stage
Source: cs.money
Crash Info
● Container sprt-uploads
● Restarts 11
● Status WAITING
● Reason CrashLoopBackOff
Previous Container
● Status TERMINATED
● Reason OOMKilled
● Started at 2025-07-11T12:38:31Z
● Finished at 2025-07-11T12:38:31Z
Alert for <missing>

Expected behavior:
I can use labels in template_enricher.

Version: 0.21.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions