Skip to content

Fixed VirtualMCPCompositeToolDefinition printer columns output#5380

Open
Sanskarzz wants to merge 1 commit into
stacklok:mainfrom
Sanskarzz:printcolumnfix3
Open

Fixed VirtualMCPCompositeToolDefinition printer columns output#5380
Sanskarzz wants to merge 1 commit into
stacklok:mainfrom
Sanskarzz:printcolumnfix3

Conversation

@Sanskarzz
Copy link
Copy Markdown
Contributor

Summary

  • Fixes broken Steps and Refs printer columns for VirtualMCPCompositeToolDefinition, which previously used JSONPath wildcards with integer column types and could not display useful counts in kubectl get output.
  • Adds status.stepCount and status.refCount scalar fields and updates the v1alpha1 and v1beta1 printer columns to read those values.
  • Adds a VirtualMCPCompositeToolDefinition reconciler that maintains step counts, referencing VirtualMCPServer names, and reference counts, including cleanup when references are removed.
  • Registers the reconciler, grants status-update RBAC, and regenerates the CRD manifests and API documentation.

Fixes #4619

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Targeted unit tests (go test ./cmd/thv-operator/api/v1alpha1 ./cmd/thv-operator/api/v1beta1 ./cmd/thv-operator/controllers ./cmd/thv-operator/app -run 'TestVirtualMCPCompositeToolDefinitionReconciler_Reconcile|^$' -count=1)
  • Targeted vet (go vet ./cmd/thv-operator/api/v1alpha1 ./cmd/thv-operator/api/v1beta1 ./cmd/thv-operator/controllers ./cmd/thv-operator/app)
  • Generated artifacts (task operator-generate, task operator-manifests, task crdref-gen)
  • Diff validation (git diff --check)

API Compatibility

  • This PR does not break the v1beta1 API, OR the api-break-allowed label is applied and the migration guidance is described above.

Changes

File Change
cmd/thv-operator/api/v1beta1/virtualmcpcompositetooldefinition_types.go Adds count fields and corrected printer column JSONPaths.
cmd/thv-operator/api/v1alpha1/types.go Updates deprecated-version printer column JSONPaths.
cmd/thv-operator/controllers/virtualmcpcompositetooldefinition_controller.go Reconciles step and VirtualMCPServer reference counts.
cmd/thv-operator/controllers/virtualmcpcompositetooldefinition_controller_test.go Covers count population and stale reference cleanup.
cmd/thv-operator/app/app.go Registers the new reconciler.
Generated CRD/RBAC/docs output Publishes status schema, corrected columns, status permission, and API docs.

Does this introduce a user-facing change?

Yes. kubectl get virtualmcpcompositetooldefinitions now shows integer values for the Steps and Refs columns instead of empty or malformed output from array wildcards.

Special notes for reviewers

In the current CRD, Refs represents VirtualMCPServer resources that reference a composite workflow through spec.config.compositeToolRefs. The reconciler preserves and maintains the existing status.referencingVirtualServers field while exposing its count through status.refCount.

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@github-actions github-actions Bot added the size/M Medium PR: 300-599 lines changed label May 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 33.82353% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.71%. Comparing base (2043cf6) to head (b26b708).

Files with missing lines Patch % Lines
...rs/virtualmcpcompositetooldefinition_controller.go 35.93% 37 Missing and 4 partials ⚠️
cmd/thv-operator/app/app.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5380      +/-   ##
==========================================
- Coverage   68.81%   68.71%   -0.10%     
==========================================
  Files         627      628       +1     
  Lines       63594    63662      +68     
==========================================
- Hits        43762    43746      -16     
- Misses      16583    16661      +78     
- Partials     3249     3255       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VirtualMCPCompositeToolDefinition printer columns show broken output

1 participant