Skip to content

fix(yurthub): use storage's TableConvertor when implemented - #2794

Open
mohammd-khalil wants to merge 1 commit into
openyurtio:masterfrom
mohammd-khalil:feat-multiplexer-tableconvertor
Open

mohammd-khalil wants to merge 1 commit into
openyurtio:masterfrom
mohammd-khalil:feat-multiplexer-tableconvertor

Conversation

@mohammd-khalil

Copy link
Copy Markdown

What type of PR is this?

/kind enhancement

What this PR does / why we need it:

getReqScope in pkg/yurthub/proxy/multiplexer/multiplexerproxy.go previously always built RequestScope.TableConvertor using rest.NewDefaultTableConvertor(gvr.GroupResource()), ignoring any custom ConvertToTable logic a storage might implement.

This PR checks whether storage (passed into getReqScope, obtained from requestsMultiplexerManager.ResourceStore(gvr)) implements rest.TableConvertor, and uses that implementation when available — falling back to the default convertor when it doesn't:

tableConvertor := rest.NewDefaultTableConvertor(gvr.GroupResource())
if convertor, ok := storage.(rest.TableConvertor); ok {
    tableConvertor = convertor
}

This required changing getReqScope's signature to accept storage rest.Storage, and updating its call site in ServeHTTP accordingly.

Adds TestGetReqScopeTableConvertor, covering both the default-fallback path and the custom-convertor path.

Which issue(s) this PR fixes:

Fixes #2781

Special notes for your reviewer:

No existing storage under pkg/yurthub/multiplexer/storage/ currently implements rest.TableConvertor, so this doesn't fix a currently observable bug — it closes the gap for any storage that implements it going forward.

Does this PR introduce a user-facing change?

NONE

other Note

Previously ignored any custom ConvertToTable a storage implements.
Falls back to default table convertor when storage doesn't
implement rest.TableConvertor. Adds unit test for both paths.
@mohammd-khalil
mohammd-khalil requested a review from a team as a code owner August 30, 2026 16:29
@sonarqubecloud

Copy link
Copy Markdown

@stale

stale Bot commented Dec 4, 2026

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the wontfix label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(yurthub): use storage's TableConvertor when implemented

1 participant