Fix: set the WorkflowRun identity labels in ApplyInParallel

Merged
AR
6d ago
+88-0

Description of your changes

Fixes #329

ApplyInParallel defaults each workload's namespace but never copies RuntimeParams.Labels, so a resource applied through kube.#ApplyInParallel carries no workflowrun.oam.dev/name or /namespace, while the same resource applied through kube.#Apply or kube.#Patch does. The label loop now sits beside the namespace defaulting in both provider trees.

I have:

  • All commits are signed off (DCO).

How has this code been tested

A spec in each tree passes Labels to ApplyInParallel and asserts the created Pods carry them. Under envtest with the 1.37 assets, pkg/providers/kube goes from 10 passed and 1 failed to 11 passed, and pkg/providers/legacy/kube from 7 and 1 to 8 passed. Reverting only the two provider files brings both failures back. gofmt, go vet and golangci-lint v2.14.0 are clean on both packages.

Special notes for your reviewer

The existing apply parallel spec never set Labels and only checked that the Pods exist, which is why this went unnoticed. I ran the fmt, vet and lint parts of make reviewable rather than the whole target, as nothing generated changes here. Please tell me if you would rather see the full run.

AI-assisted, reviewed and tested by me.


Summary by cubic

Fixes kube.#ApplyInParallel so applied workloads carry the workflowrun identity labels (workflowrun.oam.dev/name, workflowrun.oam.dev/namespace) from RuntimeParams.Labels. Previously, resources applied in parallel lost these labels while kube.#Apply and kube.#Patch kept them.

  • Copies runtime labels onto workloads alongside namespace defaulting in both pkg/providers/kube and pkg/providers/legacy/kube.
  • Adds specs in both packages asserting the created Pods carry the runtime labels.