X Tutup
Skip to content

Commit d2013d2

Browse files
committed
runtime: deprecate runc --criu / -criu-path option
runc option --criu is now ignored (with a warning), and the option will be removed entirely in a future release. Users who need a non- standard criu binary should rely on the standard way of looking up binaries in $PATH. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent f8585d6 commit d2013d2

File tree

14 files changed

+129
-104
lines changed

14 files changed

+129
-104
lines changed

cmd/containerd-shim/main_unix.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func parseFlags() {
7878
flag.StringVar(&addressFlag, "address", "", "grpc address back to main containerd")
7979
flag.StringVar(&workdirFlag, "workdir", "", "path used to storage large temporary data")
8080
flag.StringVar(&runtimeRootFlag, "runtime-root", process.RuncRoot, "root directory for the runtime")
81-
flag.StringVar(&criuFlag, "criu", "", "path to criu binary")
81+
flag.StringVar(&criuFlag, "criu", "", "path to criu binary (deprecated: do not use)")
8282
flag.BoolVar(&systemdCgroupFlag, "systemd-cgroup", false, "set runtime to use systemd-cgroup")
8383
// currently, the `containerd publish` utility is embedded in the daemon binary.
8484
// The daemon invokes `containerd-shim -containerd-binary ...` with its own os.Executable() path.
@@ -176,7 +176,6 @@ func executeShim() error {
176176
Path: path,
177177
Namespace: namespaceFlag,
178178
WorkDir: workdirFlag,
179-
Criu: criuFlag,
180179
SystemdCgroup: systemdCgroupFlag,
181180
RuntimeRoot: runtimeRootFlag,
182181
},

pkg/process/init.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type Init struct {
7979
}
8080

8181
// NewRunc returns a new runc instance for a process
82-
func NewRunc(root, path, namespace, runtime, criu string, systemd bool) *runc.Runc {
82+
func NewRunc(root, path, namespace, runtime string, systemd bool) *runc.Runc {
8383
if root == "" {
8484
root = RuncRoot
8585
}
@@ -89,7 +89,6 @@ func NewRunc(root, path, namespace, runtime, criu string, systemd bool) *runc.Ru
8989
LogFormat: runc.JSON,
9090
PdeathSignal: unix.SIGKILL,
9191
Root: filepath.Join(root, namespace),
92-
Criu: criu,
9392
SystemdCgroup: systemd,
9493
}
9594
}

runtime/linux/runctypes/next.pb.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ file {
2323
number: 3
2424
label: LABEL_OPTIONAL
2525
type: TYPE_STRING
26+
options {
27+
deprecated: true
28+
}
2629
json_name: "criuPath"
2730
}
2831
field {

runtime/linux/runctypes/runc.pb.go

Lines changed: 48 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/linux/runctypes/runc.proto

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ option go_package = "github.com/containerd/containerd/runtime/linux/runctypes;ru
99
message RuncOptions {
1010
string runtime = 1;
1111
string runtime_root = 2;
12-
string criu_path = 3;
12+
// criu binary path.
13+
//
14+
// Deprecated: runc option --criu is now ignored (with a warning), and the
15+
// option will be removed entirely in a future release. Users who need a non-
16+
// standard criu binary should rely on the standard way of looking up binaries
17+
// in $PATH.
18+
string criu_path = 3 [deprecated = true];
1319
bool systemd_cgroup = 4;
1420
}
1521

runtime/v1/linux/bundle.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,10 @@ func (b *bundle) decideShimAddress(namespace string) string {
217217

218218
func (b *bundle) shimConfig(namespace string, c *Config, runcOptions *runctypes.RuncOptions) shim.Config {
219219
var (
220-
criuPath string
221220
runtimeRoot = c.RuntimeRoot
222221
systemdCgroup bool
223222
)
224223
if runcOptions != nil {
225-
criuPath = runcOptions.CriuPath
226224
systemdCgroup = runcOptions.SystemdCgroup
227225
if runcOptions.RuntimeRoot != "" {
228226
runtimeRoot = runcOptions.RuntimeRoot
@@ -232,7 +230,6 @@ func (b *bundle) shimConfig(namespace string, c *Config, runcOptions *runctypes.
232230
Path: b.path,
233231
WorkDir: b.workDir,
234232
Namespace: namespace,
235-
Criu: criuPath,
236233
RuntimeRoot: runtimeRoot,
237234
SystemdCgroup: systemdCgroup,
238235
}

runtime/v1/shim/client/client.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ func newCommand(binary, daemonAddress string, debug bool, config shim.Config, so
197197
"-containerd-binary", selfExe,
198198
}
199199

200-
if config.Criu != "" {
201-
args = append(args, "-criu-path", config.Criu)
202-
}
203200
if config.RuntimeRoot != "" {
204201
args = append(args, "-runtime-root", config.RuntimeRoot)
205202
}

runtime/v1/shim/service.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,15 @@ var (
6262

6363
// Config contains shim specific configuration
6464
type Config struct {
65-
Path string
66-
Namespace string
67-
WorkDir string
65+
Path string
66+
Namespace string
67+
WorkDir string
68+
// Criu is the path to the criu binary used for checkpoint and restore.
69+
//
70+
// Deprecated: runc option --criu is now ignored (with a warning), and the
71+
// option will be removed entirely in a future release. Users who need a non-
72+
// standard criu binary should rely on the standard way of looking up binaries
73+
// in $PATH.
6874
Criu string
6975
RuntimeRoot string
7076
SystemdCgroup bool
@@ -172,7 +178,6 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (_ *
172178
s.config.WorkDir,
173179
s.config.RuntimeRoot,
174180
s.config.Namespace,
175-
s.config.Criu,
176181
s.config.SystemdCgroup,
177182
s.platform,
178183
config,
@@ -637,7 +642,7 @@ func getTopic(ctx context.Context, e interface{}) string {
637642
return runtime.TaskUnknownTopic
638643
}
639644

640-
func newInit(ctx context.Context, path, workDir, runtimeRoot, namespace, criu string, systemdCgroup bool, platform stdio.Platform, r *process.CreateConfig, rootfs string) (*process.Init, error) {
645+
func newInit(ctx context.Context, path, workDir, runtimeRoot, namespace string, systemdCgroup bool, platform stdio.Platform, r *process.CreateConfig, rootfs string) (*process.Init, error) {
641646
var options runctypes.CreateOptions
642647
if r.Options != nil {
643648
v, err := typeurl.UnmarshalAny(r.Options)
@@ -647,7 +652,7 @@ func newInit(ctx context.Context, path, workDir, runtimeRoot, namespace, criu st
647652
options = *v.(*runctypes.CreateOptions)
648653
}
649654

650-
runtime := process.NewRunc(runtimeRoot, path, namespace, r.Runtime, criu, systemdCgroup)
655+
runtime := process.NewRunc(runtimeRoot, path, namespace, r.Runtime, systemdCgroup)
651656
p := process.New(r.ID, runtime, stdio.Stdio{
652657
Stdin: r.Stdin,
653658
Stdout: r.Stdout,

runtime/v2/runc/container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func WriteRuntime(path, runtime string) error {
210210

211211
func newInit(ctx context.Context, path, workDir, namespace string, platform stdio.Platform,
212212
r *process.CreateConfig, options *options.Options, rootfs string) (*process.Init, error) {
213-
runtime := process.NewRunc(options.Root, path, namespace, options.BinaryName, options.CriuPath, options.SystemdCgroup)
213+
runtime := process.NewRunc(options.Root, path, namespace, options.BinaryName, options.SystemdCgroup)
214214
p := process.New(r.ID, runtime, stdio.Stdio{
215215
Stdin: r.Stdin,
216216
Stdout: r.Stdout,

runtime/v2/runc/manager/manager_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (manager) Stop(ctx context.Context, id string) (shim.StopStatus, error) {
261261
root = opts.Root
262262
}
263263

264-
r := process.NewRunc(root, path, ns, runtime, "", false)
264+
r := process.NewRunc(root, path, ns, runtime, false)
265265
if err := r.Delete(ctx, id, &runcC.DeleteOpts{
266266
Force: true,
267267
}); err != nil {

0 commit comments

Comments
 (0)
X Tutup