Remove "containerd.io/restart.logpath" label (deprecated since v1.5)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2023-03-14 15:19:28 +09:00
parent a570c8184a
commit 35a103d321
4 changed files with 4 additions and 30 deletions

View File

@@ -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 {
@@ -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 {
@@ -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 {

View File

@@ -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,
})