kubeflow / kubeflow/kale

bug(backend): Labels and annotations parsed from notebook tags but never rendered in KFP DSL output

Open
#759 2 comments 0 reactions 1 assignee Claimed by @ada333 View on GitHub
2.x candidate area/backend bug
Dominant language
Python
Stars
703
Forks
161
Avg merge
6d 3h
Merged PRs (30d)
10

Description

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:

```python
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.