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:
-
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 {}.
-
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-54 — StepConfig with labels/annotations fields
kale/templates/pipeline_template.jinja2 — missing rendering logic
kale/config/validators.py:142-181 — validators exist but output is unused
Kale supports tagging notebook cells with
label:andannotation:prefixes, parses them innbprocessor.py, validates them viaK8sLabelsValidator/K8sAnnotationsValidator, and stores them inStepConfig— but they are never applied to the generated KFP v2 DSL.There are two issues:
Labels don't even reach the Step object. In
nbprocessor.py,cell_labelsis parsed (line ~479) but never added toparsed_tags, unlikecell_annotationswhich is correctly added (line ~509-515). This meanstags.get("labels", {})at Step creation always returns{}.Neither labels nor annotations are rendered in the templates.
pipeline_template.jinja2handlesstep.config.limits,step.config.enable_caching, andstep.config.base_image, but has no code to emitadd_pod_label()oradd_pod_annotation()calls on the KFP task.Expected behavior:
When a user tags a cell with e.g.
label:team:ml-infraorannotation:prometheus.io/scrape:true, the generated DSL should include:Relevant files:
kale/processors/nbprocessor.py— tag parsing (labels bug at ~line 509)kale/step.py:41-54—StepConfigwithlabels/annotationsfieldskale/templates/pipeline_template.jinja2— missing rendering logickale/config/validators.py:142-181— validators exist but output is unused