Skip to content

Commit ce2955c

Browse files
authored
Merge pull request #13319 from mxpv/depr
Deprecate shim.Command
2 parents 90dd71c + 3e0ebf0 commit ce2955c

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

core/runtime/v2/binary.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ type binary struct {
6464
}
6565

6666
func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ *shim, err error) {
67-
cmd, err := client.Command(
67+
// containerd daemon is the intended caller of client.Command; the deprecation
68+
// targets external callers.
69+
cmd, err := client.Command( //nolint:staticcheck // SA1019
6870
ctx,
6971
&client.CommandConfig{
7072
ID: b.bundle.ID,
@@ -165,7 +167,9 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
165167
bundlePath = b.bundle.Path
166168
}
167169

168-
cmd, err := client.Command(ctx,
170+
// containerd daemon is the intended caller of client.Command; the deprecation
171+
// targets external callers.
172+
cmd, err := client.Command(ctx, //nolint:staticcheck // SA1019
169173
&client.CommandConfig{
170174
ID: b.bundle.ID,
171175
RuntimePath: b.runtime,

pkg/shim/util.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ type CommandConfig struct {
5757
SocketDir string
5858
}
5959

60-
// Command returns the shim command with the provided args and configuration
60+
// Command returns the shim command with the provided args and configuration.
6161
//
62-
// TODO(refactor): move this function to core containerd runtime. This function is only used
63-
// by the containerd daemon for the initial shim launches (e.g. shim -start) and makes
64-
// no sense for shim implementations.
62+
// Deprecated: this function is internal to the containerd daemon, which uses it to
63+
// invoke the shim binary for "start" and "delete" actions during the shim lifecycle.
64+
// It encodes daemon-specific launch internals — backwards compatibility with older shim
65+
// models and the new Bootstrap protocol used by 2.3+ shims — and is not intended for use
66+
// by external callers. It will be moved into the core containerd runtime package in the future.
6567
func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) {
6668
ns, err := namespaces.NamespaceRequired(ctx)
6769
if err != nil {

0 commit comments

Comments
 (0)