File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 19
19
package cgroups
20
20
21
21
import (
22
+ "context"
23
+
22
24
"github.com/containerd/cgroups/v3"
23
25
v1 "github.com/containerd/containerd/v2/core/metrics/cgroups/v1"
24
26
v2 "github.com/containerd/containerd/v2/core/metrics/cgroups/v2"
25
27
"github.com/containerd/containerd/v2/core/runtime"
26
28
"github.com/containerd/containerd/v2/pkg/events"
27
29
"github.com/containerd/containerd/v2/plugins"
30
+ "github.com/containerd/containerd/v2/version"
28
31
"github.com/containerd/platforms"
29
32
"github.com/containerd/plugin"
30
33
"github.com/containerd/plugin/registry"
@@ -45,6 +48,20 @@ func init() {
45
48
plugins .EventPlugin ,
46
49
},
47
50
Config : & Config {},
51
+ ConfigMigration : func (ctx context.Context , configVersion int , pluginConfigs map [string ]interface {}) error {
52
+ if configVersion >= version .ConfigVersion {
53
+ return nil
54
+ }
55
+ // Previous plugin name
56
+ const pluginName = "io.containerd.monitor.v1.cgroups"
57
+ c , ok := pluginConfigs [pluginName ]
58
+ if ok {
59
+ pluginConfigs [string (plugins .TaskMonitorPlugin )+ ".cgroups" ] = c
60
+ delete (pluginConfigs , pluginName )
61
+ }
62
+
63
+ return nil
64
+ },
48
65
})
49
66
}
50
67
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import (
28
28
"github.com/containerd/containerd/v2/internal/tomlext"
29
29
"github.com/containerd/containerd/v2/pkg/namespaces"
30
30
"github.com/containerd/containerd/v2/plugins"
31
+ "github.com/containerd/containerd/v2/version"
31
32
"github.com/containerd/log"
32
33
"github.com/containerd/plugin"
33
34
"github.com/containerd/plugin/registry"
@@ -41,7 +42,7 @@ type Config struct {
41
42
42
43
func init () {
43
44
registry .Register (& plugin.Registration {
44
- Type : plugins .InternalPlugin ,
45
+ Type : plugins .ContainerMonitorPlugin ,
45
46
Requires : []plugin.Type {
46
47
plugins .EventPlugin ,
47
48
plugins .ServicePlugin ,
@@ -62,6 +63,19 @@ func init() {
62
63
go m .run (tomlext .ToStdTime (ic .Config .(* Config ).Interval ))
63
64
return m , nil
64
65
},
66
+ ConfigMigration : func (ctx context.Context , configVersion int , pluginConfigs map [string ]interface {}) error {
67
+ if configVersion >= version .ConfigVersion {
68
+ return nil
69
+ }
70
+ const pluginName = string (plugins .InternalPlugin ) + ".restart"
71
+ c , ok := pluginConfigs [pluginName ]
72
+ if ok {
73
+ pluginConfigs [string (plugins .ContainerMonitorPlugin )+ ".restart" ] = c
74
+ delete (pluginConfigs , pluginName )
75
+ }
76
+
77
+ return nil
78
+ },
65
79
})
66
80
}
67
81
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ const (
38
38
// SnapshotPlugin implements a snapshotter
39
39
SnapshotPlugin plugin.Type = "io.containerd.snapshotter.v1"
40
40
// TaskMonitorPlugin implements a task monitor
41
- TaskMonitorPlugin plugin.Type = "io.containerd.monitor.v1"
41
+ TaskMonitorPlugin plugin.Type = "io.containerd.monitor.task.v1"
42
+ // TaskMonitorPlugin implements a container monitor
43
+ ContainerMonitorPlugin plugin.Type = "io.containerd.monitor.container.v1"
42
44
// DiffPlugin implements a differ
43
45
DiffPlugin plugin.Type = "io.containerd.differ.v1"
44
46
// MetadataPlugin implements a metadata store
You can’t perform that action at this time.
0 commit comments