Skip to content

Conversation

@samuelkarp
Copy link
Member

@samuelkarp samuelkarp commented Oct 31, 2023


This series of commits adds support for recording and querying deprecated feature usage. We currently document our deprecations in the RELEASES.md file and have some warnings emitted into the log, but determining whether any of those features are in use requires understanding the config and call patterns of clients and/or log scanning. A service that records deprecated feature usage will make it possible to surface warnings to administrators who may not be the regular end-user of containerd (such as a Kubernetes cluster admin).

This was implemented for containerd 2.0, but since the goal is helping with significant deprecations for 2.0 I am backporting to 1.7 (and later 1.6), adding warnings as necessary.

The series as-is adds the basic infrastructure and warnings for 1 current deprecation that exists in release/1.7:

  • schema 1 image conversion (which should be removed from main soon)

Subsequent PRs will cover the other deprecations tracked in #9312.

The implementation is as follows:

  • A new warning service has been implemented which plugins can call to emit deprecation warnings.
  • The Introspection service's Server RPC now returns deprecation warnings, retrieved from the warning service.
  • Warnings are in-memory. Any non-persisted warnings are cleared when containerd restarts, but may be re-generated if the condition remains true.
  • Only allowlisted warning types and hard-coded messages can be returned. This bounds the size of the Server RPC response by the number of deprecations and bounds the memory usage of the warning service.
  • The last occurrence is the only timestamp tracked, as the most-recent usage should be the easiest to correlate in logs.
  • ctr deprecations list can be used to query recorded warnings and output either for human consumption or in json

Sample output:

$ bin/ctr deprecations list
ID                                               LAST OCCURRENCE                   MESSAGE    
io.containerd.deprecation/pull-schema-1-image    2023-10-31T23:00:29.633931883Z    Schema 1 images are deprecated since containerd v1.7 and removed in containerd v2.0. Since containerd v1.7.8, schema 1 images are identified by the "io.containerd.image/converted-docker-schema1" label.

It may be easiest to review this PR commit-by-commit, as the overall size is somewhat large but each individual commit is scoped to a single piece.

@samuelkarp samuelkarp mentioned this pull request Oct 31, 2023
3 tasks
@samuelkarp samuelkarp force-pushed the deprecation-warning-1.7 branch from 9809946 to b61218e Compare November 1, 2023 00:06
This package enumerates the known deprecations in the current version of
containerd.  New deprecations should be added here, and old ones
removed.

Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit aff5b80)
Signed-off-by: Samuel Karp <[email protected]>
Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit 240733c)
Signed-off-by: Samuel Karp <[email protected]>
The Server rpc in introspection service is extended to expose
deprecation warnings based on observed feature use in containerd.

Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit 57c897f)
Signed-off-by: Samuel Karp <[email protected]>
Deprecation warnings are retrieved from the warning service and
returned via the Server RPC.

Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit 9aab446)
Signed-off-by: Samuel Karp <[email protected]>
Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit bc861b6)
Signed-off-by: Samuel Karp <[email protected]>
Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit 260e71a)
Signed-off-by: Samuel Karp <[email protected]>
Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit 079383d)
Signed-off-by: Samuel Karp <[email protected]>
Signed-off-by: Samuel Karp <[email protected]>
(cherry picked from commit 3fff8b4)
Signed-off-by: Samuel Karp <[email protected]>
@samuelkarp samuelkarp force-pushed the deprecation-warning-1.7 branch from b61218e to 60d48ff Compare November 1, 2023 00:11
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@samuelkarp samuelkarp merged commit 311ec86 into containerd:release/1.7 Nov 2, 2023
Mengkzhaoyun pushed a commit to open-beagle/containerd that referenced this pull request Dec 20, 2023
containerd 1.7.9

Welcome to the v1.7.9 release of containerd!

The ninth patch release for containerd 1.7 contains various fixes and updates.

* **update runc binary to v1.1.10::** ([#9359](containerd/containerd#9359))
* **vendor: upgrade OpenTelemetry to v1.19.0 / v0.45.0** ([#9301](containerd/containerd#9301))
* **Expose usage of cri-api v1alpha2** ([#9336](containerd/containerd#9336))
* **integration: deflake TestIssue9103** ([#9354](containerd/containerd#9354))
* **fix: shimv1 leak issue** ([#9344](containerd/containerd#9344))
* **cri: add deprecation warnings for mirrors, auths, and configs** ([#9327](containerd/containerd#9327))
* **Update hcsshim tag to v0.11.4** ([#9326](containerd/containerd#9326))
* **Expose usage of deprecated features** ([#9315](containerd/containerd#9315))

See the changelog for complete list of changes

Please try out the release binaries and report any issues at
https://github.com/containerd/containerd/issues.

* Samuel Karp
* Kazuyoshi Kato
* Wei Fu
* Kirtana Ashok
* Derek McGowan
* Milas Bowman
* Sebastiaan van Stijn
* ruiwen-zhao
<details><summary>28 commits</summary>
<p>

* [release/1.7] Add release notes for v1.7.9 ([#9333](containerd/containerd#9333))
  * [`4b912af52`](containerd/containerd@4b912af) Add release notes for v1.7.9
* [release/1.7 backport] update runc binary to v1.1.10 ([#9359](containerd/containerd#9359))
  * [`eff291713`](containerd/containerd@eff2917) update runc binary to v1.1.10
* [release/1.7] vendor: upgrade OpenTelemetry to v1.19.0 / v0.45.0 ([#9301](containerd/containerd#9301))
  * [`bd9428ff7`](containerd/containerd@bd9428f) vendor: upgrade OpenTelemetry to v1.19.0 / v0.45.0
* [release/1.7] Expose usage of cri-api v1alpha2 ([#9336](containerd/containerd#9336))
  * [`d62cba40c`](containerd/containerd@d62cba4) Expose usage of cri-api v1alpha2
* [release/1.7] integration: deflake TestIssue9103 ([#9354](containerd/containerd#9354))
  * [`5dbc258a8`](containerd/containerd@5dbc258) integration: deflake TestIssue9103
* [release/1.7] fix: shimv1 leak issue ([#9344](containerd/containerd#9344))
  * [`449912857`](containerd/containerd@4499128) fix: shimv1 leak issue
* [release/1.7] cri: add deprecation warnings for mirrors, auths, and configs ([#9327](containerd/containerd#9327))
  * [`152c57e91`](containerd/containerd@152c57e) cri: add deprecation warning for configs
  * [`689a1036d`](containerd/containerd@689a103) cri: add deprecation warning for auths
  * [`8c38975bf`](containerd/containerd@8c38975) cri: add deprecation warning for mirrors
  * [`1fbce40c4`](containerd/containerd@1fbce40) cri: add ability to emit deprecation warnings
* [release/1.7] Update hcsshim tag to v0.11.4 ([#9326](containerd/containerd#9326))
  * [`73f15bdb6`](containerd/containerd@73f15bd) Update hcsshim tag to v0.11.4
* [release/1.7] Expose usage of deprecated features ([#9315](containerd/containerd#9315))
  * [`60d48ffea`](containerd/containerd@60d48ff) ctr: new deprecations command
  * [`74a06671a`](containerd/containerd@74a0667) plugin: record deprecation for dynamic plugins
  * [`fa5f3c91a`](containerd/containerd@fa5f3c9) server: add ability to record config deprecations
  * [`f7880e7f0`](containerd/containerd@f7880e7) pull: record deprecation warning for schema 1
  * [`1dd2f2c02`](containerd/containerd@1dd2f2c) introspection: add support for deprecations
  * [`aaf000c18`](containerd/containerd@aaf000c) api/introspection: deprecation warnings in server
  * [`9b7ceee54`](containerd/containerd@9b7ceee) warning: new service for deprecations
  * [`b708f8bfa`](containerd/containerd@b708f8b) deprecation: new package for deprecations
</p>
</details>

* **github.com/Microsoft/hcsshim**                                                 v0.11.1 -> v0.11.4
* **github.com/cenkalti/backoff/v4**                                               v4.2.0 -> v4.2.1
* **github.com/go-logr/logr**                                                      v1.2.3 -> v1.2.4
* **github.com/grpc-ecosystem/grpc-gateway/v2**                                    v2.7.0 -> v2.16.0
* **go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc**  v0.40.0 -> v0.45.0
* **go.opentelemetry.io/otel**                                                     v1.14.0 -> v1.19.0
* **go.opentelemetry.io/otel/exporters/otlp/otlptrace**                            v1.14.0 -> v1.19.0
* **go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc**              v1.14.0 -> v1.19.0
* **go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp**              v1.14.0 -> v1.19.0
* **go.opentelemetry.io/otel/metric**                                              v0.37.0 -> v1.19.0
* **go.opentelemetry.io/otel/sdk**                                                 v1.14.0 -> v1.19.0
* **go.opentelemetry.io/otel/trace**                                               v1.14.0 -> v1.19.0
* **go.opentelemetry.io/proto/otlp**                                               v0.19.0 -> v1.0.0

Previous release can be found at [v1.7.8](https://github.com/containerd/containerd/releases/tag/v1.7.8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants