Skip to content

small refactor of pluggable bbr interfaces#2513

Merged
k8s-ci-robot merged 14 commits intokubernetes-sigs:mainfrom
nirrozenbaum:bbr-plugins-refactor
Mar 8, 2026
Merged

small refactor of pluggable bbr interfaces#2513
k8s-ci-robot merged 14 commits intokubernetes-sigs:mainfrom
nirrozenbaum:bbr-plugins-refactor

Conversation

@nirrozenbaum
Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
small refactor of pluggable bbr plugins framework.
add request/response types and updated interfaces to make it possible for a single plugin to have both request/response hooks.
pay attention that pluggable bbr is still not wired.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

None

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 7, 2026
@k8s-ci-robot k8s-ci-robot requested review from kfswain and robscott March 7, 2026 14:35
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 7, 2026

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit b073e74
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/69ad781cdb4fd70008ddc8b5
😎 Deploy Preview https://deploy-preview-2513--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nirrozenbaum

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 7, 2026
@nirrozenbaum
Copy link
Copy Markdown
Contributor Author

/cc @elevran @shmuelk

@k8s-ci-robot k8s-ci-robot requested review from elevran and shmuelk March 7, 2026 14:36
Comment thread pkg/bbr/framework/plugins.go Outdated
Comment thread pkg/bbr/framework/plugins.go Outdated
@nirrozenbaum
Copy link
Copy Markdown
Contributor Author

/hold

I'm iterating on this a bit more to make it cleaner with the other parts of the code.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 7, 2026
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Comment thread cmd/bbr/runner/runner.go Outdated
Comment thread pkg/bbr/framework/plugins.go
Comment thread pkg/bbr/framework/plugins.go Outdated
Comment thread pkg/bbr/framework/plugins.go Outdated
Comment thread pkg/bbr/framework/plugins.go Outdated
Comment thread pkg/bbr/handlers/request.go Outdated
before := time.Now()
updatedHeaders, updatedBody, err = plugin.Execute(ctx, updatedHeaders, updatedBody)
metrics.RecordPluginProcessingLatency(executeExtensionPoint, plugin.TypedName().Type, plugin.TypedName().Name, time.Since(before))
mutatedRequest, err = plugin.ProcessRequest(ctx, request)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when executing a chain, does the N+1 plugin see mutations done by Plugin N? Should it? If not, how do you "merge" mutations from different plugins?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. plugin N+1 should see mutations of plugin N.
the order of execution is defined by whoever configures bbr. then plugins are running sequentially and may override the previous plugins.
latest update holds.

Comment thread pkg/bbr/handlers/response.go Outdated
for _, plugin := range s.responsePlugins {
log.FromContext(ctx).V(logutil.VERBOSE).Info("Executing response plugin", "plugin", plugin.TypedName())
before := time.Now()
mutatedResponse, err = plugin.ProcessResponse(ctx, response)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question regarding processing of mutations in a chain.

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
@nirrozenbaum nirrozenbaum force-pushed the bbr-plugins-refactor branch from f38b742 to 5a6e886 Compare March 8, 2026 09:32
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 8, 2026
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
@nirrozenbaum nirrozenbaum requested a review from elevran March 8, 2026 09:58
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
@nirrozenbaum
Copy link
Copy Markdown
Contributor Author

PR is ready for another review iteration.
/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 8, 2026
// Payload processor can mutate the headers and/or the body of the message.
Execute(ctx context.Context, headers map[string]string, body map[string]any) (updatedHeaders map[string]string, updatedBody map[string]any, err error)
// ProcessRequest runs the RequestProcessor plugin.
// RequestProcessor can mutate the headers and/or the body of the request.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clarify what an error return means (abort chained processing, return error to Envoy to abort transaction, ignore this plugin, ...)

Comment thread pkg/bbr/framework/types.go
Comment thread pkg/bbr/framework/types.go
Comment thread pkg/bbr/handlers/request.go
@nirrozenbaum nirrozenbaum requested a review from elevran March 8, 2026 11:17
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Comment on lines +48 to +54
func (r *InferenceMessage) RemoveHeader(key string) {
if _, ok := r.Headers[key]; ok {
delete(r.Headers, key)
delete(r.mutatedHeaders, key) // avoid sending set and remove for same key
r.removedHeaders.Insert(key)
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elevran eventually I've added also the removed headers cause that was a very simple change.
(less than 20 LoC).

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Copy link
Copy Markdown
Contributor

@elevran elevran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 8, 2026
@k8s-ci-robot k8s-ci-robot merged commit 2faa44c into kubernetes-sigs:main Mar 8, 2026
11 checks passed
@nirrozenbaum nirrozenbaum deleted the bbr-plugins-refactor branch March 8, 2026 21:18
abdallahsamabd pushed a commit to abdallahsamabd/gateway-api-inference-extension that referenced this pull request Mar 9, 2026
* small refactor of pluggable bbr interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor update

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* godoc

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* iterate on interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* more updates

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* code review

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor change towards adding deleted headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* make linter happy

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* linter and tests

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* embed InferenceMessage in request/response

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* add support for removing headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor tweak

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

---------

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Abdallah Samara <abdallahsamabd@gmail.com>
abdallahsamabd pushed a commit to abdallahsamabd/gateway-api-inference-extension that referenced this pull request Mar 9, 2026
* small refactor of pluggable bbr interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor update

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* godoc

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* iterate on interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* more updates

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* code review

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor change towards adding deleted headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* make linter happy

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* linter and tests

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* embed InferenceMessage in request/response

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* add support for removing headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor tweak

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

---------

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Signed-off-by: Abdallah Samara <abdallahsamabd@gmail.com>
RyanRosario pushed a commit to RyanRosario/gateway-api-inference-extension that referenced this pull request Mar 9, 2026
* small refactor of pluggable bbr interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor update

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* godoc

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* iterate on interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* more updates

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* code review

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor change towards adding deleted headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* make linter happy

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* linter and tests

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* embed InferenceMessage in request/response

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* add support for removing headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor tweak

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

---------

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
@nirrozenbaum nirrozenbaum added this to the Pluggable BBR milestone Mar 10, 2026
BizerNotNull pushed a commit to BizerNotNull/gateway-api-inference-extension that referenced this pull request Mar 15, 2026
* small refactor of pluggable bbr interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor update

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* godoc

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* iterate on interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* more updates

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* code review

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor change towards adding deleted headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* make linter happy

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* linter and tests

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* embed InferenceMessage in request/response

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* add support for removing headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor tweak

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

---------

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
elevran pushed a commit to llm-d/llm-d-inference-scheduler that referenced this pull request Apr 23, 2026
…pi-inference-extension#2513)

* small refactor of pluggable bbr interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor update

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* godoc

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* iterate on interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* more updates

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* code review

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor change towards adding deleted headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* make linter happy

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* linter and tests

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* embed InferenceMessage in request/response

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* add support for removing headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor tweak

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

---------

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
nirrozenbaum added a commit to llm-d/llm-d-inference-payload-processor that referenced this pull request Apr 28, 2026
…pi-inference-extension#2513)

* small refactor of pluggable bbr interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor update

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* godoc

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* iterate on interfaces

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* more updates

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* code review

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* typo

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor change towards adding deleted headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* make linter happy

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* linter and tests

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* embed InferenceMessage in request/response

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* add support for removing headers

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

* minor tweak

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>

---------

Signed-off-by: Nir Rozenbaum <nrozenba@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants