nri,deprecation: record and emit warnings for NRI deprecations. - #13916
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds first-class tracking for deprecated NRI plugin interface usage by wiring the NRI subsystem into containerd’s deprecation warning service, so older/unrecompiled plugins can be detected and surfaced as deprecation warnings.
Changes:
- Add a new deprecation warning ID (
io.containerd.deprecation/nri-plugin-interface) and message. - Plumb the
plugins.WarningPluginservice into NRI initialization and register an NRI deprecation recorder. - Introduce an NRI deprecation recorder that emits a warning (and logs) when deprecated NRI interfaces are used.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugins/nri/plugin.go | Adds WarningPlugin as a dependency and passes the warning service into NRI initialization. |
| pkg/deprecation/deprecation.go | Introduces the NRIPluginInterface deprecation warning ID and message. |
| internal/nri/nri.go | Updates New signature to accept warning.Service and registers a deprecation recorder option. |
| internal/nri/deprecations.go | Implements the NRI deprecation recorder that emits/records warnings for deprecated interfaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
|
|
||
| cfg.ConfigureTimeouts() | ||
| opts = append(opts, nri.WithDeprecationRecorder(&recorder{ws: ws})) |
0e73d21 to
571ad67
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
pkg/deprecation/deprecation.go:69
- The new deprecation warning message is much less actionable than other entries in this map and also loses the specific guidance from the upstream NRI deprecation log (deprecated StateChange + recommendation to update/recompile plugins). Consider making the message explicitly describe the deprecated interface and what the operator should do.
NRIPluginInterface: "NRI plugin uses a deprecated interface.",
internal/nri/deprecations.go:42
- The new deprecation recorder behavior (emitting the warning service event on DeprecatedStateChange, and not emitting for unknown deprecations) is currently untested. Since this affects operator-visible warnings, please add unit tests for PluginWarning (e.g., with a small fake warning.Service that records emitted IDs) to prevent regressions.
func (r *recorder) PluginWarning(ctx context.Context, d nri.Deprecation, plugin, details string) {
switch d {
case nri.DeprecatedStateChange:
r.ws.Emit(ctx, deprecation.NRIPluginInterface)
msg, _ := deprecation.Message(deprecation.NRIPluginInterface)
log.G(ctx).WithFields(log.Fields{
"deprecated": "StateChange",
"plugin": plugin,
"details": details,
}).Warn(msg)
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
571ad67 to
bf0111a
Compare
|
/cherry-pick release/2.3 |
|
@mikebrow: new pull request created: #13935 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Record a deprecation and emit a warning for old/unrecompiled plugins using deprecated NRI interfaces.