Fix: register oam/v1alpha1 types on manager scheme for workflowRef#231
Merged
briankane merged 1 commit intoJun 24, 2026
Merged
Conversation
The standalone Workflow type was moved to github.com/kubevela/pkg/apis/oam/v1alpha1, but oamv1alpha1.AddToScheme was never wired into the manager scheme. Resolving a WorkflowRun's spec.workflowRef -- both the validating webhook and the reconcile path call generator.GenerateWorkflowInstance -- failed with "no kind is registered for the type v1alpha1.Workflow". Register oamv1alpha1 on the manager scheme in cmd/main.go, and add an e2e case that creates a Workflow template and a WorkflowRun referencing it via workflowRef so this path is covered. Signed-off-by: vishal210893 <vishal210893@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #231 +/- ##
==========================================
+ Coverage 62.49% 67.77% +5.28%
==========================================
Files 62 65 +3
Lines 4415 5409 +994
==========================================
+ Hits 2759 3666 +907
- Misses 1324 1355 +31
- Partials 332 388 +56
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
Jun 24, 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.
Fixes #230
WorkflowRuns that use spec.workflowRef are rejected by the validating webhook with:
field "spec.workflowRef": Invalid value error encountered, failed to get workflow ref:
no kind is registered for the type v1alpha1.Workflow in scheme "pkg/runtime/scheme.go:100"
Problem. The standalone Workflow type was moved to github.com/kubevela/pkg/apis/oam/v1alpha1 (pkg bump to v1.10.0). pkg/generator/generator.go and pkg/webhook/v1alpha1/workflowrun/validation.go resolve workflowRef via oamv1alpha1.Workflow, but oamv1alpha1.AddToScheme was never wired into the manager scheme in cmd/main.go (only clientgoscheme, the local v1alpha1, and conditionally kube-trigger are registered). The moved package registers itself into the global k8sscheme.Scheme, but the manager builds its own runtime.NewScheme(), so the type stays unknown — and client.Get(&oamv1alpha1.Workflow{}) fails in scheme.ObjectKinds. This affects both the webhook and the reconcile path, since both call generator.GenerateWorkflowInstance.
Solution. Register the moved package on the manager scheme:
utilruntime.Must(oamv1alpha1.AddToScheme(scheme))
oamv1alpha1 shares the GroupVersion core.oam.dev/v1alpha1 with the local package and registers complementary kinds (Definition, Workflow, WorkflowList) with no overlap against the local WorkflowRun, so co-registration is safe.
Key files
Breaking changes: none.
How has this code been tested
Special notes for your reviewer
The reason this regression slipped past CI: existing webhook tests only exercise the inline workflowSpec branch of ValidateWorkflow, so the workflowRef Get path had no coverage. The added e2e spec closes that gap by running against the real manager scheme.
Summary by cubic
Fixes webhook and reconcile failures when a WorkflowRun uses spec.workflowRef by registering
github.com/kubevela/pkg/apis/oam/v1alpha1types on the manager scheme. WorkflowRefs are now admitted and run to completion (fixes #230).oamv1alpha1.AddToSchemeincmd/main.goand the e2e suite.workflowRefresolution.Written for commit 84d7e1f. Summary will update on new commits.