Skip to content

Commit 8838eb9

Browse files
authored
Revert "[ws-daemon] Change readiness behavior to wait for registry-facade (#1…" (#19668)
This reverts commit a2a81e0.
1 parent 2679260 commit 8838eb9

File tree

4 files changed

+4
-35
lines changed

4 files changed

+4
-35
lines changed

components/ws-daemon/pkg/container/config.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ type Config struct {
3535

3636
// Containerd contains the containerd CRI config if runtime == RuntimeContainerd
3737
Containerd *ContainerdConfig `json:"containerd,omitempty"`
38-
39-
RegistryFacadeHost string `json:"registryFacadeHost,omitempty"`
4038
}
4139

4240
// RuntimeType lists the supported container runtimes
@@ -65,7 +63,7 @@ func FromConfig(cfg *Config) (rt Runtime, err error) {
6563
if cfg.Containerd == nil {
6664
return nil, xerrors.Errorf("runtime is set to containerd, but not containerd config is provided")
6765
}
68-
return NewContainerd(cfg.Containerd, cfg.Mapping, cfg.RegistryFacadeHost)
66+
return NewContainerd(cfg.Containerd, cfg.Mapping)
6967
default:
7068
return nil, xerrors.Errorf("unknown runtime type: %s", cfg.Runtime)
7169
}

components/ws-daemon/pkg/container/containerd.go

+3-29
Original file line numberDiff line numberDiff line change
@@ -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

8278
type 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.
483480
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)
508482
}
509483

510484
var kubepodsQoSRegexp = regexp.MustCompile(`([^/]+)-([^/]+)-pod`)

components/ws-daemon/pkg/daemon/config.go

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ type Config struct {
3030
OOMScores cgroup.OOMScoreAdjConfig `json:"oomScores"`
3131
DiskSpaceGuard diskguard.Config `json:"disk"`
3232
WorkspaceController WorkspaceControllerConfig `json:"workspaceController"`
33-
34-
RegistryFacadeHost string `json:"registryFacadeHost,omitempty"`
3533
}
3634

3735
type WorkspaceControllerConfig struct {

install/installer/pkg/components/ws-daemon/configmap.go

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
113113

114114
wsdcfg := wsdconfig.Config{
115115
Daemon: daemon.Config{
116-
RegistryFacadeHost: fmt.Sprintf("reg.%s:%d", ctx.Config.Domain, common.RegistryFacadeServicePort),
117116
Runtime: daemon.RuntimeConfig{
118117
KubernetesNamespace: ctx.Namespace,
119118
SecretsNamespace: common.WorkspaceSecretsNamespace,

0 commit comments

Comments
 (0)