Skip to content

[bug] Labels and annotations parsed from notebook tags but never rendered in KFP DSL output #759

@StefanoFioravanzo

Description

@StefanoFioravanzo

Kale supports tagging notebook cells with label: and annotation: prefixes, parses them in nbprocessor.py, validates them via K8sLabelsValidator/K8sAnnotationsValidator, and stores them in StepConfig — but they are never applied to the generated KFP v2 DSL.

There are two issues:

  1. Labels don't even reach the Step object. In nbprocessor.py, cell_labels is parsed (line ~479) but never added to parsed_tags, unlike cell_annotations which is correctly added (line ~509-515). This means tags.get("labels", {}) at Step creation always returns {}.

  2. Neither labels nor annotations are rendered in the templates. pipeline_template.jinja2 handles step.config.limits, step.config.enable_caching, and step.config.base_image, but has no code to emit add_pod_label() or add_pod_annotation() calls on the KFP task.

Expected behavior:

When a user tags a cell with e.g. label:team:ml-infra or annotation:prometheus.io/scrape:true, the generated DSL should include:

step_task.add_pod_label("team", "ml-infra")
step_task.add_pod_annotation("prometheus.io/scrape", "true")

Relevant files:

  • kale/processors/nbprocessor.py — tag parsing (labels bug at ~line 509)
  • kale/step.py:41-54StepConfig with labels/annotations fields
  • kale/templates/pipeline_template.jinja2 — missing rendering logic
  • kale/config/validators.py:142-181 — validators exist but output is unused

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions