@@ -32,7 +32,6 @@ import (
32
32
"github.com/containerd/containerd/v2/pkg/errdefs"
33
33
"github.com/containerd/log"
34
34
"github.com/containerd/typeurl/v2"
35
- "github.com/opencontainers/runtime-spec/specs-go"
36
35
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
37
36
"github.com/opencontainers/runtime-tools/generate"
38
37
cri "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -117,7 +116,7 @@ func (a *API) RemovePodSandbox(ctx context.Context, criPod *sstore.Sandbox) erro
117
116
return err
118
117
}
119
118
120
- func (a * API ) CreateContainer (ctx context.Context , ctrs * containers.Container , spec * specs .Spec ) (* api.ContainerAdjustment , error ) {
119
+ func (a * API ) CreateContainer (ctx context.Context , ctrs * containers.Container , spec * runtimespec .Spec ) (* api.ContainerAdjustment , error ) {
121
120
ctr := a .nriContainer (ctrs , spec )
122
121
123
122
criPod , err := a .cri .SandboxStore ().Get (ctr .GetPodSandboxID ())
@@ -256,7 +255,7 @@ func (a *API) RemoveContainer(ctx context.Context, criPod *sstore.Sandbox, criCt
256
255
return err
257
256
}
258
257
259
- func (a * API ) UndoCreateContainer (ctx context.Context , criPod * sstore.Sandbox , id string , spec * specs .Spec ) {
258
+ func (a * API ) UndoCreateContainer (ctx context.Context , criPod * sstore.Sandbox , id string , spec * runtimespec .Spec ) {
260
259
if a .IsDisabled () {
261
260
return
262
261
}
@@ -318,7 +317,7 @@ func (a *API) WithContainerAdjustment() containerd.NewContainerOpts {
318
317
)
319
318
320
319
return func (ctx context.Context , _ * containerd.Client , c * containers.Container ) error {
321
- spec := & specs .Spec {}
320
+ spec := & runtimespec .Spec {}
322
321
if err := json .Unmarshal (c .Spec .GetValue (), spec ); err != nil {
323
322
return fmt .Errorf ("failed to unmarshal container OCI Spec for NRI: %w" , err )
324
323
}
@@ -463,14 +462,14 @@ func (a *API) EvictContainer(ctx context.Context, e *api.ContainerEviction) erro
463
462
464
463
type criPodSandbox struct {
465
464
* sstore.Sandbox
466
- spec * specs .Spec
465
+ spec * runtimespec .Spec
467
466
pid uint32
468
467
}
469
468
470
469
func (a * API ) nriPodSandbox (pod * sstore.Sandbox ) * criPodSandbox {
471
470
criPod := & criPodSandbox {
472
471
Sandbox : pod ,
473
- spec : & specs .Spec {},
472
+ spec : & runtimespec .Spec {},
474
473
}
475
474
476
475
if pod == nil || pod .Container == nil {
@@ -490,13 +489,10 @@ func (a *API) nriPodSandbox(pod *sstore.Sandbox) *criPodSandbox {
490
489
criPod .pid = task .Pid ()
491
490
spec , err := task .Spec (ctx )
492
491
if err != nil {
493
- if err != nil {
494
- log .L .WithError (err ).Errorf ("failed to get spec for sandbox container %s" ,
495
- pod .Container .ID ())
496
- }
492
+ log .L .WithError (err ).Errorf ("failed to get spec for sandbox container %s" ,
493
+ pod .Container .ID ())
497
494
return criPod
498
495
}
499
-
500
496
criPod .spec = spec
501
497
502
498
return criPod
@@ -644,12 +640,12 @@ func (p *criPodSandbox) GetPid() uint32 {
644
640
type criContainer struct {
645
641
api * API
646
642
ctrs * containers.Container
647
- spec * specs .Spec
643
+ spec * runtimespec .Spec
648
644
meta * cstore.Metadata
649
645
pid uint32
650
646
}
651
647
652
- func (a * API ) nriContainer (ctr interface {}, spec * specs .Spec ) * criContainer {
648
+ func (a * API ) nriContainer (ctr interface {}, spec * runtimespec .Spec ) * criContainer {
653
649
switch c := ctr .(type ) {
654
650
case * cstore.Container :
655
651
ctx := ctrdutil .NamespacedContext ()
@@ -662,7 +658,7 @@ func (a *API) nriContainer(ctr interface{}, spec *specs.Spec) *criContainer {
662
658
spec , err := ctrd .Spec (ctx )
663
659
if err != nil {
664
660
log .L .WithError (err ).Errorf ("failed to get OCI Spec for container %s" , ctrd .ID ())
665
- spec = & specs .Spec {}
661
+ spec = & runtimespec .Spec {}
666
662
}
667
663
task , err := ctrd .Task (ctx , nil )
668
664
if err != nil {
@@ -703,7 +699,7 @@ func (a *API) nriContainer(ctr interface{}, spec *specs.Spec) *criContainer {
703
699
return & criContainer {
704
700
api : a ,
705
701
meta : & cstore.Metadata {},
706
- spec : & specs .Spec {},
702
+ spec : & runtimespec .Spec {},
707
703
}
708
704
}
709
705
0 commit comments