@@ -38,7 +38,7 @@ const (
3838)
3939
4040// 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 ) {
4242 cc , err := containerd .New (cfg .SocketPath , containerd .WithDefaultNamespace (kubernetesNamespace ))
4343 if err != nil {
4444 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
5858 cntIdx : make (map [string ]* containerInfo ),
5959 podIdx : make (map [string ]* containerInfo ),
6060 wsiIdx : make (map [string ]* containerInfo ),
61-
62- registryFacadeHost : registryFacadeHost ,
6361 }
6462 go res .start ()
6563
@@ -75,8 +73,6 @@ type Containerd struct {
7573 podIdx map [string ]* containerInfo
7674 wsiIdx map [string ]* containerInfo
7775 cntIdx map [string ]* containerInfo
78-
79- registryFacadeHost string
8076}
8177
8278type containerInfo struct {
@@ -480,31 +476,9 @@ func (s *Containerd) ContainerPID(ctx context.Context, id ID) (pid uint64, err e
480476 return uint64 (info .PID ), nil
481477}
482478
479+ // ContainerPID returns the PID of the container's namespace root process, e.g. the container shim.
483480func (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 )
508482}
509483
510484var kubepodsQoSRegexp = regexp .MustCompile (`([^/]+)-([^/]+)-pod` )
0 commit comments