Skip to content

Allow configuring request timeout per plugin - #304

Open
CoderSherlock wants to merge 1 commit into
containerd:mainfrom
CoderSherlock:feature/per-plugin-request-timeout
Open

Allow configuring request timeout per plugin#304
CoderSherlock wants to merge 1 commit into
containerd:mainfrom
CoderSherlock:feature/per-plugin-request-timeout

Conversation

@CoderSherlock

Copy link
Copy Markdown

Support per-plugin request timeout in NRI while maintaining global timeout as the default fallback.

  • Add request_timeout field (in milliseconds) to ConfigureResponse protobuf message.
  • Update adaptation layer to store per-plugin request timeout on configuration response and use it across plugin request invocations.
  • Add WithRequestTimeout option and SetRequestTimeout method to plugin stub interface to allow plugins to specify a custom timeout.
  • Add unit test verifying per-plugin request timeout configuration.

Fixes #287

Support per-plugin request timeout in NRI while maintaining global
timeout as the default fallback.

- Add request_timeout field (in milliseconds) to ConfigureResponse protobuf message.
- Update adaptation layer to store per-plugin request timeout on configuration response and use it across plugin request invocations.
- Add WithRequestTimeout option and SetRequestTimeout method to plugin stub interface to allow plugins to specify a custom timeout.
- Add unit test verifying per-plugin request timeout configuration.

Fixes containerd#287

Signed-off-by: Pengzhan Hao <haopengzhan@gmail.com>
@CoderSherlock
CoderSherlock force-pushed the feature/per-plugin-request-timeout branch from 04227c7 to 64caddc Compare August 7, 2026 18:23
@CoderSherlock CoderSherlock changed the title feat: Allow configuring request timeout per plugin Allow configuring request timeout per plugin Aug 7, 2026
@CoderSherlock

Copy link
Copy Markdown
Author

/reviewer @samuelkarp @mikebrow

@mikebrow

Copy link
Copy Markdown
Member

wave..see comment #287 (comment)

@mikebrow

Copy link
Copy Markdown
Member

@klihub let's revisit this ..

@mikebrow

mikebrow commented Aug 13, 2026

Copy link
Copy Markdown
Member

maybe pass the context with cancel timeout values we get over grpc from the kubelet client (etal) to NRI … set timeout values for each call type for each current plugin, based on a plugin config and some defaults.  Let NRI manage (validate) ingress of plugins based on the sum of requests being less than something reasonable in view of the client's timeout

@mikebrow

Copy link
Copy Markdown
Member

maybe create the new context timeout used for each call over the NRI adaptation based on the time remaining on the client context received from the CRI client.. which could make it more dynamic...

@klihub

klihub commented Aug 14, 2026

Copy link
Copy Markdown
Member

@CoderSherlock Thank you for this PR. @CoderSherlock @mikebrow I think I understand the problems this PR is aimed to solve and I think it is a valid problem. The part I'm a bit vary about regarding the approach taken here is that it brings in a (rather big) semantic divergence from how we've treated configuration (or related administrative control) so far.

In the past and still to date, admin-controlled NRI configuration (NRI related settings in the runtime configuration, the build in validator, and pluggable validation) have provided cluster admins a way to set up boundary conditions within which NRI plugins must stay. If some plugin does not stay within these boundaries, the runtime take corrective actions (depending on the situation, rejecting actions request by the plugin (failed validation), or even kicking out the plugin from the runtime (failure respond within a timeout).

These have not been so far advisory restrictions but strictly enforced ones. AFAICT, this PR now changes that, basically diminishing the admin's setting to a mere wish, or an advice (since it is communicated to the plugin during the initial handshake phase). If a plugin configures itself with a different timeout, it does not matter what the cluster admin has configured. The plugins always wins and can override the admin's settings.

I'm not claiming that we definitely should not do this. But if we go ahead and merge this, the above mentioned divergence from the status quo/consequences should come as a conscious decision and not as a side-effect/something which just happened to slip in. So I would like to hear what others (@mikebrow @samuelkarp @kad @askervin) think about this. And if this is considered iffy, what alternatives we might have.

One alternative that comes to mind, which would also be a fairly small change to this PR, is that we could instead treat this as a (worst case) boundary condition reported by the plugin, check it against the one configured by the admin, and prevent/abort registration/startup of the plugin on the runtime side if it exceeds the timeout set by the admin.

Effectively this same behavior would be also possible to implement on the plugin/stub side, since the admin configured timeouts are communicated to the plugin, so the stub could fail with an error if the plugin would like to have a larger timeout that what is allowed by the admin. But doing it on the runtime side would have the advantage of ensuring identical behavior across multiple plugin/stub implementations (golang and rust).

@mikebrow

mikebrow commented Aug 15, 2026

Copy link
Copy Markdown
Member

One alternative that comes to mind, which would also be a fairly small change to this PR, is that we could instead treat this as a (worst case) boundary condition reported by the plugin, check it against the one configured by the admin, and prevent/abort registration/startup of the plugin on the runtime side if it exceeds the timeout set by the admin.

Effectively this same behavior would be also possible to implement on the plugin/stub side, since the admin configured timeouts are communicated to the plugin, so the stub could fail with an error if the plugin would like to have a larger timeout that what is allowed by the admin. But doing it on the runtime side would have the advantage of ensuring identical behavior across multiple plugin/stub implementations (golang and rust).

this ^ is also what I was thinking in the prior comment #304 (comment) so maybe on load do reject based on the pattern you mentioned then on the adaptation invokes pass in the context timeout remaining to inform the plugin just how much time they have in ctx before the response is cancelled.

Course this needs to be considered in the context of some soln for must include dependencies/ordering.

@mikebrow mikebrow added enhancement New feature or request Discussion Needed Significant issue require careful consideration/discussion before continuing to a pull request labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Discussion Needed Significant issue require careful consideration/discussion before continuing to a pull request enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Allow configuring request timeout per plugin instead of using a single global timeout

3 participants