Skip to content

Commit

Permalink
Merge pull request containerd#8264 from AkihiroSuda/remove-restart-lo…
Browse files Browse the repository at this point in the history
…gpath

Remove "containerd.io/restart.logpath" label (deprecated since v1.5)
  • Loading branch information
dmcgowan authored Mar 15, 2023
2 parents fe3cd17 + 35a103d commit eebd4ad
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ The deprecated features are shown in the following table:
| Runc V1 implementation of Runtime V2 (`io.containerd.runc.v1`) | containerd v1.4 | containerd v2.0 | Use `io.containerd.runc.v2` |
| config.toml `version = 1` | containerd v1.5 | containerd v2.0 | Use config.toml `version = 2` |
| Built-in `aufs` snapshotter | containerd v1.5 | containerd v2.0 ✅ | Use `overlayfs` snapshotter |
| Container label `containerd.io/restart.logpath` | containerd v1.5 | containerd v2.0 | Use `containerd.io/restart.loguri` label |
| Container label `containerd.io/restart.logpath` | containerd v1.5 | containerd v2.0 | Use `containerd.io/restart.loguri` label |
| `cri-containerd-*.tar.gz` release bundles | containerd v1.6 | containerd v2.0 | Use `containerd-*.tar.gz` bundles |
| Pulling Schema 1 images (`application/vnd.docker.distribution.manifest.v1+json`) | containerd v1.7 | containerd v2.0 | Use Schema 2 or OCI images |
| CRI `v1alpha2` | containerd v1.7 | containerd v2.0 | Use CRI `v1` |
Expand Down
11 changes: 0 additions & 11 deletions runtime/restart/monitor/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/runtime/restart"
"github.com/sirupsen/logrus"
)

type stopChange struct {
Expand All @@ -41,9 +40,6 @@ type startChange struct {
container containerd.Container
logURI string
count int

// Deprecated(in release 1.5): but recognized now, prefer to use logURI
logPath string
}

func (s *startChange) apply(ctx context.Context, client *containerd.Client) error {
Expand All @@ -55,13 +51,6 @@ func (s *startChange) apply(ctx context.Context, client *containerd.Client) erro
return fmt.Errorf("failed to parse %v into url: %w", s.logURI, err)
}
log = cio.LogURI(uri)
} else if s.logPath != "" {
log = cio.LogFile(s.logPath)
}

if s.logURI != "" && s.logPath != "" {
logrus.Warnf("LogPathLabel=%v has been deprecated, using LogURILabel=%v",
s.logPath, s.logURI)
}

if s.count > 0 {
Expand Down
4 changes: 3 additions & 1 deletion runtime/restart/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ func (m *monitor) monitor(ctx context.Context) ([]change, error) {
continue
}
restartCount, _ := strconv.Atoi(labels[restart.CountLabel])
if labels["containerd.io/restart.logpath"] != "" {
logrus.Warn(`Label "containerd.io/restart.logpath" is no longer supported since containerd v2.0. Use "containerd.io/restart.loguri" instead.`)
}
changes = append(changes, &startChange{
container: c,
logPath: labels[restart.LogPathLabel],
logURI: labels[restart.LogURILabel],
count: restartCount + 1,
})
Expand Down
17 changes: 0 additions & 17 deletions runtime/restart/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ const (
CountLabel = "containerd.io/restart.count"
// ExplicitlyStoppedLabel sets the restart explicitly stopped label for a container
ExplicitlyStoppedLabel = "containerd.io/restart.explicitly-stopped"

// LogPathLabel sets the restart log path label for a container
//
// Deprecated(in release 1.5): use LogURILabel
LogPathLabel = "containerd.io/restart.logpath"
)

// Policy represents the restart policies of a container.
Expand Down Expand Up @@ -188,17 +183,6 @@ func WithFileLogURI(path string) func(context.Context, *containerd.Client, *cont
return WithLogURI(uri)
}

// WithLogPath sets the log path for a container
//
// Deprecated(in release 1.5): use WithLogURI with "file://<path>" URI.
func WithLogPath(path string) func(context.Context, *containerd.Client, *containers.Container) error {
return func(_ context.Context, _ *containerd.Client, c *containers.Container) error {
ensureLabels(c)
c.Labels[LogPathLabel] = path
return nil
}
}

// WithStatus sets the status for a container
func WithStatus(status containerd.ProcessStatus) func(context.Context, *containerd.Client, *containers.Container) error {
return func(_ context.Context, _ *containerd.Client, c *containers.Container) error {
Expand All @@ -224,7 +208,6 @@ func WithNoRestarts(_ context.Context, _ *containerd.Client, c *containers.Conta
}
delete(c.Labels, StatusLabel)
delete(c.Labels, PolicyLabel)
delete(c.Labels, LogPathLabel)
delete(c.Labels, LogURILabel)
return nil
}
Expand Down

0 comments on commit eebd4ad

Please sign in to comment.