@@ -38,7 +38,7 @@ const (
38
38
)
39
39
40
40
// NewContainerd creates a new containerd adapter
41
- func NewContainerd (cfg * ContainerdConfig , pathMapping PathMapping , registryFacadeHost string ) (* Containerd , error ) {
41
+ func NewContainerd (cfg * ContainerdConfig , pathMapping PathMapping ) (* Containerd , error ) {
42
42
cc , err := containerd .New (cfg .SocketPath , containerd .WithDefaultNamespace (kubernetesNamespace ))
43
43
if err != nil {
44
44
return nil , xerrors .Errorf ("cannot connect to containerd at %s: %w" , cfg .SocketPath , err )
@@ -58,8 +58,6 @@ func NewContainerd(cfg *ContainerdConfig, pathMapping PathMapping, registryFacad
58
58
cntIdx : make (map [string ]* containerInfo ),
59
59
podIdx : make (map [string ]* containerInfo ),
60
60
wsiIdx : make (map [string ]* containerInfo ),
61
-
62
- registryFacadeHost : registryFacadeHost ,
63
61
}
64
62
go res .start ()
65
63
@@ -75,8 +73,6 @@ type Containerd struct {
75
73
podIdx map [string ]* containerInfo
76
74
wsiIdx map [string ]* containerInfo
77
75
cntIdx map [string ]* containerInfo
78
-
79
- registryFacadeHost string
80
76
}
81
77
82
78
type containerInfo struct {
@@ -480,31 +476,9 @@ func (s *Containerd) ContainerPID(ctx context.Context, id ID) (pid uint64, err e
480
476
return uint64 (info .PID ), nil
481
477
}
482
478
479
+ // ContainerPID returns the PID of the container's namespace root process, e.g. the container shim.
483
480
func (s * Containerd ) IsContainerdReady (ctx context.Context ) (bool , error ) {
484
- if len (s .registryFacadeHost ) == 0 {
485
- return s .Client .IsServing (ctx )
486
- }
487
-
488
- // check registry facade can reach containerd and returns image not found.
489
- isServing , err := s .Client .IsServing (ctx )
490
- if err != nil {
491
- return false , err
492
- }
493
-
494
- if ! isServing {
495
- return false , nil
496
- }
497
-
498
- _ , err = s .Client .GetImage (ctx , fmt .Sprintf ("%v/not-a-valid-image:latest" , s .registryFacadeHost ))
499
- if err != nil {
500
- if errdefs .IsNotFound (err ) {
501
- return true , nil
502
- }
503
-
504
- return false , nil
505
- }
506
-
507
- return true , nil
481
+ return s .Client .IsServing (ctx )
508
482
}
509
483
510
484
var kubepodsQoSRegexp = regexp .MustCompile (`([^/]+)-([^/]+)-pod` )
0 commit comments