Repository navigation
Fix: inject the multicluster client into the workflow context - #251
Merged
Merged
Conversation
cuixiaojun001
requested review from
FogDong,
Somefive,
anoop2811,
briankane,
jguionnet,
leejanee and
wonderflow
as code owners
August 14, 2026 10:37
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #251 +/- ##
==========================================
+ Coverage 62.49% 69.97% +7.48%
==========================================
Files 62 74 +12
Lines 4415 5842 +1427
==========================================
+ Hits 2759 4088 +1329
- Misses 1324 1365 +41
- Partials 332 389 +57
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
briankane
approved these changes
Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
This PR fixes multi-cluster workflow steps executed by the standalone
vela-workflowcontroller.Previously, Kubernetes providers could fall back to the global singleton client because the reconciler's cluster-aware Kubernetes client was not injected into the workflow context. As a result, steps such as
kube.#Applycould ignore the requested target cluster and apply resources to the control-plane cluster instead.This change:
Fixes #250
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
The following automated checks passed:
go test ./controllers ./pkg/providers/kube -count=1go vet ./...The fix was also validated in a Kubernetes environment using a
WorkflowRuncontaining a build step:k8s-cloud01-thor-test.cloudstudio-cinamespace.A regression test was added using a recording Kubernetes client to verify that the requested cluster name is propagated through the workflow context to provider client operations.
Special notes for your reviewer
The provider fallback to
singleton.KubeClientis intentionally preserved for contexts where no Kubernetes client has been injected.The standalone workflow reconciler now explicitly injects its cluster-aware client before workflow step execution, allowing providers to honor multi-cluster context without changing the provider API.
Summary by cubic
Injects the reconciler’s multi‑cluster Kubernetes client into the workflow context so kube provider calls run against the step’s target cluster. Previously, steps could fall back to the global client and apply to the control‑plane cluster; now providers use the reconciler client and operate on the requested cluster. Fallback to the global client remains when no client is injected.
Review focus
controllers/workflowrun_controller.go: injects the client viaprovidertypes.WithKubeClient(ctx, r.Client)before step execution.pkg/providers/types: addsWithKubeClientto carry the client in context.controllers/workflow_test.go: regression test uses a recording client to assert the cluster from context reaches client ops and that the applied object exists.Written for commit acfcdcc. Summary will update on new commits.